Index: chrome/browser/chromeos/gdata/gdata_files.cc |
diff --git a/chrome/browser/chromeos/gdata/gdata_files.cc b/chrome/browser/chromeos/gdata/gdata_files.cc |
index f598d1dd9c8214d239e9a4f460f997ae13958aca..e7ac23eae24ed60cf0bd3225da4b295e8d53bca1 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_files.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_files.cc |
@@ -66,6 +66,14 @@ bool IsValidRootDirectoryProto(const GDataDirectoryProto& proto) { |
} // namespace |
+EntryInfoPairResult::EntryInfoPairResult() |
+ : first_error(GDATA_FILE_ERROR_FAILED), |
+ second_error(GDATA_FILE_ERROR_FAILED) { |
+} |
+ |
+EntryInfoPairResult::~EntryInfoPairResult() { |
+} |
+ |
// GDataEntry class. |
GDataEntry::GDataEntry(GDataDirectory* parent, |
@@ -698,6 +706,23 @@ void GDataDirectoryService::ReadDirectoryByPath( |
base::Bind(callback, error, base::Passed(&entries))); |
} |
+void GDataDirectoryService::GetEntryInfoPairByPaths( |
+ const FilePath& first_path, |
+ const FilePath& second_path, |
+ const GetEntryInfoPairCallback& callback) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
+ |
+ // Get the first entry. |
+ GetEntryInfoByPath( |
+ first_path, |
+ base::Bind(&GDataDirectoryService::GetEntryInfoPairByPathsAfterGetFirst, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ first_path, |
+ second_path, |
+ callback)); |
+} |
+ |
void GDataDirectoryService::RefreshFile(scoped_ptr<GDataFile> fresh_file) { |
DCHECK(fresh_file.get()); |
@@ -1144,4 +1169,50 @@ scoped_ptr<GDataEntry> GDataDirectoryService::FromProtoString( |
return entry.Pass(); |
} |
+void GDataDirectoryService::GetEntryInfoPairByPathsAfterGetFirst( |
+ const FilePath& first_path, |
+ const FilePath& second_path, |
+ const GetEntryInfoPairCallback& callback, |
+ GDataFileError error, |
+ scoped_ptr<GDataEntryProto> entry_proto) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
+ |
+ scoped_ptr<EntryInfoPairResult> result(new EntryInfoPairResult); |
+ result->first_path = first_path; |
+ result->first_error = error; |
+ result->first_proto = entry_proto.Pass(); |
+ |
+ if (error != GDATA_FILE_OK) { |
+ callback.Run(result.Pass()); |
+ return; |
achuithb
2012/08/08 20:50:32
Why is this necessary? Why not look for the second
satorux1
2012/08/08 21:21:21
Looking at the code in gdata_file_system.cc, we do
|
+ } |
+ |
+ // Get the second entry. |
+ GetEntryInfoByPath( |
+ second_path, |
+ base::Bind(&GDataDirectoryService::GetEntryInfoPairByPathsAfterGetSecond, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ second_path, |
+ callback, |
+ base::Passed(&result))); |
+} |
+ |
+void GDataDirectoryService::GetEntryInfoPairByPathsAfterGetSecond( |
+ const FilePath& second_path, |
+ const GetEntryInfoPairCallback& callback, |
+ scoped_ptr<EntryInfoPairResult> result, |
+ GDataFileError error, |
+ scoped_ptr<GDataEntryProto> entry_proto) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
+ DCHECK(!callback.is_null()); |
+ DCHECK(result.get()); |
+ |
+ result->second_path = second_path; |
+ result->second_error = error; |
+ result->second_proto = entry_proto.Pass(); |
+ |
+ callback.Run(result.Pass()); |
+} |
+ |
} // namespace gdata |