Commit 76d39f0f authored by Luciano Pacheco's avatar Luciano Pacheco Committed by Commit Bot

Stop sending unnecessary metadata requests to FS providers

Update DirectoryModel.clearAndScan_ to stop requesting previous
directory's content metadata, that caused issue 867974 where we were
sending too many metadata requests.

However we still need to fetch metadata for the currently selected
directory so is available to use by menu/commands.

Change the File Manager CommandHandler to update all commands
when the metadata gets updated. This fixes the commands that should be
disabled based on metadata properties canCopy, canCut, can*.

Bug: 867974
Change-Id: I5254f70b8993a6e9b536f53543d1f3ed2ca0d87f
Reviewed-on: https://chromium-review.googlesource.com/1161843Reviewed-by: default avatarStuart Langley <slangley@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580511}
parent 31594a03
......@@ -102,3 +102,8 @@ CommandHandlerDeps.prototype.getCurrentDirectoryEntry = function() {};
* @return {FileSelection}
*/
CommandHandlerDeps.prototype.getSelection = function() {};
/**
* @type {MetadataModel}
*/
CommandHandlerDeps.prototype.metadataModel;
......@@ -563,9 +563,9 @@ DirectoryModel.prototype.clearAndScan_ = function(newDirContents,
}
this.metadataModel_.notifyEntriesRemoved(removedUrls);
// Retrieve metadata information for the new (visible) items in the list.
// Retrieve metadata information for the new directory.
this.metadataModel_.get(
newDirContents.fileList_.array_,
[this.currentDirContents_.getDirectoryEntry()],
constants.LIST_CONTAINER_METADATA_PREFETCH_PROPERTY_NAMES);
// Clear the table, and start scanning.
......
......@@ -349,6 +349,8 @@ var CommandHandler = function(fileManager, selectionHandler) {
selectionHandler.addEventListener(
FileSelectionHandler.EventType.CHANGE_THROTTLED,
this.updateAvailability.bind(this));
fileManager.metadataModel.addEventListener(
'update', this.updateAvailability.bind(this));
chrome.commandLinePrivate.hasSwitch(
'disable-zip-archiver-packer', function(disabled) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment