OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * ClearBrowserDataOverlay class | 10 * ClearBrowserDataOverlay class |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 $('deleteCookiesCheckbox').disabled = state; | 83 $('deleteCookiesCheckbox').disabled = state; |
84 $('deletePasswordsCheckbox').disabled = state; | 84 $('deletePasswordsCheckbox').disabled = state; |
85 $('deleteFormDataCheckbox').disabled = state; | 85 $('deleteFormDataCheckbox').disabled = state; |
86 $('clearBrowserDataTimePeriod').disabled = state; | 86 $('clearBrowserDataTimePeriod').disabled = state; |
87 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden'; | 87 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden'; |
88 | 88 |
89 if (state) | 89 if (state) |
90 $('clearBrowserDataCommit').disabled = true; | 90 $('clearBrowserDataCommit').disabled = true; |
91 else | 91 else |
92 ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); | 92 ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); |
93 | |
94 function advanceThrobber() { | |
95 var throbber = $('cbdThrobber'); | |
96 // TODO(csilv): make this smoother using time-based animation? | |
97 throbber.style.backgroundPositionX = | |
98 ((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) % | |
99 576) + 'px'; | |
100 } | |
101 if (state) { | |
102 ClearBrowserDataOverlay.throbIntervalId = | |
103 setInterval(advanceThrobber, 30); | |
104 } else { | |
105 clearInterval(ClearBrowserDataOverlay.throbIntervalId); | |
106 } | |
107 }; | 93 }; |
108 | 94 |
109 ClearBrowserDataOverlay.setClearLocalDataLabel = function(label) { | 95 ClearBrowserDataOverlay.setClearLocalDataLabel = function(label) { |
110 $('deleteCookiesLabel').innerText = label; | 96 $('deleteCookiesLabel').innerText = label; |
111 }; | 97 }; |
112 | 98 |
113 ClearBrowserDataOverlay.doneClearing = function() { | 99 ClearBrowserDataOverlay.doneClearing = function() { |
114 // The delay gives the user some feedback that the clearing | 100 // The delay gives the user some feedback that the clearing |
115 // actually worked. Otherwise the dialog just vanishes instantly in most | 101 // actually worked. Otherwise the dialog just vanishes instantly in most |
116 // cases. | 102 // cases. |
117 window.setTimeout(function() { | 103 window.setTimeout(function() { |
118 ClearBrowserDataOverlay.dismiss(); | 104 ClearBrowserDataOverlay.dismiss(); |
119 }, 200); | 105 }, 200); |
120 }; | 106 }; |
121 | 107 |
122 ClearBrowserDataOverlay.dismiss = function() { | 108 ClearBrowserDataOverlay.dismiss = function() { |
123 OptionsPage.clearOverlays(); | 109 OptionsPage.clearOverlays(); |
124 this.setClearingState(false); | 110 this.setClearingState(false); |
125 }; | 111 }; |
126 | 112 |
127 // Export | 113 // Export |
128 return { | 114 return { |
129 ClearBrowserDataOverlay: ClearBrowserDataOverlay | 115 ClearBrowserDataOverlay: ClearBrowserDataOverlay |
130 }; | 116 }; |
131 }); | 117 }); |
OLD | NEW |