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

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

Issue 1287713002: [MD settings] merge polymer 1.0.11; hack for settings checkbox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior-extracted.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 observers: [ 51 observers: [
52 'prefValueChanged_(pref.value)' 52 'prefValueChanged_(pref.value)'
53 ], 53 ],
54 54
55 /** @override */ 55 /** @override */
56 ready: function() { 56 ready: function() {
57 this.$.events.forward(this.$.checkbox, ['change']); 57 this.$.events.forward(this.$.checkbox, ['change']);
58 }, 58 },
59 59
60 /** @override */
61 attached: function() {
62 // HACK(dschuyler): paper-checkbox 1.0.6 will hide the label
63 // if the content is empty.
64 // TODO(dschuyler): rework settings checkbox to use content
65 // rather than spans.
66 this.$.checkbox.$.checkbox.$.checkboxLabel.hidden = false;
67 },
stevenjb 2015/08/13 21:44:38 Is there any reason why this was done here instead
68
60 /** @private */ 69 /** @private */
61 prefValueChanged_: function(prefValue) { 70 prefValueChanged_: function(prefValue) {
62 // prefValue is initially undefined when Polymer initializes pref. 71 // prefValue is initially undefined when Polymer initializes pref.
63 if (prefValue !== undefined) { 72 if (prefValue !== undefined) {
64 this.checked = this.getNewValue_(prefValue); 73 this.checked = this.getNewValue_(prefValue);
65 } 74 }
66 }, 75 },
67 76
68 /** @private */ 77 /** @private */
69 checkedChanged_: function() { 78 checkedChanged_: function() {
70 if (this.pref) { 79 if (this.pref) {
71 this.pref.value = this.getNewValue_(this.checked); 80 this.pref.value = this.getNewValue_(this.checked);
72 } 81 }
73 }, 82 },
74 83
75 /** @private */ 84 /** @private */
76 getNewValue_: function(val) { 85 getNewValue_: function(val) {
77 return this.inverted ? !val : val; 86 return this.inverted ? !val : val;
78 } 87 }
79 }); 88 });
OLDNEW
« no previous file with comments | « no previous file | third_party/polymer/v1_0/components-chromium/iron-a11y-keys-behavior/iron-a11y-keys-behavior-extracted.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698