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

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

Issue 2856053: Implement the 'Clear Browser Data' dom-ui overlay.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 * ClearBrowserData class 6 * ClearBrowserData class
7 * Encapsulated handling of the 'Clear Browser Data' overlay page. 7 * Encapsulated handling of the 'Clear Browser Data' overlay page.
8 * @class 8 * @class
9 */ 9 */
10 function ClearBrowserDataOverlay() { 10 function ClearBrowserDataOverlay() {
11 OptionsPage.call(this, 'clearBrowserDataOverlay', 11 OptionsPage.call(this, 'clearBrowserDataOverlay',
12 templateData.clearBrowserDataTitle, 12 templateData.clearBrowserDataTitle,
13 'clearBrowserDataOverlay'); 13 'clearBrowserDataOverlay');
14 } 14 }
15 15
16 ClearBrowserDataOverlay.throbIntervalId = 0;
17
16 cr.addSingletonGetter(ClearBrowserDataOverlay); 18 cr.addSingletonGetter(ClearBrowserDataOverlay);
17 19
18 ClearBrowserDataOverlay.prototype = { 20 ClearBrowserDataOverlay.prototype = {
19 // Inherit ClearBrowserDataOverlay from OptionsPage. 21 // Inherit ClearBrowserDataOverlay from OptionsPage.
20 __proto__: OptionsPage.prototype, 22 __proto__: OptionsPage.prototype,
21 23
22 /** 24 /**
23 * Initialize the page. 25 * Initialize the page.
24 */ 26 */
25 initializePage: function() { 27 initializePage: function() {
26 // Call base class implementation to starts preference initialization. 28 // Call base class implementation to starts preference initialization.
27 OptionsPage.prototype.initializePage.call(this); 29 OptionsPage.prototype.initializePage.call(this);
28 30
29 // TODO(csilv): add any initialization here or delete method and/or class. 31 // Setup option values for the time period select control.
32 $('clearBrowsingDataTimePeriod').initializeValues(
33 templateData.clearBrowsingDataTimeList)
34
35 // Setup click handler for the clear(Ok) button.
36 $('clearBrowsingDataCommit').onclick = function(event) {
37 chrome.send('performClearBrowserData');
38 };
30 } 39 }
31 }; 40 };
41
42 //
43 // Chrome callbacks
44 //
45 function clearBrowserDataSetClearingState(state) {
46 $('deleteBrowsingHistoryCheckbox').disabled = state;
47 $('deleteDownloadHistoryCheckbox').disabled = state;
48 $('deleteCacheCheckbox').disabled = state;
49 $('deleteCookiesCheckbox').disabled = state;
50 $('deletePasswordsCheckbox').disabled = state;
51 $('deleteFormDataCheckbox').disabled = state;
52 $('clearBrowsingDataTimePeriod').disabled = state;
53 $('clearBrowsingDataCommit').disabled = state;
54 $('clearBrowsingDataDismiss').disabled = state;
55 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden';
56
57 function advanceThrobber() {
58 var throbber = $('cbdThrobber');
59 // TODO(csilv): make this smoother using time-based animation?
60 throbber.style.backgroundPositionX =
61 ((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) %
62 576) + 'px';
63 }
64 if (state) {
65 ClearBrowserDataOverlay.throbIntervalId = setInterval(advanceThrobber, 30);
66 } else {
67 clearInterval(ClearBrowserDataOverlay.throbIntervalId);
68 }
69 }
70
71 function clearBrowserDataDismiss() {
72 OptionsPage.clearOverlays();
73 clearBrowserDataSetClearingState(false);
74 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698