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

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

Issue 10837148: gdata: Add GetEntryInfoByPath() and ReadDirectoryByPath() to GDataDirectoryService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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
Index: chrome/browser/chromeos/gdata/gdata_files.h
diff --git a/chrome/browser/chromeos/gdata/gdata_files.h b/chrome/browser/chromeos/gdata/gdata_files.h
index f1dfe115c73eab795a469de0a3bfb9a28059c2c5..4a5196dbf47e590f360028598340b30678859b43 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.h
+++ b/chrome/browser/chromeos/gdata/gdata_files.h
@@ -74,6 +74,20 @@ const int32 kProtoVersion = 1;
typedef base::Callback<void(GDataFileError error)>
FileOperationCallback;
+// Used to get entry info from the file system.
+// If |error| is not GDATA_FILE_OK, |entry_info| is set to NULL.
+typedef base::Callback<void(GDataFileError error,
+ scoped_ptr<GDataEntryProto> entry_proto)>
+ GetEntryInfoCallback;
+
+// Used to read a directory from the file system.
+// If |error| is not GDATA_FILE_OK, |entries| is set to NULL.
+// |entries| are contents, both files and directories, of the directory.
+typedef std::vector<GDataEntryProto> GDataEntryProtoVector;
+typedef base::Callback<void(GDataFileError error,
+ scoped_ptr<GDataEntryProtoVector> entries)>
+ ReadDirectoryCallback;
+
// Base class for representing files and directories in gdata virtual file
// system.
class GDataEntry {
@@ -281,6 +295,9 @@ class GDataDirectory : public GDataEntry {
bool FromProto(const GDataDirectoryProto& proto) WARN_UNUSED_RESULT;
void ToProto(GDataDirectoryProto* proto) const;
+ // Converts the children as a vector of GDataEntryProto.
+ scoped_ptr<GDataEntryProtoVector> ToProtoVector() const;
+
// Removes child elements.
void RemoveChildren();
void RemoveChildFiles();
@@ -400,6 +417,18 @@ class GDataDirectoryService {
void GetEntryByResourceIdAsync(const std::string& resource_id,
const GetEntryByResourceIdCallback& callback);
+ // Finds an entry (a file or a directory) by |file_path|.
+ //
+ // Must be called from UI thread. |callback| is run on UI thread.
+ void GetEntryInfoByPath(const FilePath& file_path,
+ const GetEntryInfoCallback& callback);
+
+ // Finds and reads a directory by |file_path|.
+ //
+ // Must be called from UI thread. |callback| is run on UI thread.
+ void ReadDirectoryByPath(const FilePath& file_path,
+ const ReadDirectoryCallback& callback);
+
// Replaces file entry with the same resource id as |fresh_file| with its
// fresh value |fresh_file|.
void RefreshFile(scoped_ptr<GDataFile> fresh_file);
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system_interface.h ('k') | chrome/browser/chromeos/gdata/gdata_files.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698