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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 * @private | 48 * @private |
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 /** | 54 /** |
55 * Handle changes to the associated pref by hiding any currently visible | 55 * Handle changes to the associated pref by hiding any currently visible |
56 * bubble and updating the controlledBy property. | 56 * bubble and updating the controlledBy property. |
57 * @param {Event} event Pref change event. | 57 * @param {Event} event Pref change event. |
| 58 * @suppress {checkTypes} |
| 59 * TODO(vitalyp): remove the suppression. |controlledBy| property is defined |
| 60 * by cr.defineProperty(). Currently null can't be assigned to such |
| 61 * properties due to implementation of ChromePass.java. See this discussion |
| 62 * to change nulls to empty string below: |
| 63 * https://chromiumcodereview.appspot.com/11066015/ |
58 */ | 64 */ |
59 handlePrefChange: function(event) { | 65 handlePrefChange: function(event) { |
60 PageManager.hideBubble(); | 66 PageManager.hideBubble(); |
61 if (event.value.controlledBy) { | 67 if (event.value.controlledBy) { |
62 if (!this.value || String(event.value.value) == this.value) { | 68 if (!this.value || String(event.value.value) == this.value) { |
63 this.controlledBy = event.value.controlledBy; | 69 this.controlledBy = event.value.controlledBy; |
64 if (event.value.extension) { | 70 if (event.value.extension) { |
65 this.extensionId = event.value.extension.id; | 71 this.extensionId = event.value.extension.id; |
66 this.extensionIcon = event.value.extension.icon; | 72 this.extensionIcon = event.value.extension.icon; |
67 this.extensionName = event.value.extension.name; | 73 this.extensionName = event.value.extension.name; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 * - unset: The value is controlled by the user alone. | 232 * - unset: The value is controlled by the user alone. |
227 */ | 233 */ |
228 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', | 234 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', |
229 cr.PropertyKind.ATTR); | 235 cr.PropertyKind.ATTR); |
230 | 236 |
231 // Export. | 237 // Export. |
232 return { | 238 return { |
233 ControlledSettingIndicator: ControlledSettingIndicator | 239 ControlledSettingIndicator: ControlledSettingIndicator |
234 }; | 240 }; |
235 }); | 241 }); |
OLD | NEW |