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

Side by Side 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 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 (function() { 10 (function() {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 safeBrowsingExtendedReportingPref_: { 70 safeBrowsingExtendedReportingPref_: {
71 type: Object, 71 type: Object,
72 value: function() { 72 value: function() {
73 return /** @type {chrome.settingsPrivate.PrefObject} */({}); 73 return /** @type {chrome.settingsPrivate.PrefObject} */({});
74 }, 74 },
75 }, 75 },
76 76
77 /** @private */ 77 /** @private */
78 showClearBrowsingDataDialog_: Boolean, 78 showClearBrowsingDataDialog_: Boolean,
79 79
80 /** @private */
81 showDoNotTrackDialog_: {
82 type: Boolean,
83 value: false,
84 },
85
80 /** 86 /**
81 * Used for HTML bindings. This is defined as a property rather than within 87 * Used for HTML bindings. This is defined as a property rather than within
82 * the ready callback, because the value needs to be available before 88 * the ready callback, because the value needs to be available before
83 * local DOM initialization - otherwise, the toggle has unexpected behavior. 89 * local DOM initialization - otherwise, the toggle has unexpected behavior.
84 * @private 90 * @private
85 */ 91 */
86 networkPredictionEnum_: { 92 networkPredictionEnum_: {
87 type: Object, 93 type: Object,
88 value: NetworkPredictionOptions, 94 value: NetworkPredictionOptions,
89 }, 95 },
90 }, 96 },
91 97
98 listeners: {
99 'doNotTrackDialogIf.dom-change': 'onDoNotTrackDomChange_',
100 },
101
92 ready: function() { 102 ready: function() {
93 this.ContentSettingsTypes = settings.ContentSettingsTypes; 103 this.ContentSettingsTypes = settings.ContentSettingsTypes;
94 104
95 this.browserProxy_ = settings.PrivacyPageBrowserProxyImpl.getInstance(); 105 this.browserProxy_ = settings.PrivacyPageBrowserProxyImpl.getInstance();
96 106
97 // <if expr="_google_chrome and not chromeos"> 107 // <if expr="_google_chrome and not chromeos">
98 var setMetricsReportingPref = this.setMetricsReportingPref_.bind(this); 108 var setMetricsReportingPref = this.setMetricsReportingPref_.bind(this);
99 this.addWebUIListener('metrics-reporting-change', setMetricsReportingPref); 109 this.addWebUIListener('metrics-reporting-change', setMetricsReportingPref);
100 this.browserProxy_.getMetricsReporting().then(setMetricsReportingPref); 110 this.browserProxy_.getMetricsReporting().then(setMetricsReportingPref);
101 // </if> 111 // </if>
102 112
103 var setSber = this.setSafeBrowsingExtendedReporting_.bind(this); 113 var setSber = this.setSafeBrowsingExtendedReporting_.bind(this);
104 this.addWebUIListener('safe-browsing-extended-reporting-change', setSber); 114 this.addWebUIListener('safe-browsing-extended-reporting-change', setSber);
105 this.browserProxy_.getSafeBrowsingExtendedReporting().then(setSber); 115 this.browserProxy_.getSafeBrowsingExtendedReporting().then(setSber);
106 }, 116 },
107 117
108 /** @protected */ 118 /** @protected */
109 currentRouteChanged: function() { 119 currentRouteChanged: function() {
110 this.showClearBrowsingDataDialog_ = 120 this.showClearBrowsingDataDialog_ =
111 settings.getCurrentRoute() == settings.Route.CLEAR_BROWSER_DATA; 121 settings.getCurrentRoute() == settings.Route.CLEAR_BROWSER_DATA;
112 }, 122 },
113 123
124 /**
125 * @param {Event} event
126 * @private
127 */
128 onDoNotTrackDomChange_: function(event) {
129 if (this.showDoNotTrackDialog_)
130 this.maybeShowDoNotTrackDialog_();
131 },
132
133 /**
134 * Handles the change event for the do-not-track toggle. Shows a
135 * confirmation dialog when enabling the setting.
136 * @param {Event} event
137 * @private
138 */
139 onDoNotTrackChange_: function(event) {
140 var target = /** @type {!SettingsToggleButtonElement} */(event.target);
141 if (!target.checked) {
142 // Always allow disabling the pref.
143 target.sendPrefChange();
144 return;
145 }
146 this.showDoNotTrackDialog_ = true;
147 // If the dialog has already been stamped, show it. Otherwise it will be
148 // shown in onDomChange_.
149 this.maybeShowDoNotTrackDialog_();
150 },
151
152 /** @private */
153 maybeShowDoNotTrackDialog_: function() {
154 var dialog = this.$$('#confirmDoNotTrackDialog');
155 if (dialog && !dialog.open)
156 dialog.showModal();
157 },
158
159 /** @private */
160 closeDoNotTrackDialog_: function() {
161 this.$$('#confirmDoNotTrackDialog').close();
162 this.showDoNotTrackDialog_ = false;
163 },
164
165 /**
166 * Handles the shared proxy confirmation dialog 'Confirm' button.
167 * @private
168 */
169 onDoNotTrackDialogConfirm_: function() {
170 /** @type {!SettingsToggleButtonElement} */ (this.$.doNotTrack)
171 .sendPrefChange();
172 this.closeDoNotTrackDialog_();
173 },
174
175 /**
176 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel
177 * event.
178 * @private
179 */
180 onDoNotTrackDialogCancel_: function() {
181 /** @type {!SettingsToggleButtonElement} */ (this.$.doNotTrack)
182 .resetToPrefValue();
183 this.closeDoNotTrackDialog_();
184 },
185
114 /** @private */ 186 /** @private */
115 onManageCertificatesTap_: function() { 187 onManageCertificatesTap_: function() {
116 // <if expr="use_nss_certs"> 188 // <if expr="use_nss_certs">
117 settings.navigateTo(settings.Route.CERTIFICATES); 189 settings.navigateTo(settings.Route.CERTIFICATES);
118 // </if> 190 // </if>
119 // <if expr="is_win or is_macosx"> 191 // <if expr="is_win or is_macosx">
120 this.browserProxy_.showManageSSLCertificates(); 192 this.browserProxy_.showManageSSLCertificates();
121 // </if> 193 // </if>
122 }, 194 },
123 195
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 : this.i18n('siteSettingsBlocked'); 313 : this.i18n('siteSettingsBlocked');
242 }, 314 },
243 315
244 /** @private */ 316 /** @private */
245 getProtectedContentIdentifiersLabel_: function(value) { 317 getProtectedContentIdentifiersLabel_: function(value) {
246 return value ? this.i18n('siteSettingsProtectedContentEnableIdentifiers') 318 return value ? this.i18n('siteSettingsProtectedContentEnableIdentifiers')
247 : this.i18n('siteSettingsBlocked'); 319 : this.i18n('siteSettingsBlocked');
248 }, 320 },
249 }); 321 });
250 })(); 322 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698