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 13 matching lines...) Expand all Loading... |
24 var self = this; | 24 var self = this; |
25 | 25 |
26 // If there is a pref, track its controlledBy and recommendedValue | 26 // If there is a pref, track its controlledBy and recommendedValue |
27 // properties in order to be able to bring up the correct bubble. | 27 // properties in order to be able to bring up the correct bubble. |
28 if (this.pref) { | 28 if (this.pref) { |
29 Preferences.getInstance().addEventListener( | 29 Preferences.getInstance().addEventListener( |
30 this.pref, this.handlePrefChange.bind(this)); | 30 this.pref, this.handlePrefChange.bind(this)); |
31 this.resetHandler = this.clearAssociatedPref_; | 31 this.resetHandler = this.clearAssociatedPref_; |
32 } | 32 } |
33 | 33 |
| 34 this.className = 'controlled-setting-indicator'; |
34 this.tabIndex = 0; | 35 this.tabIndex = 0; |
35 this.setAttribute('role', 'button'); | 36 this.setAttribute('role', 'button'); |
36 this.addEventListener('click', this); | 37 this.addEventListener('click', this); |
37 this.addEventListener('keydown', this); | 38 this.addEventListener('keydown', this); |
38 this.addEventListener('mousedown', this); | 39 this.addEventListener('mousedown', this); |
39 }, | 40 }, |
40 | 41 |
41 /** | 42 /** |
42 * The given handler will be called when the user clicks on the 'reset to | 43 * The given handler will be called when the user clicks on the 'reset to |
43 * recommended value' link shown in the indicator bubble. The |this| object | 44 * recommended value' link shown in the indicator bubble. The |this| object |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 * @type {string} | 222 * @type {string} |
222 */ | 223 */ |
223 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', | 224 cr.defineProperty(ControlledSettingIndicator, 'controlledBy', |
224 cr.PropertyKind.ATTR); | 225 cr.PropertyKind.ATTR); |
225 | 226 |
226 // Export. | 227 // Export. |
227 return { | 228 return { |
228 ControlledSettingIndicator: ControlledSettingIndicator | 229 ControlledSettingIndicator: ControlledSettingIndicator |
229 }; | 230 }; |
230 }); | 231 }); |
OLD | NEW |