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

Unified Diff: chrome/browser/resources/settings/privacy_page/privacy_page.js

Issue 2684853003: MD Settings: change how tap is handled on custom toggle rows (Closed)
Patch Set: . 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/privacy_page/privacy_page.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/privacy_page/privacy_page.js
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chrome/browser/resources/settings/privacy_page/privacy_page.js
index 8e0c4b029c5ad5253e57388a4c64b732355b14aa..67d1bc504f5f532ce5b051743cb8407633cdf82c 100644
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.js
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -113,9 +113,26 @@ Polymer({
// <if expr="_google_chrome and not chromeos">
/** @private */
- onMetricsReportingControlTap_: function() {
+ onMetricsReportingTap_: function(e) {
+ // Both event types must match for stopPropagation() to work.
+ assert(e.type == 'tap');
+
+ if (this.metricsReporting_.managed)
+ return;
+
var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance();
- var enabled = this.$.metricsReportingControl.checked;
+ var control = this.$.metricsReportingControl;
+ var enabled = control.checked;
+
+ if (e.target == control) {
+ // Prevent the on-tap of the parent from double-changing the value.
+ e.stopPropagation();
+ } else {
+ // If the event came from somewhere other than the control, invert the
+ // value to toggle the control.
+ enabled = !enabled;
+ }
+
browserProxy.setMetricsReportingEnabled(enabled);
},
@@ -142,9 +159,23 @@ Polymer({
// </if>
/** @private */
- onSafeBrowsingExtendedReportingControlTap_: function() {
+ onSafeBrowsingExtendedReportingTap_: function(e) {
+ // Both event types must match for stopPropagation() to work.
+ assert(e.type == 'tap');
+
var browserProxy = settings.PrivacyPageBrowserProxyImpl.getInstance();
- var enabled = this.$.safeBrowsingExtendedReportingControl.checked;
+ var control = this.$.safeBrowsingExtendedReportingControl;
+ var enabled = control.checked;
+
+ if (e.target == control) {
+ // Prevent the on-tap of the parent from double-changing the value.
+ e.stopPropagation();
+ } else {
+ // If the event came from somewhere other than the control, invert the
+ // value to toggle the control.
+ enabled = !enabled;
+ }
+
browserProxy.setSafeBrowsingExtendedReportingEnabled(enabled);
},
« no previous file with comments | « chrome/browser/resources/settings/privacy_page/privacy_page.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698