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

Side by Side Diff: chrome/browser/resources/settings/checkbox/checkbox.js

Issue 1287913005: Refactor prefs.js for MD-Settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add return after switch for non-clang Created 5 years, 3 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-settings-checkbox` is a checkbox that controls a supplied preference. 7 * `cr-settings-checkbox` is a checkbox that controls a supplied preference.
8 * 8 *
9 * Example: 9 * Example:
10 * <cr-settings-checkbox pref="{{prefs.settings.enableFoo}}" 10 * <cr-settings-checkbox pref="{{prefs.settings.enableFoo}}"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 prefValueChanged_: function(prefValue) { 61 prefValueChanged_: function(prefValue) {
62 // prefValue is initially undefined when Polymer initializes pref. 62 // prefValue is initially undefined when Polymer initializes pref.
63 if (prefValue !== undefined) { 63 if (prefValue !== undefined) {
64 this.checked = this.getNewValue_(prefValue); 64 this.checked = this.getNewValue_(prefValue);
65 } 65 }
66 }, 66 },
67 67
68 /** @private */ 68 /** @private */
69 checkedChanged_: function() { 69 checkedChanged_: function() {
70 if (this.pref) { 70 if (this.pref) {
71 this.pref.value = this.getNewValue_(this.checked); 71 this.set('pref.value', this.getNewValue_(this.checked));
72 } 72 }
73 }, 73 },
74 74
75 /** @private */ 75 /** @private */
76 getNewValue_: function(val) { 76 getNewValue_: function(val) {
77 return this.inverted ? !val : val; 77 return this.inverted ? !val : val;
78 } 78 }
79 }); 79 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698