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

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

Issue 6110006: give tabbed options clear browsing dialog a facelift (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete bugs Created 9 years, 11 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 cr.define('options', function() { 5 cr.define('options', function() {
6 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 8
9 /** 9 /**
10 * ClearBrowserData class 10 * ClearBrowserData class
11 * Encapsulated handling of the 'Clear Browser Data' overlay page. 11 * Encapsulated handling of the 'Clear Browser Data' overlay page.
12 * @class 12 * @class
13 */ 13 */
14 function ClearBrowserDataOverlay() { 14 function ClearBrowserDataPage() {
15 OptionsPage.call(this, 'clearBrowserDataOverlay', 15 OptionsPage.call(this, 'clearBrowserDataPage',
16 templateData.clearBrowserDataTitle, 16 templateData.clearBrowserDataTitle,
17 'clearBrowserDataOverlay'); 17 'clearBrowserDataPage');
18 } 18 }
19 19
20 ClearBrowserDataOverlay.throbIntervalId = 0; 20 ClearBrowserDataPage.throbIntervalId = 0;
21 21
22 cr.addSingletonGetter(ClearBrowserDataOverlay); 22 cr.addSingletonGetter(ClearBrowserDataPage);
23 23
24 ClearBrowserDataOverlay.prototype = { 24 ClearBrowserDataPage.prototype = {
25 // Inherit ClearBrowserDataOverlay from OptionsPage. 25 // Inherit ClearBrowserDataPage from OptionsPage.
26 __proto__: OptionsPage.prototype, 26 __proto__: OptionsPage.prototype,
27 27
28 /** 28 /**
29 * Initialize the page. 29 * Initialize the page.
30 */ 30 */
31 initializePage: function() { 31 initializePage: function() {
32 // Call base class implementation to starts preference initialization. 32 // Call base class implementation to starts preference initialization.
33 OptionsPage.prototype.initializePage.call(this); 33 OptionsPage.prototype.initializePage.call(this);
34 34
35 // The time period is stored as a number.
36 $('clearBrowsingDataTimePeriod').dataType = 'number';
37
35 var f = this.updateCommitButtonState_.bind(this); 38 var f = this.updateCommitButtonState_.bind(this);
36 var types = ['browser.clear_data.browsing_history', 39 var types = ['browser.clear_data.browsing_history',
37 'browser.clear_data.download_history', 40 'browser.clear_data.download_history',
38 'browser.clear_data.cache', 41 'browser.clear_data.cache',
39 'browser.clear_data.cookies', 42 'browser.clear_data.cookies',
40 'browser.clear_data.passwords', 43 'browser.clear_data.passwords',
41 'browser.clear_data.form_data']; 44 'browser.clear_data.form_data'];
42 types.forEach(function(type) { 45 types.forEach(function(type) {
43 Preferences.getInstance().addEventListener(type, f); 46 Preferences.getInstance().addEventListener(type, f);
44 }); 47 });
(...skipping 22 matching lines...) Expand all
67 break; 70 break;
68 } 71 }
69 } 72 }
70 $('clearBrowsingDataCommit').disabled = !isChecked; 73 $('clearBrowsingDataCommit').disabled = !isChecked;
71 }, 74 },
72 }; 75 };
73 76
74 // 77 //
75 // Chrome callbacks 78 // Chrome callbacks
76 // 79 //
77 ClearBrowserDataOverlay.setClearingState = function(state) { 80 ClearBrowserDataPage.setClearingState = function(state) {
78 $('deleteBrowsingHistoryCheckbox').disabled = state; 81 $('deleteBrowsingHistoryCheckbox').disabled = state;
79 $('deleteDownloadHistoryCheckbox').disabled = state; 82 $('deleteDownloadHistoryCheckbox').disabled = state;
80 $('deleteCacheCheckbox').disabled = state; 83 $('deleteCacheCheckbox').disabled = state;
81 $('deleteCookiesCheckbox').disabled = state; 84 $('deleteCookiesCheckbox').disabled = state;
82 $('deletePasswordsCheckbox').disabled = state; 85 $('deletePasswordsCheckbox').disabled = state;
83 $('deleteFormDataCheckbox').disabled = state; 86 $('deleteFormDataCheckbox').disabled = state;
84 $('clearBrowsingDataTimePeriod').disabled = state; 87 $('clearBrowsingDataTimePeriod').disabled = state;
85 $('clearBrowsingDataDismiss').disabled = state;
86 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden'; 88 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden';
87 89
88 if (state) 90 if (state)
89 $('clearBrowsingDataCommit').disabled = true; 91 $('clearBrowsingDataCommit').disabled = true;
90 else 92 else
91 ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); 93 ClearBrowserDataPage.getInstance().updateCommitButtonState_();
92 94
93 function advanceThrobber() { 95 function advanceThrobber() {
94 var throbber = $('cbdThrobber'); 96 var throbber = $('cbdThrobber');
95 // TODO(csilv): make this smoother using time-based animation? 97 // TODO(csilv): make this smoother using time-based animation?
96 throbber.style.backgroundPositionX = 98 throbber.style.backgroundPositionX =
97 ((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) % 99 ((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) %
98 576) + 'px'; 100 576) + 'px';
99 } 101 }
100 if (state) { 102 if (state) {
101 ClearBrowserDataOverlay.throbIntervalId = 103 ClearBrowserDataPage.throbIntervalId =
102 setInterval(advanceThrobber, 30); 104 setInterval(advanceThrobber, 30);
103 } else { 105 } else {
104 clearInterval(ClearBrowserDataOverlay.throbIntervalId); 106 clearInterval(ClearBrowserDataPage.throbIntervalId);
105 } 107 }
106 } 108 }
107 109
108 ClearBrowserDataOverlay.dismiss = function() { 110 ClearBrowserDataPage.dismiss = function() {
109 OptionsPage.clearOverlays(); 111 OptionsPage.clearOverlays();
110 this.setClearingState(false); 112 this.setClearingState(false);
111 } 113 }
112 114
113 // Export 115 // Export
114 return { 116 return {
115 ClearBrowserDataOverlay: ClearBrowserDataOverlay 117 ClearBrowserDataPage: ClearBrowserDataPage
116 }; 118 };
117 119
118 }); 120 });
119 121
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698