| 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 Polymer({ | 10 Polymer({ |
| 11 is: 'settings-input', | 11 is: 'settings-input', |
| 12 | 12 |
| 13 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], | 13 behaviors: [CrPolicyPrefBehavior, PrefControlBehavior], |
| 14 | 14 |
| 15 properties: { | 15 properties: { |
| 16 /** | 16 /** |
| 17 * The preference object to control. | 17 * The preference object to control. |
| 18 * @type {!chrome.settingsPrivate.PrefObject|undefined} | 18 * @type {!chrome.settingsPrivate.PrefObject|undefined} |
| 19 * @override | 19 * @override |
| 20 */ | 20 */ |
| 21 pref: { | 21 pref: { |
| 22 observer: 'prefChanged_' | 22 observer: 'prefChanged_' |
| 23 }, | 23 }, |
| 24 | 24 |
| 25 /** | 25 /* The current value of the input, reflected to/from |pref|. */ |
| 26 * The current value of the input, reflected to/from |pref|. | |
| 27 */ | |
| 28 value: { | 26 value: { |
| 29 type: String, | 27 type: String, |
| 30 value: '', | 28 value: '', |
| 31 notify: true, | 29 notify: true, |
| 32 }, | 30 }, |
| 33 | 31 |
| 34 /** | 32 /* Set to true to disable editing the input. */ |
| 35 * Set to true to disable editing the input. | |
| 36 */ | |
| 37 disabled: { | 33 disabled: { |
| 38 type: Boolean, | 34 type: Boolean, |
| 39 value: false, | 35 value: false, |
| 40 reflectToAttribute: true | 36 reflectToAttribute: true |
| 41 }, | 37 }, |
| 42 | 38 |
| 43 /** Propagate the errorMessage property. */ | 39 /* Properties for paper-input. This is not strictly necessary. |
| 40 * Though it does define the types for the closure compiler. */ |
| 44 errorMessage: { type: String }, | 41 errorMessage: { type: String }, |
| 45 | |
| 46 /** Propagate the label property. */ | |
| 47 label: { type: String }, | 42 label: { type: String }, |
| 48 | |
| 49 /** Propagate the no-label-float property. */ | |
| 50 noLabelFloat: { type: Boolean, value: false }, | 43 noLabelFloat: { type: Boolean, value: false }, |
| 51 | |
| 52 /** Propagate the pattern property. */ | |
| 53 pattern: { type: String }, | 44 pattern: { type: String }, |
| 54 | |
| 55 /** Propagate the readonly property. */ | |
| 56 readonly: { type: Boolean, value: false }, | 45 readonly: { type: Boolean, value: false }, |
| 57 | |
| 58 /** Propagate the required property. */ | |
| 59 required: { type: Boolean, value: false }, | 46 required: { type: Boolean, value: false }, |
| 60 | 47 stopKeyboardEventPropagation: { type: Boolean, value: false }, |
| 61 /** Propagate the type property. */ | |
| 62 type: { type: String }, | 48 type: { type: String }, |
| 63 }, | 49 }, |
| 64 | 50 |
| 65 /** @override */ | 51 /** @override */ |
| 66 ready: function() { | 52 ready: function() { |
| 67 this.$.events.forward(this.$.input, ['change']); | 53 this.$.events.forward(this.$.input, ['change']); |
| 68 }, | 54 }, |
| 69 | 55 |
| 70 /** | 56 /** |
| 71 * Focuses the 'input' element. | 57 * Focuses the 'input' element. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 /** | 112 /** |
| 127 * @param {boolean} disabled | 113 * @param {boolean} disabled |
| 128 * @param {!chrome.settingsPrivate.PrefObject} pref | 114 * @param {!chrome.settingsPrivate.PrefObject} pref |
| 129 * @return {boolean} Whether the element should be disabled. | 115 * @return {boolean} Whether the element should be disabled. |
| 130 * @private | 116 * @private |
| 131 */ | 117 */ |
| 132 isDisabled_: function(disabled, pref) { | 118 isDisabled_: function(disabled, pref) { |
| 133 return disabled || this.isPrefPolicyControlled(pref); | 119 return disabled || this.isPrefPolicyControlled(pref); |
| 134 }, | 120 }, |
| 135 }); | 121 }); |
| OLD | NEW |