diff options
author | yawano <yawano@chromium.org> | 2015-02-24 01:28:56 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-24 09:29:47 +0000 |
commit | 6ac9708f432c20a27b1a22aea81ee8ce05409876 (patch) | |
tree | 33982e2a32f7272c10a250092a4436b91347ad1c /ui | |
parent | 3e9eda0d59c8fd4bd2545aba92481ae5d563c81b (diff) | |
download | chromium_src-6ac9708f432c20a27b1a22aea81ee8ce05409876.zip chromium_src-6ac9708f432c20a27b1a22aea81ee8ce05409876.tar.gz chromium_src-6ac9708f432c20a27b1a22aea81ee8ce05409876.tar.bz2 |
Update the UI when spinner is shown.
Since previously the UI was not updated even after the spinner is shown, items in the previous directory were visible with a spinner. This patch changes it to update the UI in order to remove items in the previous directory when spinner becomes visible.
BUG=460405
TEST=manually tested.
Review URL: https://codereview.chromium.org/950273002
Cr-Commit-Position: refs/heads/master@{#317773}
Diffstat (limited to 'ui')
-rw-r--r-- | ui/file_manager/file_manager/foreground/js/scan_controller.js | 14 | ||||
-rw-r--r-- | ui/file_manager/file_manager/foreground/js/spinner_controller.js | 5 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ui/file_manager/file_manager/foreground/js/scan_controller.js b/ui/file_manager/file_manager/foreground/js/scan_controller.js index 49f12dc..9d65b02 100644 --- a/ui/file_manager/file_manager/foreground/js/scan_controller.js +++ b/ui/file_manager/file_manager/foreground/js/scan_controller.js @@ -104,6 +104,9 @@ function ScanController( chrome.fileManagerPrivate.onPreferencesChanged.addListener( this.onPreferencesChanged_.bind(this)); this.onPreferencesChanged_(); + + this.spinnerController_.addEventListener( + 'spinner-shown', this.onSpinnerShown_.bind(this)); } /** @@ -248,3 +251,14 @@ ScanController.prototype.onPreferencesChanged_ = function() { this.lastHostedFilesDisabled_ = prefs.hostedFilesDisabled; }.bind(this)); }; + +/** + * When a spinner is shown, updates the UI to remove items in the previous + * directory. + */ +ScanController.prototype.onSpinnerShown_ = function() { + if (this.scanInProgress_) { + this.listContainer_.endBatchUpdates(); + this.listContainer_.startBatchUpdates(); + } +}; 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 60e953d..63e72ae 100644 --- a/ui/file_manager/file_manager/foreground/js/spinner_controller.js +++ b/ui/file_manager/file_manager/foreground/js/spinner_controller.js @@ -7,6 +7,7 @@ * @param {!HTMLElement} element * @param {!DirectoryModel} directoryModel * @constructor + * @extends {cr.EventTarget} */ function SpinnerController(element, directoryModel) { /** @@ -32,6 +33,8 @@ function SpinnerController(element, directoryModel) { this.timeoutId_ = 0; } +SpinnerController.prototype.__proto__ = cr.EventTarget.prototype; + /** * Shows the spinner. */ @@ -41,6 +44,8 @@ SpinnerController.prototype.show = function() { this.element_.hidden = false; clearTimeout(this.timeoutId_); this.timeoutId_ = 0; + var spinnerShownEvent = new Event('spinner-shown'); + this.dispatchEvent(spinnerShownEvent); }; /** |