Index: chrome/browser/chromeos/gdata/gdata_files.h |
=================================================================== |
--- chrome/browser/chromeos/gdata/gdata_files.h (revision 151008) |
+++ chrome/browser/chromeos/gdata/gdata_files.h (working copy) |
@@ -7,6 +7,7 @@ |
#include <map> |
#include <string> |
+#include <vector> |
#include "base/callback.h" |
#include "base/gtest_prod_util.h" |
@@ -325,7 +326,6 @@ |
private: |
// TODO(satorux): Remove the friend statements. crbug.com/139649 |
friend class GDataDirectoryService; |
- friend class GDataFileSystem; |
friend class GDataWapiFeedProcessor; |
explicit GDataDirectory(GDataDirectoryService* directory_service); |
@@ -383,6 +383,8 @@ |
// Map of resource id and serialized GDataEntry. |
typedef std::map<std::string, std::string> SerializedMap; |
+ // Map of resource id strings to GDataEntry*. |
+ typedef std::map<std::string, GDataEntry*> ResourceMap; |
GDataDirectoryService(); |
~GDataDirectoryService(); |
@@ -417,13 +419,26 @@ |
// Sets root directory resource id and initialize the root entry. |
void InitializeRootEntry(const std::string& root_id); |
+ // Add |new entry| to |directory| and invoke the callback asynchronously. |
+ // |callback| may not be null. |
+ // TODO(achuith,satorux): Use GDataEntryProto instead for new_entry. |
+ // crbug.com/142048 |
+ void AddEntryToDirectory(GDataDirectory* directory, |
+ GDataEntry* new_entry, |
+ const FileMoveCallback& callback); |
+ |
// Move |entry| to |directory_path| asynchronously. Removes entry from |
// previous parent. Must be called on UI thread. |callback| is called on the |
- // UI thread. |
+ // UI thread. |callback| may be null. |
satorux1
2012/08/13 22:35:53
Looking at the callers in gdata_file_system.cc, ca
achuithb
2012/08/14 00:18:44
Done.
|
void MoveEntryToDirectory(const FilePath& directory_path, |
GDataEntry* entry, |
const FileMoveCallback& callback); |
+ // Remove |entry| from its parent. Calls |callback| with the path of the |
+ // parent directory. |callback| can be null. |
+ void RemoveEntryFromParent(GDataEntry* entry, |
+ const FileMoveCallback& callback); |
+ |
// Adds the entry to resource map. |
void AddEntryToResourceMap(GDataEntry* entry); |
@@ -475,9 +490,11 @@ |
// fresh value |fresh_file|. |
void RefreshFile(scoped_ptr<GDataFile> fresh_file); |
- // Replaces file entry |old_entry| with its fresh value |fresh_file|. |
- static void RefreshFileInternal(scoped_ptr<GDataFile> fresh_file, |
- GDataEntry* old_entry); |
+ // Remove all child files of |directory| and replace with file_map. |
+ // |callback| is called with the directory path. |callback| may not be null. |
+ void RefreshDirectory(const std::string& directory_resource_id, |
+ const ResourceMap& file_map, |
+ const FileMoveCallback& callback); |
// Serializes/Parses to/from string via proto classes. |
void SerializeToString(std::string* serialized_proto) const; |
@@ -490,9 +507,6 @@ |
void SaveToDB(); |
private: |
- // A map table of file's resource string to its GDataFile* entry. |
- typedef std::map<std::string, GDataEntry*> ResourceMap; |
- |
// Initializes the resource map using serialized_resources fetched from the |
// database. |
void InitResourceMap(CreateDBParams* create_params, |
@@ -505,7 +519,9 @@ |
scoped_ptr<GDataEntry> FromProtoString( |
const std::string& serialized_proto); |
- // ... |
+ // Continue with GetEntryInfoPairByPaths after the first GDataEntry has been |
+ // asynchronously fetched. This fetches the second GDataEntry only if the |
+ // first was found. |
void GetEntryInfoPairByPathsAfterGetFirst( |
const FilePath& first_path, |
const FilePath& second_path, |
@@ -513,7 +529,8 @@ |
GDataFileError error, |
scoped_ptr<GDataEntryProto> entry_proto); |
- // ... |
+ // Continue with GetIntroInfoPairByPaths after the second GDataEntry has been |
+ // asynchronously fetched. |
void GetEntryInfoPairByPathsAfterGetSecond( |
const FilePath& second_path, |
const GetEntryInfoPairCallback& callback, |
@@ -521,6 +538,19 @@ |
GDataFileError error, |
scoped_ptr<GDataEntryProto> entry_proto); |
+ // These internal functions need friend access to private GDataDirectory |
+ // methods. |
+ // Replaces file entry |old_entry| with its fresh value |fresh_file|. |
+ static void RefreshFileInternal(scoped_ptr<GDataFile> fresh_file, |
+ GDataEntry* old_entry); |
+ |
+ // Removes all child files of |directory| and replace with file_map. |
+ // |callback| may not be null. |
+ static void RefreshDirectoryInternal(const ResourceMap& file_map, |
+ const FileMoveCallback& callback, |
+ GDataEntry* directory_entry); |
+ |
+ |
// Private data members. |
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
scoped_ptr<ResourceMetadataDB> directory_service_db_; |