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

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

Issue 2688073002: MD Settings: For rows containing paper-toggle-buttons, make entire row clickable. (Closed)
Patch Set: prevent clicking toggle from firing handler twice 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
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 * 'settings-privacy-page' is the settings page containing privacy and 7 * 'settings-privacy-page' is the settings page containing privacy and
8 * security settings. 8 * security settings.
9 */ 9 */
10 Polymer({ 10 Polymer({
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 /** @private */ 108 /** @private */
109 onHelpTap_: function() { 109 onHelpTap_: function() {
110 window.open( 110 window.open(
111 'https://support.google.com/chrome/?p=settings_manage_exceptions'); 111 'https://support.google.com/chrome/?p=settings_manage_exceptions');
112 }, 112 },
113 113
114 // <if expr="_google_chrome and not chromeos"> 114 // <if expr="_google_chrome and not chromeos">
115 /** @private */ 115 /** @private */
116 onMetricsReportingControlTap_: function() { 116 onMetricsReportingControlTap_: function() {
117 if(this.metricsReporting_.managed)
118 return;
119
117 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); 120 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance();
118 var enabled = this.$.metricsReportingControl.checked; 121 var enabled = !this.metricsReporting_.enabled;
119 browserProxy.setMetricsReportingEnabled(enabled); 122 browserProxy.setMetricsReportingEnabled(enabled);
120 }, 123 },
121 124
122 /** 125 /**
123 * @param {!MetricsReporting} metricsReporting 126 * @param {!MetricsReporting} metricsReporting
124 * @private 127 * @private
125 */ 128 */
126 setMetricsReporting_: function(metricsReporting) { 129 setMetricsReporting_: function(metricsReporting) {
127 // TODO(dbeam): remember whether metrics reporting was enabled when Chrome 130 // TODO(dbeam): remember whether metrics reporting was enabled when Chrome
128 // started. 131 // started.
129 if (metricsReporting.managed) { 132 if (metricsReporting.managed) {
130 this.showRestart_ = false; 133 this.showRestart_ = false;
131 } else if (this.metricsReporting_ && 134 } else if (this.metricsReporting_ &&
132 metricsReporting.enabled != this.metricsReporting_.enabled) { 135 metricsReporting.enabled != this.metricsReporting_.enabled) {
133 this.showRestart_ = true; 136 this.showRestart_ = true;
134 } 137 }
135 this.metricsReporting_ = metricsReporting; 138 this.metricsReporting_ = metricsReporting;
136 }, 139 },
137 140
138 /** @private */ 141 /** @private */
139 onRestartTap_: function() { 142 onRestartTap_: function() {
140 settings.LifetimeBrowserProxyImpl.getInstance().restart(); 143 settings.LifetimeBrowserProxyImpl.getInstance().restart();
141 }, 144 },
142 // </if> 145 // </if>
143 146
144 /** @private */ 147 /** @private */
145 onSafeBrowsingExtendedReportingControlTap_: function() { 148 onSafeBrowsingExtendedReportingControlTap_: function(e) {
146 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance(); 149 var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance();
147 var enabled = this.$.safeBrowsingExtendedReportingControl.checked; 150 var enabled = !this.safeBrowsingExtendedReportingEnabled_;
Dan Beam 2017/02/10 17:20:36 i still don't really understand how this works. b
scottchen 2017/02/10 18:49:57 You're thinking of the toggle control's "checked"
148 browserProxy.setSafeBrowsingExtendedReportingEnabled(enabled); 151 browserProxy.setSafeBrowsingExtendedReportingEnabled(enabled);
149 }, 152 },
150 153
151 /** @param {boolean} enabled Whether reporting is enabled or not. 154 /** @param {boolean} enabled Whether reporting is enabled or not.
152 * @private 155 * @private
153 */ 156 */
154 setSafeBrowsingExtendedReporting_: function(enabled) { 157 setSafeBrowsingExtendedReporting_: function(enabled) {
155 this.safeBrowsingExtendedReportingEnabled_ = enabled; 158 this.safeBrowsingExtendedReportingEnabled_ = enabled;
156 }, 159 },
157 160
(...skipping 19 matching lines...) Expand all
177 /** 180 /**
178 * Works like a ternary operator. E.g. (value ? trueLabel: falseLabel). 181 * Works like a ternary operator. E.g. (value ? trueLabel: falseLabel).
179 * @param {boolean} value 182 * @param {boolean} value
180 * @param {string} trueLabel True label (for example, 'Allow DRM'). 183 * @param {string} trueLabel True label (for example, 'Allow DRM').
181 * @param {string} falseLabel False label (for example, 'Blocked'). 184 * @param {string} falseLabel False label (for example, 'Blocked').
182 * @private 185 * @private
183 */ 186 */
184 getStringTernary_: function(value, trueLabel, falseLabel) { 187 getStringTernary_: function(value, trueLabel, falseLabel) {
185 return value ? trueLabel : falseLabel; 188 return value ? trueLabel : falseLabel;
186 }, 189 },
190
191 doNothing_: function(e) {
scottchen 2017/02/10 07:53:39 This is dipping into the "slightly gross" zone, bu
192 e.stopPropagation();
193 }
187 }); 194 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698