| 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', function() { | 5 cr.define('options', function() { |
| 6 var Preferences = options.Preferences; | 6 var Preferences = options.Preferences; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * A controlled setting indicator that can be placed on a setting as an | 9 * A controlled setting indicator that can be placed on a setting as an |
| 10 * indicator that the value is controlled by some external entity such as | 10 * indicator that the value is controlled by some external entity such as |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 */ | 49 */ |
| 50 clearAssociatedPref_: function() { | 50 clearAssociatedPref_: function() { |
| 51 Preferences.clearPref(this.pref, !this.dialogPref); | 51 Preferences.clearPref(this.pref, !this.dialogPref); |
| 52 }, | 52 }, |
| 53 | 53 |
| 54 /* Handle changes to the associated pref by hiding any currently visible | 54 /* Handle changes to the associated pref by hiding any currently visible |
| 55 * bubble and updating the controlledBy property. | 55 * bubble and updating the controlledBy property. |
| 56 * @param {Event} event Pref change event. | 56 * @param {Event} event Pref change event. |
| 57 */ | 57 */ |
| 58 handlePrefChange: function(event) { | 58 handlePrefChange: function(event) { |
| 59 OptionsPage.hideBubble(); | 59 PageManager.hideBubble(); |
| 60 if (event.value.controlledBy) { | 60 if (event.value.controlledBy) { |
| 61 if (!this.value || String(event.value.value) == this.value) { | 61 if (!this.value || String(event.value.value) == this.value) { |
| 62 this.controlledBy = event.value.controlledBy; | 62 this.controlledBy = event.value.controlledBy; |
| 63 if (event.value.extension) { | 63 if (event.value.extension) { |
| 64 this.extensionId = event.value.extension.id; | 64 this.extensionId = event.value.extension.id; |
| 65 this.extensionIcon = event.value.extension.icon; | 65 this.extensionIcon = event.value.extension.icon; |
| 66 this.extensionName = event.value.extension.name; | 66 this.extensionName = event.value.extension.name; |
| 67 } | 67 } |
| 68 } else { | 68 } else { |
| 69 this.controlledBy = null; | 69 this.controlledBy = null; |
| 70 } | 70 } |
| 71 } else if (event.value.recommendedValue != undefined) { | 71 } else if (event.value.recommendedValue != undefined) { |
| 72 this.controlledBy = | 72 this.controlledBy = |
| 73 !this.value || String(event.value.recommendedValue) == this.value ? | 73 !this.value || String(event.value.recommendedValue) == this.value ? |
| 74 'hasRecommendation' : null; | 74 'hasRecommendation' : null; |
| 75 } else { | 75 } else { |
| 76 this.controlledBy = null; | 76 this.controlledBy = null; |
| 77 } | 77 } |
| 78 }, | 78 }, |
| 79 | 79 |
| 80 /** | 80 /** |
| 81 * Open or close a bubble with further information about the pref. | 81 * Open or close a bubble with further information about the pref. |
| 82 * @private | 82 * @private |
| 83 */ | 83 */ |
| 84 toggleBubble_: function() { | 84 toggleBubble_: function() { |
| 85 if (this.showingBubble) { | 85 if (this.showingBubble) { |
| 86 OptionsPage.hideBubble(); | 86 PageManager.hideBubble(); |
| 87 } else { | 87 } else { |
| 88 var self = this; | 88 var self = this; |
| 89 | 89 |
| 90 // Construct the bubble text. | 90 // Construct the bubble text. |
| 91 if (this.hasAttribute('plural')) { | 91 if (this.hasAttribute('plural')) { |
| 92 var defaultStrings = { | 92 var defaultStrings = { |
| 93 'policy': loadTimeData.getString('controlledSettingsPolicy'), | 93 'policy': loadTimeData.getString('controlledSettingsPolicy'), |
| 94 'extension': loadTimeData.getString('controlledSettingsExtension'), | 94 'extension': loadTimeData.getString('controlledSettingsExtension'), |
| 95 'extensionWithName': loadTimeData.getString( | 95 'extensionWithName': loadTimeData.getString( |
| 96 'controlledSettingsExtensionWithName'), | 96 'controlledSettingsExtensionWithName'), |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 }; | 172 }; |
| 173 | 173 |
| 174 var disableButton = extensionContainer.querySelector( | 174 var disableButton = extensionContainer.querySelector( |
| 175 '.controlled-setting-bubble-extension-disable-button'); | 175 '.controlled-setting-bubble-extension-disable-button'); |
| 176 disableButton.onclick = function() { | 176 disableButton.onclick = function() { |
| 177 chrome.send('disableExtension', [extensionId]); | 177 chrome.send('disableExtension', [extensionId]); |
| 178 }; | 178 }; |
| 179 content.appendChild(extensionContainer); | 179 content.appendChild(extensionContainer); |
| 180 } | 180 } |
| 181 | 181 |
| 182 OptionsPage.showBubble(content, this.image, this, this.location); | 182 PageManager.showBubble(content, this.image, this, this.location); |
| 183 } | 183 } |
| 184 }, | 184 }, |
| 185 }; | 185 }; |
| 186 | 186 |
| 187 /** | 187 /** |
| 188 * The name of the associated preference. | 188 * The name of the associated preference. |
| 189 * @type {string} | 189 * @type {string} |
| 190 */ | 190 */ |
| 191 cr.defineProperty(ControlledSettingIndicator, 'pref', cr.PropertyKind.ATTR); | 191 cr.defineProperty(ControlledSettingIndicator, 'pref', cr.PropertyKind.ATTR); |
| 192 | 192 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 * @type {string} | 228 * @type {string} |
| 229 */ | 229 */ |
| 230 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', | 230 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', |
| 231 cr.PropertyKind.ATTR); | 231 cr.PropertyKind.ATTR); |
| 232 | 232 |
| 233 // Export. | 233 // Export. |
| 234 return { | 234 return { |
| 235 ControlledSettingIndicator: ControlledSettingIndicator | 235 ControlledSettingIndicator: ControlledSettingIndicator |
| 236 }; | 236 }; |
| 237 }); | 237 }); |
| OLD | NEW |