OLD | NEW |
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 'settings-clear-browsing-data-dialog' allows the user to delete | 6 * @fileoverview 'settings-clear-browsing-data-dialog' allows the user to delete |
7 * browsing data that has been cached by Chromium. | 7 * browsing data that has been cached by Chromium. |
8 */ | 8 */ |
9 Polymer({ | 9 Polymer({ |
10 is: 'settings-clear-browsing-data-dialog', | 10 is: 'settings-clear-browsing-data-dialog', |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 this.$.clearFrom.menuOptions = this.clearFromOptions_; | 98 this.$.clearFrom.menuOptions = this.clearFromOptions_; |
99 this.addWebUIListener('update-footer', this.updateFooter_.bind(this)); | 99 this.addWebUIListener('update-footer', this.updateFooter_.bind(this)); |
100 this.addWebUIListener( | 100 this.addWebUIListener( |
101 'update-counter-text', this.updateCounterText_.bind(this)); | 101 'update-counter-text', this.updateCounterText_.bind(this)); |
102 }, | 102 }, |
103 | 103 |
104 /** @override */ | 104 /** @override */ |
105 attached: function() { | 105 attached: function() { |
106 this.browserProxy_ = | 106 this.browserProxy_ = |
107 settings.ClearBrowsingDataBrowserProxyImpl.getInstance(); | 107 settings.ClearBrowsingDataBrowserProxyImpl.getInstance(); |
108 this.browserProxy_.initialize().then(function() { | 108 this.browserProxy_.initialize().then(() => { |
109 this.$.clearBrowsingDataDialog.showModal(); | 109 this.$.clearBrowsingDataDialog.showModal(); |
110 }.bind(this)); | 110 }); |
111 | 111 |
112 if (this.importantSitesFlagEnabled_) { | 112 if (this.importantSitesFlagEnabled_) { |
113 this.browserProxy_.getImportantSites().then(function(sites) { | 113 this.browserProxy_.getImportantSites().then(sites => { |
114 this.importantSites_ = sites; | 114 this.importantSites_ = sites; |
115 }.bind(this)); | 115 }); |
116 } | 116 } |
117 }, | 117 }, |
118 | 118 |
119 /** | 119 /** |
120 * Updates the footer to show only those sentences that are relevant to this | 120 * Updates the footer to show only those sentences that are relevant to this |
121 * user. | 121 * user. |
122 * @param {boolean} syncing Whether the user is syncing data. | 122 * @param {boolean} syncing Whether the user is syncing data. |
123 * @param {boolean} otherFormsOfBrowsingHistory Whether the user has other | 123 * @param {boolean} otherFormsOfBrowsingHistory Whether the user has other |
124 * forms of browsing history in their account. | 124 * forms of browsing history in their account. |
125 * @private | 125 * @private |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 }, | 190 }, |
191 | 191 |
192 /** | 192 /** |
193 * Clears browsing data and maybe shows a history notice. | 193 * Clears browsing data and maybe shows a history notice. |
194 * @private | 194 * @private |
195 */ | 195 */ |
196 clearBrowsingData_: function() { | 196 clearBrowsingData_: function() { |
197 this.clearingInProgress_ = true; | 197 this.clearingInProgress_ = true; |
198 | 198 |
199 this.browserProxy_.clearBrowsingData(this.importantSites_) | 199 this.browserProxy_.clearBrowsingData(this.importantSites_) |
200 .then( | 200 .then(shouldShowNotice => { |
201 /** | 201 this.clearingInProgress_ = false; |
202 * @param {boolean} shouldShowNotice Whether we should show the | 202 this.showHistoryDeletionDialog_ = shouldShowNotice; |
203 * notice about other forms of browsing history before closing the | 203 if (!shouldShowNotice) |
204 * dialog. | 204 this.closeDialogs_(); |
205 */ | 205 }); |
206 function(shouldShowNotice) { | |
207 this.clearingInProgress_ = false; | |
208 this.showHistoryDeletionDialog_ = shouldShowNotice; | |
209 if (!shouldShowNotice) | |
210 this.closeDialogs_(); | |
211 }.bind(this)); | |
212 }, | 206 }, |
213 | 207 |
214 /** | 208 /** |
215 * Closes the clear browsing data or important site dialog if they are open. | 209 * Closes the clear browsing data or important site dialog if they are open. |
216 * @private | 210 * @private |
217 */ | 211 */ |
218 closeDialogs_: function() { | 212 closeDialogs_: function() { |
219 if (this.$.clearBrowsingDataDialog.open) | 213 if (this.$.clearBrowsingDataDialog.open) |
220 this.$.clearBrowsingDataDialog.close(); | 214 this.$.clearBrowsingDataDialog.close(); |
221 if (this.showImportantSitesDialog_) | 215 if (this.showImportantSitesDialog_) |
(...skipping 20 matching lines...) Expand all Loading... |
242 | 236 |
243 /** | 237 /** |
244 * Handles the closing of the notice about other forms of browsing history. | 238 * Handles the closing of the notice about other forms of browsing history. |
245 * @private | 239 * @private |
246 */ | 240 */ |
247 onHistoryDeletionDialogClose_: function() { | 241 onHistoryDeletionDialogClose_: function() { |
248 this.showHistoryDeletionDialog_ = false; | 242 this.showHistoryDeletionDialog_ = false; |
249 this.closeDialogs_(); | 243 this.closeDialogs_(); |
250 }, | 244 }, |
251 }); | 245 }); |
OLD | NEW |