Index: chrome/browser/chromeos/drive/file_system.cc |
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc |
index eb3069ea63e7ca31076874978a8a28d4fcbbb6e1..5f158b85327442de8a50d440ab31309339fd6422 100644 |
--- a/chrome/browser/chromeos/drive/file_system.cc |
+++ b/chrome/browser/chromeos/drive/file_system.cc |
@@ -11,6 +11,7 @@ |
#include "chrome/browser/chromeos/drive/directory_loader.h" |
#include "chrome/browser/chromeos/drive/drive.pb.h" |
#include "chrome/browser/chromeos/drive/file_cache.h" |
+#include "chrome/browser/chromeos/drive/file_change.h" |
#include "chrome/browser/chromeos/drive/file_system/copy_operation.h" |
#include "chrome/browser/chromeos/drive/file_system/create_directory_operation.h" |
#include "chrome/browser/chromeos/drive/file_system/create_file_operation.h" |
@@ -789,8 +790,10 @@ void FileSystem::SearchMetadata(const std::string& query, |
} |
void FileSystem::OnDirectoryChangedByOperation( |
- const base::FilePath& directory_path) { |
- OnDirectoryChanged(directory_path); |
+ const FileChange& changed_files) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ |
+ OnDirectoryChanged(changed_files); |
} |
void FileSystem::OnEntryUpdatedByOperation(const std::string& local_id) { |
@@ -824,11 +827,31 @@ void FileSystem::OnDriveSyncErrorAfterGetFilePath( |
OnDriveSyncError(type, *file_path)); |
} |
-void FileSystem::OnDirectoryChanged(const base::FilePath& directory_path) { |
+void FileSystem::OnDirectoryReloaded(const base::FilePath& directory_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- FOR_EACH_OBSERVER(FileSystemObserver, observers_, |
- OnDirectoryChanged(directory_path)); |
+ FOR_EACH_OBSERVER( |
+ FileSystemObserver, observers_, OnDirectoryChanged(directory_path, NULL)); |
+} |
+ |
+void FileSystem::OnDirectoryChanged(const FileChange& changed_files) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ typedef std::map<base::FilePath, FileChange> FileChangeMap; |
+ |
+ FileChangeMap map; |
+ const FileChange::Map& changed_file_map = changed_files.map(); |
+ for (FileChange::Map::const_iterator it = changed_file_map.begin(); |
+ it != changed_file_map.end(); |
+ it++) { |
+ const base::FilePath& path = it->first; |
+ map[path.DirName()].Update(path, it->second); |
+ } |
+ |
kinaba
2014/06/23 05:37:43
What about moving this dispatch-by-directory code
yoshiki
2014/06/24 02:02:22
Done.
|
+ for (FileChangeMap::const_iterator it = map.begin(); it != map.end(); it++) { |
+ FOR_EACH_OBSERVER(FileSystemObserver, |
+ observers_, |
+ OnDirectoryChanged(it->first, &(it->second))); |
+ } |
} |
void FileSystem::OnLoadFromServerComplete() { |