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 Polymer({ | 5 Polymer({ |
6 is: 'controlled-radio-button', | 6 is: 'controlled-radio-button', |
7 | 7 |
8 behaviors: [PrefControlBehavior], | 8 behaviors: [PrefControlBehavior], |
9 | 9 |
10 properties: { | 10 properties: { |
(...skipping 18 matching lines...) Expand all Loading... |
29 * @return {boolean} Whether the button is disabled. | 29 * @return {boolean} Whether the button is disabled. |
30 * @private | 30 * @private |
31 */ | 31 */ |
32 computeControlled_: function() { | 32 computeControlled_: function() { |
33 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; | 33 return this.pref.enforcement == chrome.settingsPrivate.Enforcement.ENFORCED; |
34 }, | 34 }, |
35 | 35 |
36 /** | 36 /** |
37 * @param {boolean} controlled | 37 * @param {boolean} controlled |
38 * @param {string} name | 38 * @param {string} name |
39 * @param {chrome.settingsPrivate.PrefObject} pref | |
40 * @return {boolean} | 39 * @return {boolean} |
41 * @private | 40 * @private |
42 */ | 41 */ |
43 showIndicator_: function(controlled, name, pref) { | 42 showIndicator_: function(controlled, name) { |
44 return controlled && name == Settings.PrefUtil.prefToString(pref); | 43 return controlled && |
| 44 name == Settings.PrefUtil.prefToString(assert(this.pref)); |
45 }, | 45 }, |
46 | 46 |
47 /** | 47 /** |
48 * @param {!Event} e | 48 * @param {!Event} e |
49 * @private | 49 * @private |
50 */ | 50 */ |
51 onIndicatorTap_: function(e) { | 51 onIndicatorTap_: function(e) { |
52 // Disallow <controlled-radio-button on-tap="..."> when controlled. | 52 // Disallow <controlled-radio-button on-tap="..."> when controlled. |
53 e.preventDefault(); | 53 e.preventDefault(); |
54 e.stopPropagation(); | 54 e.stopPropagation(); |
55 }, | 55 }, |
56 | 56 |
57 /** Focuses the internal radio button when the row is selected. */ | 57 /** Focuses the internal radio button when the row is selected. */ |
58 onFocus_: function() { | 58 onFocus_: function() { |
59 this.$.radioButton.focus(); | 59 this.$.radioButton.focus(); |
60 }, | 60 }, |
61 }); | 61 }); |
OLD | NEW |