Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 InlineEditableItemList = options.InlineEditableItemList; | 6 const InlineEditableItemList = options.InlineEditableItemList; |
| 7 const InlineEditableItem = options.InlineEditableItem; | 7 const InlineEditableItem = options.InlineEditableItem; |
| 8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 select.appendChild(optionAsk); | 75 select.appendChild(optionAsk); |
| 76 } | 76 } |
| 77 | 77 |
| 78 if (this.contentType == 'cookies') { | 78 if (this.contentType == 'cookies') { |
| 79 var optionSession = cr.doc.createElement('option'); | 79 var optionSession = cr.doc.createElement('option'); |
| 80 optionSession.textContent = templateData.sessionException; | 80 optionSession.textContent = templateData.sessionException; |
| 81 optionSession.value = 'session'; | 81 optionSession.value = 'session'; |
| 82 select.appendChild(optionSession); | 82 select.appendChild(optionSession); |
| 83 } | 83 } |
| 84 | 84 |
| 85 var optionBlock = cr.doc.createElement('option'); | 85 if (this.contentType != 'fullscreen') { |
| 86 optionBlock.textContent = templateData.blockException; | 86 var optionBlock = cr.doc.createElement('option'); |
| 87 optionBlock.value = 'block'; | 87 optionBlock.textContent = templateData.blockException; |
| 88 select.appendChild(optionBlock); | 88 optionBlock.value = 'block'; |
| 89 select.appendChild(optionBlock); | |
| 90 } | |
| 89 | 91 |
| 90 this.contentElement.appendChild(select); | 92 this.contentElement.appendChild(select); |
| 91 select.className = 'exception-setting'; | 93 select.className = 'exception-setting'; |
| 92 if (this.pattern) | 94 if (this.pattern) |
| 93 select.setAttribute('displaymode', 'edit'); | 95 select.setAttribute('displaymode', 'edit'); |
| 94 | 96 |
| 95 // Used to track whether the URL pattern in the input is valid. | 97 // Used to track whether the URL pattern in the input is valid. |
| 96 // This will be true if the browser process has informed us that the | 98 // This will be true if the browser process has informed us that the |
| 97 // current text in the input is valid. Changing the text resets this to | 99 // current text in the input is valid. Changing the text resets this to |
| 98 // false, and getting a response from the browser sets it back to true. | 100 // false, and getting a response from the browser sets it back to true. |
| 99 // It starts off as false for empty string (new exceptions) or true for | 101 // It starts off as false for empty string (new exceptions) or true for |
| 100 // already-existing exceptions (which we assume are valid). | 102 // already-existing exceptions (which we assume are valid). |
| 101 this.inputValidityKnown = this.pattern; | 103 this.inputValidityKnown = this.pattern; |
| 102 // 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 |
| 103 // 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 |
| 104 // empty input. | 106 // empty input. |
| 105 this.inputIsValid = true; | 107 this.inputIsValid = true; |
| 106 | 108 |
| 107 this.input = input; | 109 this.input = input; |
| 108 this.select = select; | 110 this.select = select; |
| 109 | 111 |
| 110 this.updateEditables(); | 112 this.updateEditables(); |
| 111 | 113 |
| 112 // Editing notifications and geolocation is disabled for now. | 114 // Editing notifications and geolocation is disabled for now. |
|
Evan Stade
2011/11/17 23:41:12
also disable editing imo
koz (OOO until 15th September)
2011/11/17 23:53:42
Cool, done. I didn't know about that.
| |
| 113 if (this.contentType == 'notifications' || | 115 if (this.contentType == 'notifications' || |
| 114 this.contentType == 'location') { | 116 this.contentType == 'location') { |
| 115 this.editable = false; | 117 this.editable = false; |
| 116 } | 118 } |
| 117 | 119 |
| 118 // If the source of the content setting exception is not the user | 120 // If the source of the content setting exception is not the user |
| 119 // preference, then the content settings exception is managed and the user | 121 // preference, then the content settings exception is managed and the user |
| 120 // can't edit it. | 122 // can't edit it. |
| 121 if (this.dataItem.source && | 123 if (this.dataItem.source && |
| 122 this.dataItem.source != 'preference') { | 124 this.dataItem.source != 'preference') { |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 540 } | 542 } |
| 541 }; | 543 }; |
| 542 | 544 |
| 543 return { | 545 return { |
| 544 ExceptionsListItem: ExceptionsListItem, | 546 ExceptionsListItem: ExceptionsListItem, |
| 545 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 547 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
| 546 ExceptionsList: ExceptionsList, | 548 ExceptionsList: ExceptionsList, |
| 547 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 549 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
| 548 }; | 550 }; |
| 549 }); | 551 }); |
| OLD | NEW |