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

Unified Diff: chrome/browser/chromeos/gdata/gdata_files.cc

Issue 10444082: Refresh drive file system metadata for entries in search results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a nit Created 8 years, 7 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/gdata/gdata_files.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc
index b402c7bcdcc1b82f557140d355b60bc471ba9056..663cda052dcfc9258bb8811eb8b5342d6cee31a7 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.cc
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc
@@ -543,6 +543,22 @@ void GDataRootDirectory::FindEntryByPath(const FilePath& file_path,
callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, NULL);
}
+void GDataRootDirectory::RefreshFile(scoped_ptr<GDataEntry> fresh_entry) {
+ DCHECK(fresh_entry.get());
+ DCHECK(fresh_entry->AsGDataFile());
+
+ GDataEntry* old_entry = GetEntryByResourceId(fresh_entry->resource_id());
+ GDataDirectory* entry_parent = old_entry ? old_entry->parent() : NULL;
+
+ if (entry_parent) {
+ DCHECK_EQ(fresh_entry->resource_id(), old_entry->resource_id());
+ DCHECK(old_entry->AsGDataFile());
+
+ entry_parent->RemoveEntry(old_entry);
+ entry_parent->AddEntry(fresh_entry.release());
+ }
+}
+
GDataEntry* GDataRootDirectory::GetEntryByResourceId(
const std::string& resource) {
// GDataFileSystem has already locked.

Powered by Google App Engine
This is Rietveld 408576698