Index: ui/file_manager/file_manager/foreground/js/spinner_controller.js |
diff --git a/ui/file_manager/file_manager/foreground/js/spinner_controller.js b/ui/file_manager/file_manager/foreground/js/spinner_controller.js |
index 63e72ae070ce6a7000a549777b2f61ae5589eb6d..f460d5de7fee429c98723875ccf3004bde9a27e5 100644 |
--- a/ui/file_manager/file_manager/foreground/js/spinner_controller.js |
+++ b/ui/file_manager/file_manager/foreground/js/spinner_controller.js |
@@ -5,11 +5,10 @@ |
/** |
* Controller for spinner. |
* @param {!HTMLElement} element |
- * @param {!DirectoryModel} directoryModel |
* @constructor |
* @extends {cr.EventTarget} |
*/ |
-function SpinnerController(element, directoryModel) { |
+function SpinnerController(element) { |
/** |
* The container element of the file list. |
* @type {!HTMLElement} |
@@ -19,14 +18,6 @@ function SpinnerController(element, directoryModel) { |
this.element_ = element; |
/** |
- * Directory model. |
- * @type {!DirectoryModel} |
- * @const |
- * @private |
- */ |
- this.directoryModel_ = directoryModel; |
- |
- /** |
* @type {number} |
* @private |
*/ |
@@ -36,12 +27,22 @@ function SpinnerController(element, directoryModel) { |
SpinnerController.prototype.__proto__ = cr.EventTarget.prototype; |
/** |
- * Shows the spinner. |
+ * Blinks the spinner for a short period of time. |
+ */ |
+SpinnerController.prototype.blink = function() { |
hirono
2015/07/06 04:52:38
Can we hide blinking spinner when the current dire
mtomasz
2015/07/06 08:48:48
Do we need to hide it? Blinking is only one second
hirono
2015/07/06 09:39:27
I think it is worth to handle it. I'm guessing the
mtomasz
2015/07/07 03:42:10
Sebastien said he's fine with blinking the spinner
hirono
2015/07/07 03:58:22
SGTM. Thank you for confirming!
|
+ this.element_.hidden = false; |
+ clearTimeout(this.blinkHideTimeoutId_); |
+ this.blinkHideTimeoutId_ = 0; |
hirono
2015/07/06 04:52:38
Is this line needed?
mtomasz
2015/07/06 08:48:48
Done.
|
+ this.blinkHideTimeoutId_ = setTimeout(this.hide.bind(this), 1000); |
+}; |
+ |
+/** |
+ * Shows the spinner until hide is called. |
*/ |
SpinnerController.prototype.show = function() { |
- if (!this.directoryModel_.isScanning()) |
- return; |
this.element_.hidden = false; |
+ clearTimeout(this.blinkHideTimeoutId_); |
+ this.blinkHideTimeoutId_ = 0; |
clearTimeout(this.timeoutId_); |
this.timeoutId_ = 0; |
var spinnerShownEvent = new Event('spinner-shown'); |
@@ -52,17 +53,15 @@ SpinnerController.prototype.show = function() { |
* Hides the spinner. |
*/ |
SpinnerController.prototype.hide = function() { |
- if (this.directoryModel_.isScanning() && |
- this.directoryModel_.getFileList().length == 0) { |
- return; |
- } |
this.element_.hidden = true; |
clearTimeout(this.timeoutId_); |
this.timeoutId_ = 0; |
+ clearTimeout(this.blinkHideTimeoutId_); |
+ this.blinkHideTimeoutId_ = 0; |
}; |
/** |
- * Shows the spinner after 500ms. |
+ * Shows the spinner after 500ms (unless it's already visible). |
*/ |
SpinnerController.prototype.showLater = function() { |
if (!this.element_.hidden) |
hirono
2015/07/06 09:39:27
I think we should clear blinkHideTimeout here.
bl
mtomasz
2015/07/07 03:42:11
Good point. Done.
|