Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: chrome/browser/resources/settings/controls/settings_radio_group.js

Issue 2946563002: Run clang-format on .js files in c/b/r/settings (Closed)
Patch Set: dschuyler@ review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control 7 * `cr-radio-group` wraps a radio-group and set of radio-buttons that control
8 * a supplied preference. 8 * a supplied preference.
9 * 9 *
10 * Example: 10 * Example:
11 * <settings-radio-group pref="{{prefs.settings.foo}}" 11 * <settings-radio-group pref="{{prefs.settings.foo}}"
12 * label="Foo Options." buttons="{{fooOptionsList}}"> 12 * label="Foo Options." buttons="{{fooOptionsList}}">
13 * </settings-radio-group> 13 * </settings-radio-group>
14 */ 14 */
15 Polymer({ 15 Polymer({
16 is: 'settings-radio-group', 16 is: 'settings-radio-group',
17 17
18 behaviors: [PrefControlBehavior], 18 behaviors: [PrefControlBehavior],
19 19
20 properties: { 20 properties: {
21 /** 21 /**
22 * IronSelectableBehavior selected attribute. 22 * IronSelectableBehavior selected attribute.
23 */ 23 */
24 selected: { 24 selected: {type: String, notify: true, observer: 'selectedChanged_'},
25 type: String,
26 notify: true,
27 observer: 'selectedChanged_'
28 },
29 }, 25 },
30 26
31 hostAttributes: { 27 hostAttributes: {
32 role: 'none', 28 role: 'none',
33 }, 29 },
34 30
35 observers: [ 31 observers: [
36 'prefChanged_(pref.*)', 32 'prefChanged_(pref.*)',
37 ], 33 ],
38 34
39 /** @private */ 35 /** @private */
40 prefChanged_: function() { 36 prefChanged_: function() {
41 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */(this.pref); 37 var pref = /** @type {!chrome.settingsPrivate.PrefObject} */ (this.pref);
42 this.selected = Settings.PrefUtil.prefToString(pref); 38 this.selected = Settings.PrefUtil.prefToString(pref);
43 }, 39 },
44 40
45 /** @private */ 41 /** @private */
46 selectedChanged_: function(selected) { 42 selectedChanged_: function(selected) {
47 if (!this.pref) 43 if (!this.pref)
48 return; 44 return;
49 this.set('pref.value', 45 this.set(
50 Settings.PrefUtil.stringToPrefValue(selected, this.pref)); 46 'pref.value', Settings.PrefUtil.stringToPrefValue(selected, this.pref));
51 }, 47 },
52 }); 48 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698