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

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

Issue 10829277: GDataFileSystem is no longer a friend of GDataDirectory. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: NotifyAndRunFileMoveCallback needs to accept null callback Created 8 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.cc ('k') | chrome/browser/chromeos/gdata/gdata_files.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_files.h
===================================================================
--- chrome/browser/chromeos/gdata/gdata_files.h (revision 151579)
+++ 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"
@@ -329,7 +330,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);
@@ -387,6 +387,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();
@@ -421,13 +423,26 @@
// Sets root directory resource id and initialize the root entry.
void InitializeRootEntry(const std::string& root_id);
- // Move |entry| to |directory_path| asynchronously. Removes entry from
+ // 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);
+
+ // Moves |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 not be null.
void MoveEntryToDirectory(const FilePath& directory_path,
GDataEntry* entry,
const FileMoveCallback& callback);
+ // Removes |entry| from its parent. Calls |callback| with the path of the
+ // parent directory. |callback| may not be null.
+ void RemoveEntryFromParent(GDataEntry* entry,
+ const FileMoveCallback& callback);
+
// Adds the entry to resource map.
void AddEntryToResourceMap(GDataEntry* entry);
@@ -479,9 +494,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);
+ // Removes 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;
@@ -494,9 +511,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,
@@ -509,7 +523,9 @@
scoped_ptr<GDataEntry> FromProtoString(
const std::string& serialized_proto);
- // ...
+ // Continues 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,
@@ -517,7 +533,8 @@
GDataFileError error,
scoped_ptr<GDataEntryProto> entry_proto);
- // ...
+ // Continues with GetIntroInfoPairByPaths after the second GDataEntry has been
+ // asynchronously fetched.
void GetEntryInfoPairByPathsAfterGetSecond(
const FilePath& second_path,
const GetEntryInfoPairCallback& callback,
@@ -525,6 +542,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_;
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.cc ('k') | chrome/browser/chromeos/gdata/gdata_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698