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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 this.butter_.querySelector('.butter-message').textContent = message; | 112 this.butter_.querySelector('.butter-message').textContent = message; |
113 if (message && !this.isVisible_()) { | 113 if (message && !this.isVisible_()) { |
114 // The butter bar is made visible on the first non-empty message. | 114 // The butter bar is made visible on the first non-empty message. |
115 this.butter_.classList.add('visible'); | 115 this.butter_.classList.add('visible'); |
116 this.lastShowTime_ = Date.now(); | 116 this.lastShowTime_ = Date.now(); |
117 } | 117 } |
118 if (opt_options && 'progress' in opt_options) { | 118 if (opt_options && 'progress' in opt_options) { |
119 this.butter_.querySelector('.progress-track').style.width = | 119 this.butter_.querySelector('.progress-track').style.width = |
120 (opt_options.progress * 100) + '%'; | 120 (opt_options.progress * 100) + '%'; |
121 } | 121 } |
122 | |
123 this.butter_.style.left = | |
124 (this.dialogDom_.clientWidth - this.butter_.clientWidth) / 2 + 'px'; | |
125 }; | 122 }; |
126 | 123 |
127 /** | 124 /** |
128 * Hide butter bar. There might be some delay before hiding so that butter bar | 125 * Hide butter bar. There might be some delay before hiding so that butter bar |
129 * would be shown for no less than the minimal time. | 126 * would be shown for no less than the minimal time. |
130 * @param {boolean} opt_force If true hide immediately. | 127 * @param {boolean} opt_force If true hide immediately. |
131 * @private | 128 * @private |
132 */ | 129 */ |
133 ButterBar.prototype.hide_ = function(opt_force) { | 130 ButterBar.prototype.hide_ = function(opt_force) { |
134 this.clearHideTimeout_(); | 131 this.clearHideTimeout_(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 } else { | 271 } else { |
275 this.showError_(strf(this.transferType_() + '_UNEXPECTED_ERROR', | 272 this.showError_(strf(this.transferType_() + '_UNEXPECTED_ERROR', |
276 event.error)); | 273 event.error)); |
277 } | 274 } |
278 break; | 275 break; |
279 | 276 |
280 default: | 277 default: |
281 console.log('Unknown "copy-progress" event reason: ' + event.reason); | 278 console.log('Unknown "copy-progress" event reason: ' + event.reason); |
282 } | 279 } |
283 }; | 280 }; |
OLD | NEW |