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 /** | 5 /** |
6 * The minimum about of time to display the butter bar for, in ms. | 6 * The minimum about of time to display the butter bar for, in ms. |
7 * Justification is 1000ms for minimum display time plus 300ms for transition | 7 * Justification is 1000ms for minimum display time plus 300ms for transition |
8 * duration. | 8 * duration. |
9 */ | 9 */ |
10 var MINIMUM_BUTTER_DISPLAY_TIME_MS = 1300; | 10 var MINIMUM_BUTTER_DISPLAY_TIME_MS = 1300; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 this.show(loadTimeData.getString('downloadCanceled'), {timeout: 1000}); | 251 this.show(loadTimeData.getString('downloadCanceled'), {timeout: 1000}); |
252 this.xhr_ = null; | 252 this.xhr_ = null; |
253 }; | 253 }; |
254 | 254 |
255 /** | 255 /** |
256 * Hides butter bar when download complete. | 256 * Hides butter bar when download complete. |
257 * @private | 257 * @private |
258 * @param {Event} e A load ProgressEvent from XMLHttpRequest. | 258 * @param {Event} e A load ProgressEvent from XMLHttpRequest. |
259 */ | 259 */ |
260 ButterBar.prototype.onDownloadComplete_ = function(e) { | 260 ButterBar.prototype.onDownloadComplete_ = function(e) { |
261 this.hide_(); | 261 var options = {progress: 100, actions: {}, timeout: 0}; |
262 var progressString = 'Loading'; | |
Nikita (slow)
2012/10/15 15:14:11
String should be localized.
bshe
2012/10/17 00:13:51
Pre discussion with kuscher, we just want to show
| |
263 this.show(progressString, options); | |
262 this.xhr_ = null; | 264 this.xhr_ = null; |
263 }; | 265 }; |
264 | 266 |
265 /** | 267 /** |
266 * Shows error message when receiving an error event. | 268 * Shows error message when receiving an error event. |
267 * @private | 269 * @private |
268 * @param {Event} e An error ProgressEvent from XMLHttpRequest. | 270 * @param {Event} e An error ProgressEvent from XMLHttpRequest. |
269 */ | 271 */ |
270 ButterBar.prototype.onDownloadError_ = function(e) { | 272 ButterBar.prototype.onDownloadError_ = function(e) { |
271 this.showError_(loadTimeData.getString('downloadFailed')); | 273 this.showError_(loadTimeData.getString('downloadFailed')); |
272 this.xhr_ = null; | 274 this.xhr_ = null; |
273 }; | 275 }; |
274 | 276 |
275 /** | 277 /** |
276 * Calculates downloading percentage and shows downloading progress. | 278 * Calculates downloading percentage and shows downloading progress. |
277 * @private | 279 * @private |
278 * @param {Event} e A progress ProgressEvent from XMLHttpRequest. | 280 * @param {Event} e A progress ProgressEvent from XMLHttpRequest. |
279 */ | 281 */ |
280 ButterBar.prototype.onDownloadProgress_ = function(e) { | 282 ButterBar.prototype.onDownloadProgress_ = function(e) { |
281 if (e.lengthComputable) { | 283 if (e.lengthComputable) { |
282 this.percentComplete_ = e.loaded / e.total; | 284 this.percentComplete_ = e.loaded / e.total; |
283 } | 285 } |
284 this.showProgress_(); | 286 this.showProgress_(); |
285 }; | 287 }; |
OLD | NEW |