| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 cr.define('options.contentSettings', function() { | 5 cr.define('options.contentSettings', function() { |
| 6 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; | 6 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; |
| 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; | 7 /** @const */ var InlineEditableItem = options.InlineEditableItem; |
| 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; | 8 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // This one tracks the actual validity of the pattern in the input. This | 104 // This one tracks the actual validity of the pattern in the input. This |
| 105 // starts off as true so as not to annoy the user when he adds a new and | 105 // starts off as true so as not to annoy the user when he adds a new and |
| 106 // empty input. | 106 // empty input. |
| 107 this.inputIsValid = true; | 107 this.inputIsValid = true; |
| 108 | 108 |
| 109 this.input = input; | 109 this.input = input; |
| 110 this.select = select; | 110 this.select = select; |
| 111 | 111 |
| 112 this.updateEditables(); | 112 this.updateEditables(); |
| 113 | 113 |
| 114 // Editing notifications and geolocation is disabled for now. | 114 // Editing notifications, geolocation and mediastream is disabled for now. |
| 115 if (this.contentType == 'notifications' || | 115 if (this.contentType == 'notifications' || |
| 116 this.contentType == 'location') { | 116 this.contentType == 'location' || |
| 117 this.contentType == 'mediastream') { |
| 117 this.editable = false; | 118 this.editable = false; |
| 118 } | 119 } |
| 119 | 120 |
| 120 // If the source of the content setting exception is not the user | 121 // If the source of the content setting exception is not the user |
| 121 // preference, then the content settings exception is managed and the user | 122 // preference, then the content settings exception is managed and the user |
| 122 // can't edit it. | 123 // can't edit it. |
| 123 if (this.dataItem.source && | 124 if (this.dataItem.source && |
| 124 this.dataItem.source != 'preference') { | 125 this.dataItem.source != 'preference') { |
| 125 this.setAttribute('managedby', this.dataItem.source); | 126 this.setAttribute('managedby', this.dataItem.source); |
| 126 this.deletable = false; | 127 this.deletable = false; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 // changed since we sent the request to analyze it). | 435 // changed since we sent the request to analyze it). |
| 435 if (pattern == listItem.input.value) | 436 if (pattern == listItem.input.value) |
| 436 listItem.setPatternValid(valid); | 437 listItem.setPatternValid(valid); |
| 437 } | 438 } |
| 438 }, | 439 }, |
| 439 | 440 |
| 440 /** | 441 /** |
| 441 * Returns whether the rows are editable in this list. | 442 * Returns whether the rows are editable in this list. |
| 442 */ | 443 */ |
| 443 isEditable: function() { | 444 isEditable: function() { |
| 444 // Editing notifications and geolocation is disabled for now. | 445 // Editing notifications, geolocation and mediastream is disabled for now. |
| 445 return !(this.contentType == 'notifications' || | 446 return !(this.contentType == 'notifications' || |
| 446 this.contentType == 'location' || | 447 this.contentType == 'location' || |
| 447 this.contentType == 'fullscreen'); | 448 this.contentType == 'fullscreen' || |
| 449 this.contentType == 'mediastream'); |
| 448 }, | 450 }, |
| 449 | 451 |
| 450 /** | 452 /** |
| 451 * Removes all exceptions from the js model. | 453 * Removes all exceptions from the js model. |
| 452 */ | 454 */ |
| 453 reset: function() { | 455 reset: function() { |
| 454 if (this.isEditable()) { | 456 if (this.isEditable()) { |
| 455 // The null creates the Add New Exception row. | 457 // The null creates the Add New Exception row. |
| 456 this.dataModel = new ArrayDataModel([null]); | 458 this.dataModel = new ArrayDataModel([null]); |
| 457 } else { | 459 } else { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 561 } |
| 560 }; | 562 }; |
| 561 | 563 |
| 562 return { | 564 return { |
| 563 ExceptionsListItem: ExceptionsListItem, | 565 ExceptionsListItem: ExceptionsListItem, |
| 564 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 566 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
| 565 ExceptionsList: ExceptionsList, | 567 ExceptionsList: ExceptionsList, |
| 566 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 568 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
| 567 }; | 569 }; |
| 568 }); | 570 }); |
| OLD | NEW |