summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 14:56:01 +0000
committeryoshiki@chromium.org <yoshiki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-08 14:56:01 +0000
commit38d7cd0e7e76ec2c1c7cb0c0d793451575ad76db (patch)
tree177f54c94a92db5001586127d39f385c45255154
parent6cfd71b7734d21322f71d9639396392c92ad0ee3 (diff)
downloadchromium_src-38d7cd0e7e76ec2c1c7cb0c0d793451575ad76db.zip
chromium_src-38d7cd0e7e76ec2c1c7cb0c0d793451575ad76db.tar.gz
chromium_src-38d7cd0e7e76ec2c1c7cb0c0d793451575ad76db.tar.bz2
CrOS Files.app: avoid unnecessary operation if the tree is hidden
We can skip the handler except changing current directory if the tree is hidden. BUG=none TEST=manual R=mtomasz@chromium.org Review URL: https://codereview.chromium.org/15005006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198899 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/file_manager/js/sidebar.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/chrome/browser/resources/file_manager/js/sidebar.js b/chrome/browser/resources/file_manager/js/sidebar.js
index ed421bc..088f3ed 100644
--- a/chrome/browser/resources/file_manager/js/sidebar.js
+++ b/chrome/browser/resources/file_manager/js/sidebar.js
@@ -714,6 +714,10 @@ DirectoryTree.prototype.redraw = function(recursive) {
* @private
*/
DirectoryTree.prototype.onFilterChanged_ = function() {
+ // Returns immediately, if the tree is hidden.
+ if (!this.currentPath_ || DirectoryTreeUtil.shouldHideTree(this.currentPath_))
+ return;
+
this.redraw(true /* recursive */);
cr.dispatchSimpleEvent(this, 'content-updated');
};
@@ -724,6 +728,10 @@ DirectoryTree.prototype.onFilterChanged_ = function() {
* @private
*/
DirectoryTree.prototype.onDirectoryContentChanged_ = function(event) {
+ // Returns immediately, if the tree is hidden.
+ if (!this.currentPath_ || DirectoryTreeUtil.shouldHideTree(this.currentPath_))
+ return;
+
if (event.eventType == 'changed') {
var path = util.extractFilePath(event.directoryUrl);
DirectoryTreeUtil.updateChangedDirectoryItem(path, this);