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

Side by Side Diff: chrome/browser/resources/options/clear_browser_data_overlay.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh just no Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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.
34 * @type {boolean} 35 * @type {boolean}
35 * @private 36 * @private
36 */ 37 */
37 isClearingInProgress_: false, 38 isClearingInProgress_: false,
38 39
39 /** 40 /**
40 * Whether or not the WebUI handler has completed initialization. 41 * Whether or not the WebUI handler has completed initialization.
41 * 42 *
42 * Unless this becomes true, it must be assumed that the above flags might 43 * Unless this becomes true, it must be assumed that the above flags might
43 * not contain the authoritative values. 44 * not contain the authoritative values.
44 * 45 *
45 * @type {boolean} 46 * @type {boolean}
46 * @private 47 * @private
47 */ 48 */
48 isInitializationComplete_: false, 49 isInitializationComplete_: false,
49 50
50 /** @override */ 51 /** @override */
51 initializePage: function() { 52 initializePage: function() {
52 // Call base class implementation to starts preference initialization. 53 Page.prototype.initializePage.call(this);
53 OptionsPage.prototype.initializePage.call(this);
54 54
55 var f = this.updateStateOfControls_.bind(this); 55 var f = this.updateStateOfControls_.bind(this);
56 var types = ['browser.clear_data.browsing_history', 56 var types = ['browser.clear_data.browsing_history',
57 'browser.clear_data.download_history', 57 'browser.clear_data.download_history',
58 'browser.clear_data.cache', 58 'browser.clear_data.cache',
59 'browser.clear_data.cookies', 59 'browser.clear_data.cookies',
60 'browser.clear_data.passwords', 60 'browser.clear_data.passwords',
61 'browser.clear_data.form_data', 61 'browser.clear_data.form_data',
62 'browser.clear_data.hosted_apps_data', 62 'browser.clear_data.hosted_apps_data',
63 'browser.clear_data.content_licenses']; 63 'browser.clear_data.content_licenses'];
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 i += 3; 127 i += 3;
128 } else { 128 } else {
129 var span = document.createElement('span'); 129 var span = document.createElement('span');
130 span.textContent = footerFragments[i]; 130 span.textContent = footerFragments[i];
131 footer.appendChild(span); 131 footer.appendChild(span);
132 i += 1; 132 i += 1;
133 } 133 }
134 } 134 }
135 $('open-content-settings-from-clear-browsing-data').onclick = 135 $('open-content-settings-from-clear-browsing-data').onclick =
136 function(event) { 136 function(event) {
137 OptionsPage.navigateToPage('content'); 137 PageManager.showPageByName('content');
138 }; 138 };
139 $('open-search-engines-from-clear-browsing-data').onclick = 139 $('open-search-engines-from-clear-browsing-data').onclick =
140 function(event) { 140 function(event) {
141 OptionsPage.navigateToPage('searchEngines'); 141 PageManager.showPageByName('searchEngines');
142 }; 142 };
143 }, 143 },
144 144
145 /** 145 /**
146 * Sets whether or not we are in the process of clearing data. 146 * Sets whether or not we are in the process of clearing data.
147 * @param {boolean} clearing Whether the browsing data is currently being 147 * @param {boolean} clearing Whether the browsing data is currently being
148 * cleared. 148 * cleared.
149 * @private 149 * @private
150 */ 150 */
151 setClearing_: function(clearing) { 151 setClearing_: function(clearing) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // The delay gives the user some feedback that the clearing 248 // The delay gives the user some feedback that the clearing
249 // actually worked. Otherwise the dialog just vanishes instantly in most 249 // actually worked. Otherwise the dialog just vanishes instantly in most
250 // cases. 250 // cases.
251 window.setTimeout(function() { 251 window.setTimeout(function() {
252 ClearBrowserDataOverlay.setClearing(false); 252 ClearBrowserDataOverlay.setClearing(false);
253 ClearBrowserDataOverlay.dismiss(); 253 ClearBrowserDataOverlay.dismiss();
254 }, 200); 254 }, 200);
255 }; 255 };
256 256
257 ClearBrowserDataOverlay.dismiss = function() { 257 ClearBrowserDataOverlay.dismiss = function() {
258 var topmostVisiblePage = OptionsPage.getTopmostVisiblePage(); 258 var topmostVisiblePage = PageManager.getTopmostVisiblePage();
259 if (topmostVisiblePage && topmostVisiblePage.name == 'clearBrowserData') 259 if (topmostVisiblePage && topmostVisiblePage.name == 'clearBrowserData')
260 OptionsPage.closeOverlay(); 260 PageManager.closeOverlay();
261 }; 261 };
262 262
263 // Export 263 // Export
264 return { 264 return {
265 ClearBrowserDataOverlay: ClearBrowserDataOverlay 265 ClearBrowserDataOverlay: ClearBrowserDataOverlay
266 }; 266 };
267 }); 267 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698