OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 DeletableItemList = options.DeletableItemList; | 6 const DeletableItemList = options.DeletableItemList; |
7 const DeletableItem = options.DeletableItem; | 7 const DeletableItem = options.DeletableItem; |
8 const ArrayDataModel = cr.ui.ArrayDataModel; | 8 const ArrayDataModel = cr.ui.ArrayDataModel; |
9 | 9 |
10 /** | 10 /** |
(...skipping 26 matching lines...) Expand all Loading... |
37 * Called when an element is decorated as a list item. | 37 * Called when an element is decorated as a list item. |
38 */ | 38 */ |
39 decorate: function() { | 39 decorate: function() { |
40 DeletableItem.prototype.decorate.call(this); | 40 DeletableItem.prototype.decorate.call(this); |
41 | 41 |
42 // Labels for display mode. |pattern| will be null for the 'add new | 42 // Labels for display mode. |pattern| will be null for the 'add new |
43 // exception' row. | 43 // exception' row. |
44 if (this.pattern) { | 44 if (this.pattern) { |
45 var patternLabel = cr.doc.createElement('span'); | 45 var patternLabel = cr.doc.createElement('span'); |
46 patternLabel.textContent = this.pattern; | 46 patternLabel.textContent = this.pattern; |
47 patternLabel.className = 'exceptionPattern'; | 47 patternLabel.className = 'exception-pattern'; |
48 this.contentElement.appendChild(patternLabel); | 48 this.contentElement.appendChild(patternLabel); |
49 this.patternLabel = patternLabel; | 49 this.patternLabel = patternLabel; |
50 | 50 |
51 var settingLabel = cr.doc.createElement('span'); | 51 var settingLabel = cr.doc.createElement('span'); |
52 settingLabel.textContent = this.settingForDisplay(); | 52 settingLabel.textContent = this.settingForDisplay(); |
53 settingLabel.className = 'exceptionSetting'; | 53 settingLabel.className = 'exception-setting'; |
54 this.contentElement.appendChild(settingLabel); | 54 this.contentElement.appendChild(settingLabel); |
55 this.settingLabel = settingLabel; | 55 this.settingLabel = settingLabel; |
56 } | 56 } |
57 | 57 |
58 // Elements for edit mode. | 58 // Elements for edit mode. |
59 var input = cr.doc.createElement('input'); | 59 var input = cr.doc.createElement('input'); |
60 input.type = 'text'; | 60 input.type = 'text'; |
61 this.contentElement.appendChild(input); | 61 this.contentElement.appendChild(input); |
62 input.className = 'exceptionPattern hidden'; | 62 input.className = 'exception-pattern hidden'; |
63 | 63 |
64 var select = cr.doc.createElement('select'); | 64 var select = cr.doc.createElement('select'); |
65 var optionAllow = cr.doc.createElement('option'); | 65 var optionAllow = cr.doc.createElement('option'); |
66 optionAllow.textContent = templateData.allowException; | 66 optionAllow.textContent = templateData.allowException; |
67 select.appendChild(optionAllow); | 67 select.appendChild(optionAllow); |
68 | 68 |
69 if (this.enableAskOption) { | 69 if (this.enableAskOption) { |
70 var optionAsk = cr.doc.createElement('option'); | 70 var optionAsk = cr.doc.createElement('option'); |
71 optionAsk.textContent = templateData.askException; | 71 optionAsk.textContent = templateData.askException; |
72 select.appendChild(optionAsk); | 72 select.appendChild(optionAsk); |
73 this.optionAsk = optionAsk; | 73 this.optionAsk = optionAsk; |
74 } | 74 } |
75 | 75 |
76 if (this.contentType == 'cookies') { | 76 if (this.contentType == 'cookies') { |
77 var optionSession = cr.doc.createElement('option'); | 77 var optionSession = cr.doc.createElement('option'); |
78 optionSession.textContent = templateData.sessionException; | 78 optionSession.textContent = templateData.sessionException; |
79 select.appendChild(optionSession); | 79 select.appendChild(optionSession); |
80 this.optionSession = optionSession; | 80 this.optionSession = optionSession; |
81 } | 81 } |
82 | 82 |
83 var optionBlock = cr.doc.createElement('option'); | 83 var optionBlock = cr.doc.createElement('option'); |
84 optionBlock.textContent = templateData.blockException; | 84 optionBlock.textContent = templateData.blockException; |
85 select.appendChild(optionBlock); | 85 select.appendChild(optionBlock); |
86 | 86 |
87 this.contentElement.appendChild(select); | 87 this.contentElement.appendChild(select); |
88 select.className = 'exceptionSetting hidden'; | 88 select.className = 'exception-setting hidden'; |
89 | 89 |
90 // Used to track whether the URL pattern in the input is valid. | 90 // Used to track whether the URL pattern in the input is valid. |
91 // This will be true if the browser process has informed us that the | 91 // This will be true if the browser process has informed us that the |
92 // current text in the input is valid. Changing the text resets this to | 92 // current text in the input is valid. Changing the text resets this to |
93 // false, and getting a response from the browser sets it back to true. | 93 // false, and getting a response from the browser sets it back to true. |
94 // It starts off as false for empty string (new exceptions) or true for | 94 // It starts off as false for empty string (new exceptions) or true for |
95 // already-existing exceptions (which we assume are valid). | 95 // already-existing exceptions (which we assume are valid). |
96 this.inputValidityKnown = this.pattern; | 96 this.inputValidityKnown = this.pattern; |
97 // This one tracks the actual validity of the pattern in the input. This | 97 // This one tracks the actual validity of the pattern in the input. This |
98 // starts off as true so as not to annoy the user when he adds a new and | 98 // starts off as true so as not to annoy the user when he adds a new and |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 }; | 540 }; |
541 | 541 |
542 var OptionsPage = options.OptionsPage; | 542 var OptionsPage = options.OptionsPage; |
543 | 543 |
544 /** | 544 /** |
545 * Encapsulated handling of content settings list subpage. | 545 * Encapsulated handling of content settings list subpage. |
546 * @constructor | 546 * @constructor |
547 */ | 547 */ |
548 function ContentSettingsExceptionsArea() { | 548 function ContentSettingsExceptionsArea() { |
549 OptionsPage.call(this, 'contentExceptions', | 549 OptionsPage.call(this, 'contentExceptions', |
550 '', 'contentSettingsExceptionsArea'); | 550 '', 'content-settings-exceptions-area'); |
551 } | 551 } |
552 | 552 |
553 cr.addSingletonGetter(ContentSettingsExceptionsArea); | 553 cr.addSingletonGetter(ContentSettingsExceptionsArea); |
554 | 554 |
555 ContentSettingsExceptionsArea.prototype = { | 555 ContentSettingsExceptionsArea.prototype = { |
556 __proto__: OptionsPage.prototype, | 556 __proto__: OptionsPage.prototype, |
557 | 557 |
558 initializePage: function() { | 558 initializePage: function() { |
559 OptionsPage.prototype.initializePage.call(this); | 559 OptionsPage.prototype.initializePage.call(this); |
560 | 560 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 } | 603 } |
604 }; | 604 }; |
605 | 605 |
606 return { | 606 return { |
607 ExceptionsListItem: ExceptionsListItem, | 607 ExceptionsListItem: ExceptionsListItem, |
608 ExceptionsAddRowListItem: ExceptionsAddRowListItem, | 608 ExceptionsAddRowListItem: ExceptionsAddRowListItem, |
609 ExceptionsList: ExceptionsList, | 609 ExceptionsList: ExceptionsList, |
610 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, | 610 ContentSettingsExceptionsArea: ContentSettingsExceptionsArea, |
611 }; | 611 }; |
612 }); | 612 }); |
OLD | NEW |