Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Unified Diff: ui/file_manager/file_manager/foreground/js/import_controller.js

Issue 865343002: Files.app: Invalidate ScanResult when the scanned directory is changed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/common/js/importer_common.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/import_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/import_controller.js b/ui/file_manager/file_manager/foreground/js/import_controller.js
index 3602087bc6047b8705c4895beb89129b7995a98a..11060845a7f583511a4663d85b94e826668b1b4f 100644
--- a/ui/file_manager/file_manager/foreground/js/import_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/import_controller.js
@@ -60,7 +60,6 @@ importer.ImportController =
this.cachedScans_ = {};
this.scanner_.addObserver(this.onScanEvent_.bind(this));
-
this.environment_.addVolumeUnmountListener(
this.onVolumeUnmounted_.bind(this));
};
@@ -72,8 +71,17 @@ importer.ImportController =
* @private
*/
importer.ImportController.prototype.onScanEvent_ = function(event, result) {
- // TODO(smckay): only do this if this is a directory scan.
- if (event === importer.ScanEvent.FINALIZED) {
+ if (event === importer.ScanEvent.INVALIDATED) {
+ for (var key in this.cachedScans_) {
+ for (var url in this.cachedScans_[key]) {
+ if (this.cachedScans_[key][url].isInvalidated()) {
+ delete this.cachedScans_[key][url];
+ }
+ }
+ }
+ }
+ if (event === importer.ScanEvent.FINALIZED ||
+ event === importer.ScanEvent.INVALIDATED) {
this.updateCommands_();
}
};
@@ -104,7 +112,6 @@ importer.ImportController.prototype.execute = function() {
* @return {!importer.CommandUpdate} response
*/
importer.ImportController.prototype.getCommandUpdate = function() {
-
// If there is no Google Drive mount, Drive may be disabled
// or the machine may be running in guest mode.
if (this.environment_.isGoogleDriveMounted()) {
@@ -240,6 +247,7 @@ importer.ImportController.prototype.getCurrentDirectoryScan_ = function() {
scan = this.scanner_.scan([directory]);
this.cachedScans_[volumeId][url] = scan;
}
+ assert(!scan.isInvalidated());
return scan;
};
« no previous file with comments | « ui/file_manager/file_manager/common/js/importer_common.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698