| 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 /** @const */ var Preferences = options.Preferences; | 6 /** @const */ 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 this.extensionId = event.value.extension.id; | 70 this.extensionId = event.value.extension.id; |
| 71 this.extensionIcon = event.value.extension.icon; | 71 this.extensionIcon = event.value.extension.icon; |
| 72 this.extensionName = event.value.extension.name; | 72 this.extensionName = event.value.extension.name; |
| 73 } | 73 } |
| 74 } else { | 74 } else { |
| 75 this.controlledBy = null; | 75 this.controlledBy = null; |
| 76 } | 76 } |
| 77 } else if (event.value.recommendedValue != undefined) { | 77 } else if (event.value.recommendedValue != undefined) { |
| 78 this.controlledBy = | 78 this.controlledBy = |
| 79 !this.value || String(event.value.recommendedValue) == this.value ? | 79 !this.value || String(event.value.recommendedValue) == this.value ? |
| 80 'hasRecommendation' : null; | 80 'hasRecommendation' : |
| 81 null; |
| 81 } else { | 82 } else { |
| 82 this.controlledBy = null; | 83 this.controlledBy = null; |
| 83 } | 84 } |
| 84 }, | 85 }, |
| 85 | 86 |
| 86 /** | 87 /** |
| 87 * Uses the page's PageManager to display an informational bubble. | 88 * Uses the page's PageManager to display an informational bubble. |
| 88 * @override | 89 * @override |
| 89 */ | 90 */ |
| 90 showBubble: function(content) { | 91 showBubble: function(content) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 uber.invokeMethodOnWindow( | 179 uber.invokeMethodOnWindow( |
| 179 window.top, 'showPage', | 180 window.top, 'showPage', |
| 180 {pageId: 'extensions', path: '?id=' + extensionId}); | 181 {pageId: 'extensions', path: '?id=' + extensionId}); |
| 181 } else { | 182 } else { |
| 182 window.open('chrome://extensions/?id=' + extensionId); | 183 window.open('chrome://extensions/?id=' + extensionId); |
| 183 } | 184 } |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 var disableButton = extensionContainer.querySelector( | 187 var disableButton = extensionContainer.querySelector( |
| 187 '.controlled-setting-bubble-extension-disable-button'); | 188 '.controlled-setting-bubble-extension-disable-button'); |
| 188 disableButton.onclick = | 189 disableButton.onclick = function() { |
| 189 function() { chrome.send('disableExtension', [extensionId]); }; | 190 chrome.send('disableExtension', [extensionId]); |
| 191 }; |
| 190 content.appendChild(extensionContainer); | 192 content.appendChild(extensionContainer); |
| 191 } | 193 } |
| 192 return content; | 194 return content; |
| 193 }, | 195 }, |
| 194 }; | 196 }; |
| 195 | 197 |
| 196 /** | 198 /** |
| 197 * The name of the associated preference. | 199 * The name of the associated preference. |
| 198 */ | 200 */ |
| 199 cr.defineProperty(ControlledSettingIndicator, 'pref', cr.PropertyKind.ATTR); | 201 cr.defineProperty(ControlledSettingIndicator, 'pref', cr.PropertyKind.ATTR); |
| 200 | 202 |
| 201 /** | 203 /** |
| 202 * Whether this indicator is part of a dialog. If so, changes made to the | 204 * Whether this indicator is part of a dialog. If so, changes made to the |
| 203 * associated preference take effect in the settings UI immediately but are | 205 * associated preference take effect in the settings UI immediately but are |
| 204 * only actually committed when the user confirms the dialog. If the user | 206 * only actually committed when the user confirms the dialog. If the user |
| 205 * cancels the dialog instead, the changes are rolled back in the settings UI | 207 * cancels the dialog instead, the changes are rolled back in the settings UI |
| 206 * and never committed. | 208 * and never committed. |
| 207 */ | 209 */ |
| 208 cr.defineProperty(ControlledSettingIndicator, 'dialogPref', | 210 cr.defineProperty( |
| 209 cr.PropertyKind.BOOL_ATTR); | 211 ControlledSettingIndicator, 'dialogPref', cr.PropertyKind.BOOL_ATTR); |
| 210 | 212 |
| 211 /** | 213 /** |
| 212 * The value of the associated preference that the indicator represents. If | 214 * The value of the associated preference that the indicator represents. If |
| 213 * this is not set, the indicator will be visible whenever any value is | 215 * this is not set, the indicator will be visible whenever any value is |
| 214 * enforced or recommended. If it is set, the indicator will be visible only | 216 * enforced or recommended. If it is set, the indicator will be visible only |
| 215 * when the enforced or recommended value matches the value it represents. | 217 * when the enforced or recommended value matches the value it represents. |
| 216 * This allows multiple indicators to be created for a set of radio buttons, | 218 * This allows multiple indicators to be created for a set of radio buttons, |
| 217 * ensuring that only one of them is visible at a time. | 219 * ensuring that only one of them is visible at a time. |
| 218 */ | 220 */ |
| 219 cr.defineProperty(ControlledSettingIndicator, 'value', | 221 cr.defineProperty(ControlledSettingIndicator, 'value', cr.PropertyKind.ATTR); |
| 220 cr.PropertyKind.ATTR); | |
| 221 | 222 |
| 222 // Export. | 223 // Export. |
| 223 return { | 224 return {ControlledSettingIndicator: ControlledSettingIndicator}; |
| 224 ControlledSettingIndicator: ControlledSettingIndicator | |
| 225 }; | |
| 226 }); | 225 }); |
| OLD | NEW |