| 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);
|
| },
|
|
|
|
|