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

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

Issue 10831212: gdata: Add GDataDirectoryService::GetEntryInfoPairByPaths() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 4a5196dbf47e590f360028598340b30678859b43..2ee7117600b7a30d1c8e672fc178dee8a3dd840f 100644
--- a/chrome/browser/chromeos/gdata/gdata_files.h
+++ b/chrome/browser/chromeos/gdata/gdata_files.h
@@ -88,6 +88,26 @@ typedef base::Callback<void(GDataFileError error,
scoped_ptr<GDataEntryProtoVector> entries)>
ReadDirectoryCallback;
+// The result of GetEntryInfoPairCallback(). Used to get a pair of entries
+// in one function call.
+struct EntryInfoPairResult {
+ EntryInfoPairResult();
+ ~EntryInfoPairResult();
+
+ FilePath first_path;
achuithb 2012/08/08 20:50:32 Have you considered creating another struct like s
satorux1 2012/08/08 21:21:21 Considered but I was too lazy to rewrite. :) Recon
+ GDataFileError first_error;
+ scoped_ptr<GDataEntryProto> first_proto;
+
+ // The following fields are filled only if the first path is found.
+ FilePath second_path;
+ GDataFileError second_error;
+ scoped_ptr<GDataEntryProto> second_proto;
+};
+
+// Used to receive the result from GetEntryInfoPairCallback().
+typedef base::Callback<void(scoped_ptr<EntryInfoPairResult> pair_result)>
+ GetEntryInfoPairCallback;
+
// Base class for representing files and directories in gdata virtual file
// system.
class GDataEntry {
@@ -429,6 +449,17 @@ class GDataDirectoryService {
void ReadDirectoryByPath(const FilePath& file_path,
const ReadDirectoryCallback& callback);
+ // Similar to GetEntryInfoByPath() but this function finds a pair of
+ // entries by |first_path| and |second_path|. If the entry for
+ // |first_path| is not found, this function does not try to get the
+ // entry of |second_path|.
+ //
+ // Must be called from UI thread. |callback| is run on UI thread.
+ void GetEntryInfoPairByPaths(
+ const FilePath& first_path,
+ const FilePath& second_path,
+ const GetEntryInfoPairCallback& 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);
@@ -463,6 +494,22 @@ class GDataDirectoryService {
scoped_ptr<GDataEntry> FromProtoString(
const std::string& serialized_proto);
+ // ...
+ void GetEntryInfoPairByPathsAfterGetFirst(
+ const FilePath& first_path,
+ const FilePath& second_path,
+ const GetEntryInfoPairCallback& callback,
+ GDataFileError error,
+ scoped_ptr<GDataEntryProto> entry_proto);
+
+ // ...
+ void GetEntryInfoPairByPathsAfterGetSecond(
+ const FilePath& second_path,
+ const GetEntryInfoPairCallback& callback,
+ scoped_ptr<EntryInfoPairResult> result,
+ GDataFileError error,
+ scoped_ptr<GDataEntryProto> entry_proto);
+
// Private data members.
scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
scoped_ptr<ResourceMetadataDB> directory_service_db_;
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/gdata_files.cc » ('j') | chrome/browser/chromeos/gdata/gdata_files.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698