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

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

Issue 23258006: drive: Move RefreshDirectory from ResourceMetadata to ChangeListLoader (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 7 years, 4 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.h
diff --git a/chrome/browser/chromeos/drive/change_list_processor.h b/chrome/browser/chromeos/drive/change_list_processor.h
index 44243009a85d9f55ce8a001275534d7dbdc7cd06..ed921ae4c5717f8d16061a4239931389b9f880fe 100644
--- a/chrome/browser/chromeos/drive/change_list_processor.h
+++ b/chrome/browser/chromeos/drive/change_list_processor.h
@@ -28,6 +28,35 @@ namespace internal {
class ResourceMetadata;
+// Holds information needed to fetch contents of a directory.
+// This object is copyable.
+class DirectoryFetchInfo {
+ public:
+ DirectoryFetchInfo() : changestamp_(0) {}
+ DirectoryFetchInfo(const std::string& resource_id,
+ int64 changestamp)
+ : resource_id_(resource_id),
+ changestamp_(changestamp) {
+ }
+
+ // Returns true if the object is empty.
+ bool empty() const { return resource_id_.empty(); }
+
+ // Resource ID of the directory.
+ const std::string& resource_id() const { return resource_id_; }
+
+ // Changestamp of the directory. The changestamp is used to determine if
+ // the directory contents should be fetched.
+ int64 changestamp() const { return changestamp_; }
+
+ // Returns a string representation of this object.
+ std::string ToString() const;
+
+ private:
+ const std::string resource_id_;
+ const int64 changestamp_;
+};
+
// Class to represent a change list.
class ChangeList {
public:
@@ -82,6 +111,14 @@ class ChangeListProcessor {
// The set of changed directories as a result of change list processing.
const std::set<base::FilePath>& changed_dirs() const { return changed_dirs_; }
+ // Updates the changestamp of a directory according to |directory_fetch_info|
+ // and adds or refreshes the child entries from |entry_map|.
+ static FileError RefreshDirectory(
+ ResourceMetadata* resource_metadata,
+ const DirectoryFetchInfo& directory_fetch_info,
+ const ResourceEntryMap& entry_map,
+ base::FilePath* out_file_path);
+
private:
// Applies the pre-processed metadata from entry_map_ onto the resource
// metadata. If this is not delta update (i.e. |is_delta_update| is false),
« no previous file with comments | « chrome/browser/chromeos/drive/change_list_loader_unittest.cc ('k') | chrome/browser/chromeos/drive/change_list_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698