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

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: . 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..8b3bb362c14c2093ec6fe4cd38be26d98c0e6fe7 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: {
+ 'dom-change': 'onDomChange_',
Dan Beam 2017/03/09 02:08:33 do-not-track-dialog-if.dom-change should only tar
stevenjb 2017/03/09 20:06:26 Done.
Dan Beam 2017/03/13 21:57:51 not done
+ },
+
ready: function() {
this.ContentSettingsTypes = settings.ContentSettingsTypes;
@@ -112,6 +122,64 @@ Polymer({
},
/** @private */
+ onDomChange_: function() {
+ if (this.showDoNotTrackDialog_)
+ this.maybeShowDoNotTrackDialog_();
+ },
+
+ /**
+ * Handles the change event for the do-not-track toggle. Shows a
+ * confirmation dialog when enabling the setting.
+ * @param {{target: !SettingsToggleButtonElement}} event
+ * @private
+ */
+ onDoNotTrackChange_: function(event) {
+ if (!event.target.checked) {
+ // Always allow disabling the pref.
+ event.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">
settings.navigateTo(settings.Route.CERTIFICATES);

Powered by Google App Engine
This is Rietveld 408576698