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

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

Issue 2684853003: MD Settings: change how tap is handled on custom toggle rows (Closed)
Patch Set: todo Created 3 years, 10 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 | chrome/browser/resources/settings/controls/settings_checkbox.html » ('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 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 * A behavior to help controls that handle a boolean preference, such as 7 * A behavior to help controls that handle a boolean preference, such as
8 * checkbox and toggle button. 8 * checkbox and toggle button.
9 */ 9 */
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 subLabel: { 54 subLabel: {
55 type: String, 55 type: String,
56 value: '', 56 value: '',
57 }, 57 },
58 }, 58 },
59 59
60 observers: [ 60 observers: [
61 'prefValueChanged_(pref.value)', 61 'prefValueChanged_(pref.value)',
62 ], 62 ],
63 63
64 notifyChangedByUserInteraction: function() {
65 this.fire('settings-boolean-control-change');
66 },
67
64 /** Reset the checked state to match the current pref value. */ 68 /** Reset the checked state to match the current pref value. */
65 resetToPrefValue: function() { 69 resetToPrefValue: function() {
66 this.checked = this.getNewValue_(this.pref.value); 70 this.checked = this.getNewValue_(this.pref.value);
67 }, 71 },
68 72
69 /** Update the pref to the current |checked| value. */ 73 /** Update the pref to the current |checked| value. */
70 sendPrefChange: function() { 74 sendPrefChange: function() {
71 /** @type {boolean} */ var newValue = this.getNewValue_(this.checked); 75 /** @type {boolean} */ var newValue = this.getNewValue_(this.checked);
72 // Ensure that newValue is the correct type for the pref type, either 76 // Ensure that newValue is the correct type for the pref type, either
73 // a boolean or a number. 77 // a boolean or a number.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return this.disabled || this.isPrefPolicyControlled(assert(this.pref)); 118 return this.disabled || this.isPrefPolicyControlled(assert(this.pref));
115 }, 119 },
116 }; 120 };
117 121
118 /** @polymerBehavior */ 122 /** @polymerBehavior */
119 var SettingsBooleanControlBehavior = [ 123 var SettingsBooleanControlBehavior = [
120 CrPolicyPrefBehavior, 124 CrPolicyPrefBehavior,
121 PrefControlBehavior, 125 PrefControlBehavior,
122 SettingsBooleanControlBehaviorImpl, 126 SettingsBooleanControlBehaviorImpl,
123 ]; 127 ];
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/settings/controls/settings_checkbox.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698