| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * `settings-input` is a single-line text field for user input associated | 7 * `settings-input` is a single-line text field for user input associated |
| 8 * with a pref value. | 8 * with a pref value. |
| 9 * | 9 * |
| 10 * @element settings-input | 10 * @element settings-input |
| 11 */ | 11 */ |
| 12 Polymer({ | 12 Polymer({ |
| 13 is: 'settings-input', | 13 is: 'settings-input', |
| 14 | 14 |
| 15 behaviors: [PolicyControllable], | 15 behaviors: [CrPolicyPrefBehavior], |
| 16 | 16 |
| 17 properties: { | 17 properties: { |
| 18 /** | 18 /** |
| 19 * The preference object to control. | 19 * The preference object to control. |
| 20 * @type {chrome.settingsPrivate.PrefObject|undefined} | 20 * @type {!chrome.settingsPrivate.PrefObject|undefined} |
| 21 */ | 21 */ |
| 22 pref: { | 22 pref: { |
| 23 type: Object, | 23 type: Object, |
| 24 notify: true, | 24 notify: true, |
| 25 observer: 'prefChanged_' | 25 observer: 'prefChanged_' |
| 26 }, | 26 }, |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * The current value of the input, reflected to/from |pref|. | 29 * The current value of the input, reflected to/from |pref|. |
| 30 */ | 30 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 this.set('pref.value', n); | 121 this.set('pref.value', n); |
| 122 } else { | 122 } else { |
| 123 assert(this.pref.type == chrome.settingsPrivate.PrefType.STRING || | 123 assert(this.pref.type == chrome.settingsPrivate.PrefType.STRING || |
| 124 this.pref.type == chrome.settingsPrivate.PrefType.URL); | 124 this.pref.type == chrome.settingsPrivate.PrefType.URL); |
| 125 this.set('pref.value', this.value); | 125 this.set('pref.value', this.value); |
| 126 } | 126 } |
| 127 }, | 127 }, |
| 128 | 128 |
| 129 /** | 129 /** |
| 130 * @param {boolean} disabled | 130 * @param {boolean} disabled |
| 131 * @param {?chrome.settingsPrivate.PrefObject} pref | 131 * @param {!chrome.settingsPrivate.PrefObject} pref |
| 132 * @return {boolean} Whether the element should be disabled. | 132 * @return {boolean} Whether the element should be disabled. |
| 133 * @private | 133 * @private |
| 134 */ | 134 */ |
| 135 isDisabled_: function(disabled, pref) { | 135 isDisabled_: function(disabled, pref) { |
| 136 return disabled || this.isPolicyControlled(pref); | 136 return disabled || this.isPrefPolicyControlled(pref); |
| 137 }, | 137 }, |
| 138 }); | 138 }); |
| OLD | NEW |