Index: chrome/browser/resources/file_manager/js/file_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
index 9e1e42ca341cb67d402581930e969cf058e4d951..fb6c2c863f6701cc478f4fd1975fe53792de6937 100644 |
--- a/chrome/browser/resources/file_manager/js/file_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_manager.js |
@@ -438,6 +438,7 @@ FileManager.prototype = { |
}); |
dm.addEventListener('scan-started', this.showSpinnerLater_.bind(this)); |
dm.addEventListener('scan-completed', this.showSpinner_.bind(this, false)); |
+ dm.addEventListener('scan-cancelled', this.hideSpinnerLater_.bind(this)); |
dm.addEventListener('scan-completed', |
this.refreshCurrentDirectoryMetadata_.bind(this)); |
dm.addEventListener('rescan-completed', |
@@ -3235,15 +3236,22 @@ FileManager.prototype = { |
setTimeout(this.showSpinner_.bind(this, true), 500); |
}; |
+ FileManager.prototype.hideSpinnerLater_ = function() { |
+ setTimeout(this.showSpinner_.bind(this, false), 100); |
+ }; |
+ |
FileManager.prototype.showSpinner_ = function(on) { |
- this.cancelSpinnerTimeout_(); |
- if (on) { |
+ if (on && this.directoryModel_ && this.directoryModel_.isScanning()) { |
if (this.directoryModel_.isSearching()) { |
this.dialogContainer_.classList.add('searching'); |
+ this.spinner_.style.display = 'none'; |
} else { |
this.spinner_.style.display = ''; |
+ this.dialogContainer_.classList.remove('searching'); |
} |
- } else { |
+ } |
+ |
+ if (!on && (!this.directoryModel_ || !this.directoryModel_.isScanning())) { |
this.spinner_.style.display = 'none'; |
if (this.dialogContainer_) |
this.dialogContainer_.classList.remove('searching'); |