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 | |
7 var Preferences = options.Preferences; | 6 var Preferences = options.Preferences; |
8 | 7 |
9 /** | 8 /** |
10 * Allows an element to be disabled for several reasons. | 9 * Allows an element to be disabled for several reasons. |
11 * The element is disabled if at least one reason is true, and the reasons | 10 * The element is disabled if at least one reason is true, and the reasons |
12 * can be set separately. | 11 * can be set separately. |
13 * @private | 12 * @private |
14 * @param {!HTMLElement} el The element to update. | 13 * @param {!HTMLElement} el The element to update. |
15 * @param {string} reason The reason for disabling the element. | 14 * @param {string} reason The reason for disabling the element. |
16 * @param {boolean} disabled Whether the element should be disabled or enabled | 15 * @param {boolean} disabled Whether the element should be disabled or enabled |
17 * for the given |reason|. | 16 * for the given |reason|. |
18 */ | 17 */ |
19 function updateDisabledState_(el, reason, disabled) { | 18 function updateDisabledState(el, reason, disabled) { |
20 if (!el.disabledReasons) | 19 if (!el.disabledReasons) |
21 el.disabledReasons = {}; | 20 el.disabledReasons = {}; |
22 if (el.disabled && (Object.keys(el.disabledReasons).length == 0)) { | 21 if (el.disabled && (Object.keys(el.disabledReasons).length == 0)) { |
23 // The element has been previously disabled without a reason, so we add | 22 // The element has been previously disabled without a reason, so we add |
24 // one to keep it disabled. | 23 // one to keep it disabled. |
25 el.disabledReasons.other = true; | 24 el.disabledReasons.other = true; |
26 } | 25 } |
27 if (!el.disabled) { | 26 if (!el.disabled) { |
28 // If the element is not disabled, there should be no reason, except for | 27 // If the element is not disabled, there should be no reason, except for |
29 // 'other'. | 28 // 'other'. |
(...skipping 23 matching lines...) Expand all Loading... |
53 // Set up the prototype chain | 52 // Set up the prototype chain |
54 __proto__: HTMLInputElement.prototype, | 53 __proto__: HTMLInputElement.prototype, |
55 | 54 |
56 /** | 55 /** |
57 * Initialization function for the cr.ui framework. | 56 * Initialization function for the cr.ui framework. |
58 */ | 57 */ |
59 decorate: function() { | 58 decorate: function() { |
60 var self = this; | 59 var self = this; |
61 | 60 |
62 // Listen for user events. | 61 // Listen for user events. |
63 this.addEventListener('change', this.handleChange_.bind(this)); | 62 this.addEventListener('change', this.handleChange.bind(this)); |
64 | 63 |
65 // Listen for pref changes. | 64 // Listen for pref changes. |
66 Preferences.getInstance().addEventListener(this.pref, function(event) { | 65 Preferences.getInstance().addEventListener(this.pref, function(event) { |
67 if (event.value.uncommitted && !self.dialogPref) | 66 if (event.value.uncommitted && !self.dialogPref) |
68 return; | 67 return; |
69 self.updateStateFromPref_(event); | 68 self.updateStateFromPref(event); |
70 updateDisabledState_(self, 'notUserModifiable', event.value.disabled); | 69 updateDisabledState(self, 'notUserModifiable', event.value.disabled); |
71 self.controlledBy = event.value.controlledBy; | 70 self.controlledBy = event.value.controlledBy; |
72 }); | 71 }); |
73 }, | 72 }, |
74 | 73 |
75 /** | 74 /** |
76 * Handle changes to the input element's state made by the user. If a custom | 75 * Handle changes to the input element's state made by the user. If a custom |
77 * change handler does not suppress it, a default handler is invoked that | 76 * change handler does not suppress it, a default handler is invoked that |
78 * updates the associated pref. | 77 * updates the associated pref. |
79 * @param {Event} event Change event. | 78 * @param {Event} event Change event. |
80 * @private | 79 * @protected |
81 */ | 80 */ |
82 handleChange_: function(event) { | 81 handleChange: function(event) { |
83 if (!this.customChangeHandler(event)) | 82 if (!this.customChangeHandler(event)) |
84 this.updatePrefFromState_(); | 83 this.updatePrefFromState(); |
85 }, | 84 }, |
86 | 85 |
87 /** | 86 /** |
88 * Handles changes to the pref. If a custom change handler does not suppress | 87 * Handles changes to the pref. If a custom change handler does not suppress |
89 * it, a default handler is invoked that update the input element's state. | 88 * it, a default handler is invoked that updates the input element's state. |
90 * @param {Event} event Pref change event. | 89 * @param {Event} event Pref change event. |
91 * @private | 90 * @protected |
92 */ | 91 */ |
93 updateStateFromPref_: function(event) { | 92 updateStateFromPref: function(event) { |
94 if (!this.customPrefChangeHandler(event)) | 93 if (!this.customPrefChangeHandler(event)) |
95 this.value = event.value.value; | 94 this.value = event.value.value; |
96 }, | 95 }, |
97 | 96 |
98 /** | 97 /** |
99 * See |updateDisabledState_| above. | 98 * See |updateDisabledState| above. |
100 */ | 99 */ |
101 setDisabled: function(reason, disabled) { | 100 setDisabled: function(reason, disabled) { |
102 updateDisabledState_(this, reason, disabled); | 101 updateDisabledState(this, reason, disabled); |
103 }, | 102 }, |
104 | 103 |
105 /** | 104 /** |
106 * Custom change handler that is invoked first when the user makes changes | 105 * Custom change handler that is invoked first when the user makes changes |
107 * to the input element's state. If it returns false, a default handler is | 106 * to the input element's state. If it returns false, a default handler is |
108 * invoked next that updates the associated pref. If it returns true, the | 107 * invoked next that updates the associated pref. If it returns true, the |
109 * default handler is suppressed (i.e., this works like stopPropagation or | 108 * default handler is suppressed (i.e., this works like stopPropagation or |
110 * cancelBubble). | 109 * cancelBubble). |
111 * @param {Event} event Input element change event. | 110 * @param {Event} event Input element change event. |
112 */ | 111 */ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 /** | 172 /** |
174 * Initialization function for the cr.ui framework. | 173 * Initialization function for the cr.ui framework. |
175 */ | 174 */ |
176 decorate: function() { | 175 decorate: function() { |
177 PrefInputElement.prototype.decorate.call(this); | 176 PrefInputElement.prototype.decorate.call(this); |
178 this.type = 'checkbox'; | 177 this.type = 'checkbox'; |
179 | 178 |
180 // Consider a checked dialog checkbox as a 'suggestion' which is committed | 179 // Consider a checked dialog checkbox as a 'suggestion' which is committed |
181 // once the user confirms the dialog. | 180 // once the user confirms the dialog. |
182 if (this.dialogPref && this.checked) | 181 if (this.dialogPref && this.checked) |
183 this.updatePrefFromState_(); | 182 this.updatePrefFromState(); |
184 }, | 183 }, |
185 | 184 |
186 /** | 185 /** |
187 * Update the associated pref when when the user makes changes to the | 186 * Update the associated pref when when the user makes changes to the |
188 * checkbox state. | 187 * checkbox state. |
189 * @private | 188 * @override |
190 */ | 189 */ |
191 updatePrefFromState_: function() { | 190 updatePrefFromState: function() { |
192 var value = this.inverted_pref ? !this.checked : this.checked; | 191 var value = this.inverted_pref ? !this.checked : this.checked; |
193 Preferences.setBooleanPref(this.pref, value, | 192 Preferences.setBooleanPref(this.pref, value, |
194 !this.dialogPref, this.metric); | 193 !this.dialogPref, this.metric); |
195 }, | 194 }, |
196 | 195 |
| 196 /** @override */ |
| 197 updateStateFromPref: function(event) { |
| 198 if (!this.customPrefChangeHandler(event)) |
| 199 this.defaultPrefChangeHandler(event); |
| 200 }, |
| 201 |
197 /** | 202 /** |
198 * Update the checkbox state when the associated pref changes. | 203 * @param {Event} event A pref change event. |
199 * @param {Event} event Pref change event. | |
200 * @private | |
201 */ | 204 */ |
202 updateStateFromPref_: function(event) { | 205 defaultPrefChangeHandler: function(event) { |
203 if (this.customPrefChangeHandler(event)) | |
204 return; | |
205 var value = Boolean(event.value.value); | 206 var value = Boolean(event.value.value); |
206 this.checked = this.inverted_pref ? !value : value; | 207 this.checked = this.inverted_pref ? !value : value; |
207 }, | 208 }, |
208 }; | 209 }; |
209 | 210 |
210 /** | 211 /** |
211 * Whether the mapping between checkbox state and associated pref is inverted. | 212 * Whether the mapping between checkbox state and associated pref is inverted. |
212 */ | 213 */ |
213 cr.defineProperty(PrefCheckbox, 'inverted_pref', cr.PropertyKind.BOOL_ATTR); | 214 cr.defineProperty(PrefCheckbox, 'inverted_pref', cr.PropertyKind.BOOL_ATTR); |
214 | 215 |
215 ///////////////////////////////////////////////////////////////////////////// | 216 ///////////////////////////////////////////////////////////////////////////// |
216 // PrefNumber class: | 217 // PrefNumber class: |
217 | 218 |
218 // Define a constructor that uses an input element as its underlying element. | 219 // Define a constructor that uses an input element as its underlying element. |
219 var PrefNumber = cr.ui.define('input'); | 220 var PrefNumber = cr.ui.define('input'); |
220 | 221 |
221 PrefNumber.prototype = { | 222 PrefNumber.prototype = { |
222 // Set up the prototype chain | 223 // Set up the prototype chain |
223 __proto__: PrefInputElement.prototype, | 224 __proto__: PrefInputElement.prototype, |
224 | 225 |
225 /** | 226 /** |
226 * Initialization function for the cr.ui framework. | 227 * Initialization function for the cr.ui framework. |
227 */ | 228 */ |
228 decorate: function() { | 229 decorate: function() { |
229 PrefInputElement.prototype.decorate.call(this); | 230 PrefInputElement.prototype.decorate.call(this); |
230 this.type = 'number'; | 231 this.type = 'number'; |
231 }, | 232 }, |
232 | 233 |
233 /** | 234 /** |
234 * Update the associated pref when when the user inputs a number. | 235 * Update the associated pref when the user inputs a number. |
235 * @private | 236 * @override |
236 */ | 237 */ |
237 updatePrefFromState_: function() { | 238 updatePrefFromState: function() { |
238 if (this.validity.valid) { | 239 if (this.validity.valid) { |
239 Preferences.setIntegerPref(this.pref, this.value, | 240 Preferences.setIntegerPref(this.pref, this.value, |
240 !this.dialogPref, this.metric); | 241 !this.dialogPref, this.metric); |
241 } | 242 } |
242 }, | 243 }, |
243 }; | 244 }; |
244 | 245 |
245 ///////////////////////////////////////////////////////////////////////////// | 246 ///////////////////////////////////////////////////////////////////////////// |
246 // PrefRadio class: | 247 // PrefRadio class: |
247 | 248 |
248 //Define a constructor that uses an input element as its underlying element. | 249 //Define a constructor that uses an input element as its underlying element. |
249 var PrefRadio = cr.ui.define('input'); | 250 var PrefRadio = cr.ui.define('input'); |
250 | 251 |
251 PrefRadio.prototype = { | 252 PrefRadio.prototype = { |
252 // Set up the prototype chain | 253 // Set up the prototype chain |
253 __proto__: PrefInputElement.prototype, | 254 __proto__: PrefInputElement.prototype, |
254 | 255 |
255 /** | 256 /** |
256 * Initialization function for the cr.ui framework. | 257 * Initialization function for the cr.ui framework. |
257 */ | 258 */ |
258 decorate: function() { | 259 decorate: function() { |
259 PrefInputElement.prototype.decorate.call(this); | 260 PrefInputElement.prototype.decorate.call(this); |
260 this.type = 'radio'; | 261 this.type = 'radio'; |
261 }, | 262 }, |
262 | 263 |
263 /** | 264 /** |
264 * Update the associated pref when when the user selects the radio button. | 265 * Update the associated pref when when the user selects the radio button. |
265 * @private | 266 * @override |
266 */ | 267 */ |
267 updatePrefFromState_: function() { | 268 updatePrefFromState: function() { |
268 if (this.value == 'true' || this.value == 'false') { | 269 if (this.value == 'true' || this.value == 'false') { |
269 Preferences.setBooleanPref(this.pref, | 270 Preferences.setBooleanPref(this.pref, |
270 this.value == String(this.checked), | 271 this.value == String(this.checked), |
271 !this.dialogPref, this.metric); | 272 !this.dialogPref, this.metric); |
272 } else { | 273 } else { |
273 Preferences.setIntegerPref(this.pref, this.value, | 274 Preferences.setIntegerPref(this.pref, this.value, |
274 !this.dialogPref, this.metric); | 275 !this.dialogPref, this.metric); |
275 } | 276 } |
276 }, | 277 }, |
277 | 278 |
278 /** | 279 /** @override */ |
279 * Update the radio button state when the associated pref changes. | 280 updateStateFromPref: function(event) { |
280 * @param {Event} event Pref change event. | |
281 * @private | |
282 */ | |
283 updateStateFromPref_: function(event) { | |
284 if (!this.customPrefChangeHandler(event)) | 281 if (!this.customPrefChangeHandler(event)) |
285 this.checked = this.value == String(event.value.value); | 282 this.checked = this.value == String(event.value.value); |
286 }, | 283 }, |
287 }; | 284 }; |
288 | 285 |
289 ///////////////////////////////////////////////////////////////////////////// | 286 ///////////////////////////////////////////////////////////////////////////// |
290 // PrefRange class: | 287 // PrefRange class: |
291 | 288 |
292 /** | 289 /** |
293 * Define a constructor that uses an input element as its underlying element. | 290 * Define a constructor that uses an input element as its underlying element. |
(...skipping 23 matching lines...) Expand all Loading... |
317 // fixed. | 314 // fixed. |
318 // https://bugs.webkit.org/show_bug.cgi?id=52256 | 315 // https://bugs.webkit.org/show_bug.cgi?id=52256 |
319 this.addEventListener('keyup', this.handleRelease_.bind(this)); | 316 this.addEventListener('keyup', this.handleRelease_.bind(this)); |
320 this.addEventListener('mouseup', this.handleRelease_.bind(this)); | 317 this.addEventListener('mouseup', this.handleRelease_.bind(this)); |
321 this.addEventListener('touchcancel', this.handleRelease_.bind(this)); | 318 this.addEventListener('touchcancel', this.handleRelease_.bind(this)); |
322 this.addEventListener('touchend', this.handleRelease_.bind(this)); | 319 this.addEventListener('touchend', this.handleRelease_.bind(this)); |
323 }, | 320 }, |
324 | 321 |
325 /** | 322 /** |
326 * Update the associated pref when when the user releases the slider. | 323 * Update the associated pref when when the user releases the slider. |
327 * @private | 324 * @override |
328 */ | 325 */ |
329 updatePrefFromState_: function() { | 326 updatePrefFromState: function() { |
330 Preferences.setIntegerPref( | 327 Preferences.setIntegerPref( |
331 this.pref, | 328 this.pref, |
332 this.mapPositionToPref(parseInt(this.value, 10)), | 329 this.mapPositionToPref(parseInt(this.value, 10)), |
333 !this.dialogPref, | 330 !this.dialogPref, |
334 this.metric); | 331 this.metric); |
335 }, | 332 }, |
336 | 333 |
337 /** | 334 /** @override */ |
338 * Ignore changes to the slider position made by the user while the slider | 335 handleChange: function() { |
339 * has not been released. | 336 // Ignore changes to the slider position made by the user while the slider |
340 * @private | 337 // has not been released. |
341 */ | |
342 handleChange_: function() { | |
343 }, | 338 }, |
344 | 339 |
345 /** | 340 /** |
346 * Handle changes to the slider position made by the user when the slider is | 341 * Handle changes to the slider position made by the user when the slider is |
347 * released. If a custom change handler does not suppress it, a default | 342 * released. If a custom change handler does not suppress it, a default |
348 * handler is invoked that updates the associated pref. | 343 * handler is invoked that updates the associated pref. |
349 * @param {Event} event Change event. | 344 * @param {Event} event Change event. |
350 * @private | 345 * @private |
351 */ | 346 */ |
352 handleRelease_: function(event) { | 347 handleRelease_: function(event) { |
353 if (!this.customChangeHandler(event)) | 348 if (!this.customChangeHandler(event)) |
354 this.updatePrefFromState_(); | 349 this.updatePrefFromState(); |
355 }, | 350 }, |
356 | 351 |
357 /** | 352 /** |
358 * Handles changes to the pref associated with the slider. If a custom | 353 * Handles changes to the pref associated with the slider. If a custom |
359 * change handler does not suppress it, a default handler is invoked that | 354 * change handler does not suppress it, a default handler is invoked that |
360 * updates the slider position. | 355 * updates the slider position. |
361 * @param {Event} event Pref change event. | 356 * @override. |
362 * @private | |
363 */ | 357 */ |
364 updateStateFromPref_: function(event) { | 358 updateStateFromPref: function(event) { |
365 if (this.customPrefChangeHandler(event)) | 359 if (this.customPrefChangeHandler(event)) |
366 return; | 360 return; |
367 var value = event.value.value; | 361 var value = event.value.value; |
368 this.value = this.valueMap ? this.valueMap.indexOf(value) : value; | 362 this.value = this.valueMap ? this.valueMap.indexOf(value) : value; |
369 }, | 363 }, |
370 | 364 |
371 /** | 365 /** |
372 * Map slider position to the range of values provided by the client, | 366 * Map slider position to the range of values provided by the client, |
373 * represented by |valueMap|. | 367 * represented by |valueMap|. |
374 * @param {number} position The slider position to map. | 368 * @param {number} position The slider position to map. |
375 */ | 369 */ |
376 mapPositionToPref: function(position) { | 370 mapPositionToPref: function(position) { |
377 return this.valueMap ? this.valueMap[position] : position; | 371 return this.valueMap ? this.valueMap[position] : position; |
378 }, | 372 }, |
379 }; | 373 }; |
380 | 374 |
381 ///////////////////////////////////////////////////////////////////////////// | 375 ///////////////////////////////////////////////////////////////////////////// |
382 // PrefSelect class: | 376 // PrefSelect class: |
383 | 377 |
384 // Define a constructor that uses a select element as its underlying element. | 378 // Define a constructor that uses a select element as its underlying element. |
385 var PrefSelect = cr.ui.define('select'); | 379 var PrefSelect = cr.ui.define('select'); |
386 | 380 |
387 PrefSelect.prototype = { | 381 PrefSelect.prototype = { |
388 // Set up the prototype chain | 382 // Set up the prototype chain |
389 __proto__: PrefInputElement.prototype, | 383 __proto__: PrefInputElement.prototype, |
390 | 384 |
391 /** | 385 /** |
392 * Update the associated pref when when the user selects an item. | 386 * Update the associated pref when when the user selects an item. |
393 * @private | 387 * @override |
394 */ | 388 */ |
395 updatePrefFromState_: function() { | 389 updatePrefFromState: function() { |
396 var value = this.options[this.selectedIndex].value; | 390 var value = this.options[this.selectedIndex].value; |
397 switch (this.dataType) { | 391 switch (this.dataType) { |
398 case 'number': | 392 case 'number': |
399 Preferences.setIntegerPref(this.pref, value, | 393 Preferences.setIntegerPref(this.pref, value, |
400 !this.dialogPref, this.metric); | 394 !this.dialogPref, this.metric); |
401 break; | 395 break; |
402 case 'double': | 396 case 'double': |
403 Preferences.setDoublePref(this.pref, value, | 397 Preferences.setDoublePref(this.pref, value, |
404 !this.dialogPref, this.metric); | 398 !this.dialogPref, this.metric); |
405 break; | 399 break; |
406 case 'boolean': | 400 case 'boolean': |
407 Preferences.setBooleanPref(this.pref, value == 'true', | 401 Preferences.setBooleanPref(this.pref, value == 'true', |
408 !this.dialogPref, this.metric); | 402 !this.dialogPref, this.metric); |
409 break; | 403 break; |
410 case 'string': | 404 case 'string': |
411 Preferences.setStringPref(this.pref, value, | 405 Preferences.setStringPref(this.pref, value, |
412 !this.dialogPref, this.metric); | 406 !this.dialogPref, this.metric); |
413 break; | 407 break; |
414 default: | 408 default: |
415 console.error('Unknown data type for <select> UI element: ' + | 409 console.error('Unknown data type for <select> UI element: ' + |
416 this.dataType); | 410 this.dataType); |
417 } | 411 } |
418 }, | 412 }, |
419 | 413 |
420 /** | 414 /** @override */ |
421 * Update the selected item when the associated pref changes. | 415 updateStateFromPref: function(event) { |
422 * @param {Event} event Pref change event. | |
423 * @private | |
424 */ | |
425 updateStateFromPref_: function(event) { | |
426 if (this.customPrefChangeHandler(event)) | 416 if (this.customPrefChangeHandler(event)) |
427 return; | 417 return; |
428 | 418 |
429 // Make sure the value is a string, because the value is stored as a | 419 // Make sure the value is a string, because the value is stored as a |
430 // string in the HTMLOptionElement. | 420 // string in the HTMLOptionElement. |
431 var value = String(event.value.value); | 421 var value = String(event.value.value); |
432 | 422 |
433 var found = false; | 423 var found = false; |
434 for (var i = 0; i < this.options.length; i++) { | 424 for (var i = 0; i < this.options.length; i++) { |
435 if (this.options[i].value == value) { | 425 if (this.options[i].value == value) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 460 |
471 // Listen for user events. | 461 // Listen for user events. |
472 window.addEventListener('unload', function() { | 462 window.addEventListener('unload', function() { |
473 if (document.activeElement == self) | 463 if (document.activeElement == self) |
474 self.blur(); | 464 self.blur(); |
475 }); | 465 }); |
476 }, | 466 }, |
477 | 467 |
478 /** | 468 /** |
479 * Update the associated pref when when the user inputs text. | 469 * Update the associated pref when when the user inputs text. |
480 * @private | 470 * @override |
481 */ | 471 */ |
482 updatePrefFromState_: function(event) { | 472 updatePrefFromState: function(event) { |
483 switch (this.dataType) { | 473 switch (this.dataType) { |
484 case 'number': | 474 case 'number': |
485 Preferences.setIntegerPref(this.pref, this.value, | 475 Preferences.setIntegerPref(this.pref, this.value, |
486 !this.dialogPref, this.metric); | 476 !this.dialogPref, this.metric); |
487 break; | 477 break; |
488 case 'double': | 478 case 'double': |
489 Preferences.setDoublePref(this.pref, this.value, | 479 Preferences.setDoublePref(this.pref, this.value, |
490 !this.dialogPref, this.metric); | 480 !this.dialogPref, this.metric); |
491 break; | 481 break; |
492 case 'url': | 482 case 'url': |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 decorate: function() { | 537 decorate: function() { |
548 var self = this; | 538 var self = this; |
549 | 539 |
550 // Listen for pref changes. | 540 // Listen for pref changes. |
551 // This element behaves like a normal button and does not affect the | 541 // This element behaves like a normal button and does not affect the |
552 // underlying preference; it just becomes disabled when the preference is | 542 // underlying preference; it just becomes disabled when the preference is |
553 // managed, and its value is false. This is useful for buttons that should | 543 // managed, and its value is false. This is useful for buttons that should |
554 // be disabled when the underlying Boolean preference is set to false by a | 544 // be disabled when the underlying Boolean preference is set to false by a |
555 // policy or extension. | 545 // policy or extension. |
556 Preferences.getInstance().addEventListener(this.pref, function(event) { | 546 Preferences.getInstance().addEventListener(this.pref, function(event) { |
557 updateDisabledState_(self, 'notUserModifiable', | 547 updateDisabledState(self, 'notUserModifiable', |
558 event.value.disabled && !event.value.value); | 548 event.value.disabled && !event.value.value); |
559 self.controlledBy = event.value.controlledBy; | 549 self.controlledBy = event.value.controlledBy; |
560 }); | 550 }); |
561 }, | 551 }, |
562 | 552 |
563 /** | 553 /** |
564 * See |updateDisabledState_| above. | 554 * See |updateDisabledState| above. |
565 */ | 555 */ |
566 setDisabled: function(reason, disabled) { | 556 setDisabled: function(reason, disabled) { |
567 updateDisabledState_(this, reason, disabled); | 557 updateDisabledState(this, reason, disabled); |
568 }, | 558 }, |
569 }; | 559 }; |
570 | 560 |
571 /** | 561 /** |
572 * The name of the associated preference. | 562 * The name of the associated preference. |
573 */ | 563 */ |
574 cr.defineProperty(PrefButton, 'pref', cr.PropertyKind.ATTR); | 564 cr.defineProperty(PrefButton, 'pref', cr.PropertyKind.ATTR); |
575 | 565 |
576 /** | 566 /** |
577 * Whether the associated preference is controlled by a source other than the | 567 * Whether the associated preference is controlled by a source other than the |
578 * user's setting (can be 'policy', 'extension', 'recommended' or unset). | 568 * user's setting (can be 'policy', 'extension', 'recommended' or unset). |
579 */ | 569 */ |
580 cr.defineProperty(PrefButton, 'controlledBy', cr.PropertyKind.ATTR); | 570 cr.defineProperty(PrefButton, 'controlledBy', cr.PropertyKind.ATTR); |
581 | 571 |
582 // Export | 572 // Export |
583 return { | 573 return { |
584 PrefCheckbox: PrefCheckbox, | 574 PrefCheckbox: PrefCheckbox, |
585 PrefInputElement: PrefInputElement, | 575 PrefInputElement: PrefInputElement, |
586 PrefNumber: PrefNumber, | 576 PrefNumber: PrefNumber, |
587 PrefRadio: PrefRadio, | 577 PrefRadio: PrefRadio, |
588 PrefRange: PrefRange, | 578 PrefRange: PrefRange, |
589 PrefSelect: PrefSelect, | 579 PrefSelect: PrefSelect, |
590 PrefTextField: PrefTextField, | 580 PrefTextField: PrefTextField, |
591 PrefPortNumber: PrefPortNumber, | 581 PrefPortNumber: PrefPortNumber, |
592 PrefButton: PrefButton | 582 PrefButton: PrefButton |
593 }; | 583 }; |
594 | |
595 }); | 584 }); |
OLD | NEW |