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

Unified Diff: chrome/browser/chromeos/drive/change_list_processor.cc

Issue 343073003: Files.app: Provide detailed change information on onDirectoryChanged event (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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: chrome/browser/chromeos/drive/change_list_processor.cc
diff --git a/chrome/browser/chromeos/drive/change_list_processor.cc b/chrome/browser/chromeos/drive/change_list_processor.cc
index 310b3b21b669f68ab38dd3b9c08313c3d6236a94..40c2ea1019dc36a1ab26df0f4192b20a3456e0ff 100644
--- a/chrome/browser/chromeos/drive/change_list_processor.cc
+++ b/chrome/browser/chromeos/drive/change_list_processor.cc
@@ -7,6 +7,7 @@
#include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/chromeos/drive/drive.pb.h"
+#include "chrome/browser/chromeos/drive/file_change.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
#include "chrome/browser/chromeos/drive/resource_metadata.h"
@@ -113,7 +114,7 @@ ChangeList::ChangeList(const google_apis::FileList& file_list)
ChangeList::~ChangeList() {}
ChangeListProcessor::ChangeListProcessor(ResourceMetadata* resource_metadata)
- : resource_metadata_(resource_metadata) {
+ : resource_metadata_(resource_metadata), changed_files_(new FileChange) {
}
ChangeListProcessor::~ChangeListProcessor() {
@@ -480,21 +481,9 @@ void ChangeListProcessor::UpdateChangedDirs(const ResourceEntry& entry) {
resource_metadata_->GetFilePath(local_id, &file_path);
if (!file_path.empty()) {
- // Notify parent.
- changed_dirs_.insert(file_path.DirName());
-
- if (entry.file_info().is_directory()) {
- // Notify self if entry is a directory.
- changed_dirs_.insert(file_path);
-
- // Notify all descendants if it is a directory deletion.
- if (entry.deleted()) {
- std::set<base::FilePath> sub_directories;
- resource_metadata_->GetSubDirectoriesRecursively(local_id,
- &sub_directories);
- changed_dirs_.insert(sub_directories.begin(), sub_directories.end());
- }
- }
+ FileChange::ChangeType type =
+ entry.deleted() ? FileChange::DELETE : FileChange::ADD_OR_UPDATE;
+ changed_files_->Update(file_path, entry, type);
}
}
« no previous file with comments | « chrome/browser/chromeos/drive/change_list_processor.h ('k') | chrome/browser/chromeos/drive/change_list_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698