Chromium Code Reviews| Index: chrome/browser/chromeos/drive/drive_resource_metadata.h |
| =================================================================== |
| --- chrome/browser/chromeos/drive/drive_resource_metadata.h (revision 167238) |
| +++ chrome/browser/chromeos/drive/drive_resource_metadata.h (working copy) |
| @@ -6,6 +6,7 @@ |
| #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_RESOURCE_METADATA_H_ |
| #include <map> |
| +#include <set> |
| #include <string> |
| #include <vector> |
| @@ -89,6 +90,10 @@ |
| scoped_ptr<DriveEntryProto> entry_proto)> |
| GetEntryInfoWithFilePathCallback; |
| +// Used to get a set of changed directories for feed processing. |
| +typedef base::Callback<void(const std::set<FilePath>&)> |
| + ChangedDirectoriesCallback; |
| + |
| // This is a part of EntryInfoPairResult. |
| struct EntryInfoResult { |
| EntryInfoResult(); |
| @@ -224,11 +229,16 @@ |
| const FilePath& second_path, |
| const GetEntryInfoPairCallback& callback); |
| - // Replaces a file entry with the same resource id as |doc_entry| by deleting |
| - // the existing entry, creating a new DriveFile from |doc_entry|, and adding |
| - // it to the parent of the old entry. For directories, this just returns the |
| - // existing directory proto. |callback| is run with the error, file path and |
| - // proto of the entry. |callback| must not be null. |
| + // Refreshes a drive entry with the same resource id as |entry_proto|. |
| + // |callback| is run with the error, file path and proto of the entry. |
| + // |callback| must not be null. |
| + void RefreshEntryProto(const DriveEntryProto& entry_proto, |
| + const GetEntryInfoWithFilePathCallback& callback); |
| + |
| + // Refresh a drive entry with resource_id that matches that of |doc_entry|, |
| + // with |doc_entry|. |
| + // |callback| must not be null. |
| + // TODO(achuith): Deprecate this in favor of RefreshEntryProto above. |
| void RefreshFile(scoped_ptr<google_apis::DocumentEntry> doc_entry, |
| const GetEntryInfoWithFilePathCallback& callback); |
| @@ -239,9 +249,27 @@ |
| const DriveEntryProtoMap& entry_proto_map, |
| const FileMoveCallback& callback); |
| + // Add |entry_proto| to the metadata tree. |
| + // |callback| must not be null. |
| + void AddEntryToParent(const DriveEntryProto& entry_proto, |
|
hashimoto
2012/11/14 10:15:56
Why are you adding this method instead of rewritin
achuithb
2012/11/14 11:11:29
AddEntryToParent has a DriveEntryProto, but does n
|
| + const FileMoveCallback& callback); |
| + |
| + // Get changed directories related to entry pointed to by |resource_id|. This |
| + // includes the immediate parent, self, and children. |
| + void GetChangedDirectories( |
|
hashimoto
2012/11/14 10:15:56
The term 'changed' seems not obvious in the contex
achuithb
2012/11/14 11:11:29
Ah, I can't do that. The code necessary to determi
hashimoto
2012/11/15 04:10:41
The main problem here is that, to understand what
achuithb
2012/11/15 23:39:54
I've decided to go with (3). The problem with (2)
|
| + const std::string& resource_id, |
| + const ChangedDirectoriesCallback& changed_dirs_callback); |
| + |
| + // Helper function to get a parent directory given |parent_resource_id|. |
| + // Returns root if |parent_resource_id| is empty. Returns NULL if |
| + // |parent_resource_id| is not empty and the corresponding entry is not a |
| + // directory. |
| + DriveDirectory* GetParent(const std::string& parent_resource_id); |
|
hashimoto
2012/11/14 10:15:56
Does this method need to be public?
achuithb
2012/11/14 11:11:29
Done.
|
| + |
| // Moves all child entries from the directory represented by |
| // |source_resource_id| to the directory respresented by |
| // |destination_resource_id|. |callback| must not be null. |
| + // TODO(achuith): Delete this. |
| void TakeOverEntries(const std::string& source_resource_id, |
| const std::string& destination_resource_id, |
| const FileMoveCallback& callback); |
| @@ -295,9 +323,14 @@ |
| scoped_ptr<DriveEntryProto> entry_proto); |
| // Searches for |file_path| synchronously. |
| - // TODO(satorux): Replace this with an async version crbug.com/137160 |
| DriveEntry* FindEntryByPathSync(const FilePath& file_path); |
| + // Helper function to add |entry_proto| as a child to |directory|. |
| + // |callback| must not be null. |
| + void AddEntryToDirectoryInternal(DriveDirectory* directory, |
| + const DriveEntryProto& entry_proto, |
| + const FileMoveCallback& callback); |
| + |
| // Private data members. |
| scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| scoped_ptr<ResourceMetadataDB> resource_metadata_db_; |