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

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

Issue 2731403005: MD Settings: Privacy: Show dialog when changing do-not-track (Closed)
Patch Set: Rebase Use on-settings-boolean-control-change Created 3 years, 9 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
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 825633f929ffc159ac677f3a70cc9916a6b7c954..1721100e255b176df66c2ebb3d02265f0df5380f 100644
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.js
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -77,6 +77,12 @@ Polymer({
/** @private */
showClearBrowsingDataDialog_: Boolean,
+ /** @private */
+ showDoNotTrackDialog_: {
+ type: Boolean,
+ value: false,
+ },
+
/**
* Used for HTML bindings. This is defined as a property rather than within
* the ready callback, because the value needs to be available before
@@ -89,6 +95,10 @@ Polymer({
},
},
+ listeners: {
+ 'doNotTrackDialogIf.dom-change': 'onDoNotTrackDomChange_',
+ },
+
ready: function() {
this.ContentSettingsTypes = settings.ContentSettingsTypes;
@@ -111,6 +121,68 @@ Polymer({
settings.getCurrentRoute() == settings.Route.CLEAR_BROWSER_DATA;
},
+ /**
+ * @param {Event} event
+ * @private
+ */
+ onDoNotTrackDomChange_: function(event) {
+ if (this.showDoNotTrackDialog_)
+ this.maybeShowDoNotTrackDialog_();
+ },
+
+ /**
+ * Handles the change event for the do-not-track toggle. Shows a
+ * confirmation dialog when enabling the setting.
+ * @param {Event} event
+ * @private
+ */
+ onDoNotTrackChange_: function(event) {
+ var target = /** @type {!SettingsToggleButtonElement} */(event.target);
+ if (!target.checked) {
+ // Always allow disabling the pref.
+ target.sendPrefChange();
+ return;
+ }
+ this.showDoNotTrackDialog_ = true;
+ // If the dialog has already been stamped, show it. Otherwise it will be
+ // shown in onDomChange_.
+ this.maybeShowDoNotTrackDialog_();
+ },
+
+ /** @private */
+ maybeShowDoNotTrackDialog_: function() {
+ var dialog = this.$$('#confirmDoNotTrackDialog');
+ if (dialog && !dialog.open)
+ dialog.showModal();
+ },
+
+ /** @private */
+ closeDoNotTrackDialog_: function() {
+ this.$$('#confirmDoNotTrackDialog').close();
+ this.showDoNotTrackDialog_ = false;
+ },
+
+ /**
+ * Handles the shared proxy confirmation dialog 'Confirm' button.
+ * @private
+ */
+ onDoNotTrackDialogConfirm_: function() {
+ /** @type {!SettingsToggleButtonElement} */ (this.$.doNotTrack)
+ .sendPrefChange();
+ this.closeDoNotTrackDialog_();
+ },
+
+ /**
+ * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel
+ * event.
+ * @private
+ */
+ onDoNotTrackDialogCancel_: function() {
+ /** @type {!SettingsToggleButtonElement} */ (this.$.doNotTrack)
+ .resetToPrefValue();
+ this.closeDoNotTrackDialog_();
+ },
+
/** @private */
onManageCertificatesTap_: function() {
// <if expr="use_nss_certs">

Powered by Google App Engine
This is Rietveld 408576698