OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var OptionsPage = options.OptionsPage; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; |
7 | 8 |
8 /** | 9 /** |
9 * ClearBrowserDataOverlay class | 10 * ClearBrowserDataOverlay class |
10 * Encapsulated handling of the 'Clear Browser Data' overlay page. | 11 * Encapsulated handling of the 'Clear Browser Data' overlay page. |
11 * @class | 12 * @class |
12 */ | 13 */ |
13 function ClearBrowserDataOverlay() { | 14 function ClearBrowserDataOverlay() { |
14 OptionsPage.call(this, 'clearBrowserData', | 15 Page.call(this, 'clearBrowserData', |
15 loadTimeData.getString('clearBrowserDataOverlayTabTitle'), | 16 loadTimeData.getString('clearBrowserDataOverlayTabTitle'), |
16 'clear-browser-data-overlay'); | 17 'clear-browser-data-overlay'); |
17 } | 18 } |
18 | 19 |
19 cr.addSingletonGetter(ClearBrowserDataOverlay); | 20 cr.addSingletonGetter(ClearBrowserDataOverlay); |
20 | 21 |
21 ClearBrowserDataOverlay.prototype = { | 22 ClearBrowserDataOverlay.prototype = { |
22 // Inherit ClearBrowserDataOverlay from OptionsPage. | 23 // Inherit ClearBrowserDataOverlay from Page. |
23 __proto__: OptionsPage.prototype, | 24 __proto__: Page.prototype, |
24 | 25 |
25 /** | 26 /** |
26 * Whether deleting history and downloads is allowed. | 27 * Whether deleting history and downloads is allowed. |
27 * @type {boolean} | 28 * @type {boolean} |
28 * @private | 29 * @private |
29 */ | 30 */ |
30 allowDeletingHistory_: true, | 31 allowDeletingHistory_: true, |
31 | 32 |
32 /** | 33 /** |
33 * Whether or not clearing browsing data is currently in progress. | 34 * Whether or not clearing browsing data is currently in progress. |
(...skipping 10 matching lines...) Expand all Loading... |
44 * | 45 * |
45 * @type {boolean} | 46 * @type {boolean} |
46 * @private | 47 * @private |
47 */ | 48 */ |
48 isInitializationComplete_: false, | 49 isInitializationComplete_: false, |
49 | 50 |
50 /** | 51 /** |
51 * Initialize the page. | 52 * Initialize the page. |
52 */ | 53 */ |
53 initializePage: function() { | 54 initializePage: function() { |
54 // Call base class implementation to starts preference initialization. | 55 Page.prototype.initializePage.call(this); |
55 OptionsPage.prototype.initializePage.call(this); | |
56 | 56 |
57 var f = this.updateStateOfControls_.bind(this); | 57 var f = this.updateStateOfControls_.bind(this); |
58 var types = ['browser.clear_data.browsing_history', | 58 var types = ['browser.clear_data.browsing_history', |
59 'browser.clear_data.download_history', | 59 'browser.clear_data.download_history', |
60 'browser.clear_data.cache', | 60 'browser.clear_data.cache', |
61 'browser.clear_data.cookies', | 61 'browser.clear_data.cookies', |
62 'browser.clear_data.passwords', | 62 'browser.clear_data.passwords', |
63 'browser.clear_data.form_data', | 63 'browser.clear_data.form_data', |
64 'browser.clear_data.hosted_apps_data', | 64 'browser.clear_data.hosted_apps_data', |
65 'browser.clear_data.content_licenses']; | 65 'browser.clear_data.content_licenses']; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 i += 3; | 129 i += 3; |
130 } else { | 130 } else { |
131 var span = document.createElement('span'); | 131 var span = document.createElement('span'); |
132 span.textContent = footerFragments[i]; | 132 span.textContent = footerFragments[i]; |
133 footer.appendChild(span); | 133 footer.appendChild(span); |
134 i += 1; | 134 i += 1; |
135 } | 135 } |
136 } | 136 } |
137 $('open-content-settings-from-clear-browsing-data').onclick = | 137 $('open-content-settings-from-clear-browsing-data').onclick = |
138 function(event) { | 138 function(event) { |
139 OptionsPage.navigateToPage('content'); | 139 PageManager.showPageByName('content'); |
140 } | 140 } |
141 $('open-search-engines-from-clear-browsing-data').onclick = | 141 $('open-search-engines-from-clear-browsing-data').onclick = |
142 function(event) { | 142 function(event) { |
143 OptionsPage.navigateToPage('searchEngines'); | 143 PageManager.showPageByName('searchEngines'); |
144 } | 144 } |
145 }, | 145 }, |
146 | 146 |
147 /** | 147 /** |
148 * Sets whether or not we are in the process of clearing data. | 148 * Sets whether or not we are in the process of clearing data. |
149 * @param {boolean} clearing Whether the browsing data is currently being | 149 * @param {boolean} clearing Whether the browsing data is currently being |
150 * cleared. | 150 * cleared. |
151 * @private | 151 * @private |
152 */ | 152 */ |
153 setClearing_: function(clearing) { | 153 setClearing_: function(clearing) { |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // The delay gives the user some feedback that the clearing | 250 // The delay gives the user some feedback that the clearing |
251 // actually worked. Otherwise the dialog just vanishes instantly in most | 251 // actually worked. Otherwise the dialog just vanishes instantly in most |
252 // cases. | 252 // cases. |
253 window.setTimeout(function() { | 253 window.setTimeout(function() { |
254 ClearBrowserDataOverlay.setClearing(false); | 254 ClearBrowserDataOverlay.setClearing(false); |
255 ClearBrowserDataOverlay.dismiss(); | 255 ClearBrowserDataOverlay.dismiss(); |
256 }, 200); | 256 }, 200); |
257 }; | 257 }; |
258 | 258 |
259 ClearBrowserDataOverlay.dismiss = function() { | 259 ClearBrowserDataOverlay.dismiss = function() { |
260 var topmostVisiblePage = OptionsPage.getTopmostVisiblePage(); | 260 var topmostVisiblePage = PageManager.getTopmostVisiblePage(); |
261 if (topmostVisiblePage && topmostVisiblePage.name == 'clearBrowserData') | 261 if (topmostVisiblePage && topmostVisiblePage.name == 'clearBrowserData') |
262 OptionsPage.closeOverlay(); | 262 PageManager.closeOverlay(); |
263 }; | 263 }; |
264 | 264 |
265 // Export | 265 // Export |
266 return { | 266 return { |
267 ClearBrowserDataOverlay: ClearBrowserDataOverlay | 267 ClearBrowserDataOverlay: ClearBrowserDataOverlay |
268 }; | 268 }; |
269 }); | 269 }); |
OLD | NEW |