Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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-toggle-button` is a toggle that controls a supplied preference. | 7 * `settings-toggle-button` is a toggle that controls a supplied preference. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-toggle-button', | 10 is: 'settings-toggle-button', |
| 11 | 11 |
| 12 behaviors: [SettingsBooleanControlBehavior], | |
|
dschuyler
2017/05/23 23:29:25
Just moved, not changed.
| |
| 13 | |
| 12 properties: { | 14 properties: { |
| 13 elideLabel: { | 15 elideLabel: { |
| 14 type: Boolean, | 16 type: Boolean, |
| 15 reflectToAttribute: true, | 17 reflectToAttribute: true, |
| 16 }, | 18 }, |
| 17 }, | 19 }, |
| 18 | 20 |
| 19 behaviors: [SettingsBooleanControlBehavior], | 21 /** @private */ |
|
hcarmona
2017/05/24 18:05:36
Should this be @override instead?
dschuyler
2017/05/24 20:39:07
Done.
| |
| 22 focus: function() { | |
| 23 this.$.control.focus(); | |
|
dschuyler
2017/05/23 23:29:25
Pass along the focus to avoid doing this elsewhere
| |
| 24 }, | |
| 20 | 25 |
| 21 /** @private */ | 26 /** @private */ |
| 22 onLabelWrapperTap_: function() { | 27 onLabelWrapperTap_: function() { |
| 23 if (this.controlDisabled_()) | 28 if (this.controlDisabled_()) |
| 24 return; | 29 return; |
| 25 | 30 |
| 26 this.checked = !this.checked; | 31 this.checked = !this.checked; |
| 27 this.notifyChangedByUserInteraction(); | 32 this.notifyChangedByUserInteraction(); |
| 28 }, | 33 }, |
| 29 }); | 34 }); |
| OLD | NEW |