| 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..a44e1394de2cb0b7de91ab376a5ac8cf36bc23de 100644
|
| --- a/chrome/browser/chromeos/gdata/gdata_files.cc
|
| +++ b/chrome/browser/chromeos/gdata/gdata_files.cc
|
| @@ -66,6 +66,18 @@ bool IsValidRootDirectoryProto(const GDataDirectoryProto& proto) {
|
|
|
| } // namespace
|
|
|
| +EntryInfoResult::EntryInfoResult() : error(GDATA_FILE_ERROR_FAILED) {
|
| +}
|
| +
|
| +EntryInfoResult::~EntryInfoResult() {
|
| +}
|
| +
|
| +EntryInfoPairResult::EntryInfoPairResult() {
|
| +}
|
| +
|
| +EntryInfoPairResult::~EntryInfoPairResult() {
|
| +}
|
| +
|
| // GDataEntry class.
|
|
|
| GDataEntry::GDataEntry(GDataDirectory* parent,
|
| @@ -698,6 +710,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 +1173,51 @@ 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 the first one is not found, don't continue.
|
| + if (error != GDATA_FILE_OK) {
|
| + callback.Run(result.Pass());
|
| + return;
|
| + }
|
| +
|
| + // 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
|
|
|