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

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

Issue 892083004: Files.app: Use new metadata models in DirectoryModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 10 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
Index: ui/file_manager/file_manager/foreground/js/directory_model.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js
index 5d7aa4ec143317e40b4299944df75ebb355ed5bd..75b47d1b81bf93ec75cf2b3bbc566d67b2ee0e8b 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_model.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -16,13 +16,16 @@ var SHORT_RESCAN_INTERVAL = 100;
* @param {FileFilter} fileFilter Instance of FileFilter.
* @param {FileWatcher} fileWatcher Instance of FileWatcher.
* @param {MetadataCache} metadataCache The metadata cache service.
+ * @param {!FileSystemMetadata} fileSystemMetadata The metadata cache
+ * service.
* @param {VolumeManagerWrapper} volumeManager The volume manager.
* @param {!FileOperationManager} fileOperationManager File operation manager.
* @constructor
* @extends {cr.EventTarget}
*/
-function DirectoryModel(singleSelection, fileFilter, fileWatcher,
- metadataCache, volumeManager, fileOperationManager) {
+function DirectoryModel(singleSelection, fileFilter, fileWatcher, metadataCache,
+ fileSystemMetadata, volumeManager,
+ fileOperationManager) {
this.fileListSelection_ = singleSelection ?
new cr.ui.ListSingleSelectionModel() : new cr.ui.ListSelectionModel();
@@ -46,6 +49,7 @@ function DirectoryModel(singleSelection, fileFilter, fileWatcher,
DirectoryContents.createForDirectory(this.currentFileListContext_, null);
this.metadataCache_ = metadataCache;
+ this.fileSystemMetadata_ = fileSystemMetadata;
this.volumeManager_ = volumeManager;
this.volumeManager_.volumeInfoList.addEventListener(
@@ -821,6 +825,7 @@ DirectoryModel.prototype.createDirectory = function(name,
return;
}
+ var dirContents = this.currentDirContents_;
var sequence = this.changeDirectorySequence_;
new Promise(entry.getDirectory.bind(
@@ -829,10 +834,10 @@ DirectoryModel.prototype.createDirectory = function(name,
then(function(newEntry) {
// Refresh the cache.
this.metadataCache_.clear([newEntry], '*');
+ this.fileSystemMetadata_.notifyEntryCreated([newEntry]);
return new Promise(function(onFulfilled, onRejected) {
- this.metadataCache_.getOne(newEntry,
- 'filesystem',
- onFulfilled.bind(null, newEntry));
+ dirContents.prefetchMetadata(
+ [newEntry], false, onFulfilled.bind(null, newEntry));
}.bind(this));
}.bind(this)).

Powered by Google App Engine
This is Rietveld 408576698