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

Unified Diff: chrome/browser/chromeos/gdata/gdata_util.cc

Issue 10538071: gdata: Convert FindEntryByResourceIdSync() to asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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_util.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_util.cc b/chrome/browser/chromeos/gdata/gdata_util.cc
index 722441ace590dbf952cc7dfe12be6279c9cf0637..15d3b709f8413dd56157b0443f1374b102266051 100644
--- a/chrome/browser/chromeos/gdata/gdata_util.cc
+++ b/chrome/browser/chromeos/gdata/gdata_util.cc
@@ -146,6 +146,21 @@ void OnGetFileInfoForInsertGDataCachePathsPermissions(
callback.Run();
}
+// Invoked upon completeion of FindEntryByResourceIdAsync initiated by
achuithb 2012/06/11 20:46:37 completion
hshi1 2012/06/11 20:58:51 Done.
+// ModifyGDataFileResourceUrl.
+void OnFindEntryByResourceIdAsync(Profile* profile,
+ const std::string& resource_id,
+ base::PlatformFileError error,
+ GDataEntry* entry) {
+ if (error != base::PLATFORM_FILE_OK || !entry || !entry->AsGDataFile())
+ return;
+
+ std::string file_name = entry->AsGDataFile()->file_name();
+ GURL edit_url = GetFileResourceUrl(resource_id, file_name);
+ OpenEditURLUIThread(profile, &edit_url);
+ DVLOG(1) << "OnFindEntryByResourceIdAsync " << edit_url;
+}
+
} // namespace
const FilePath& GetGDataMountPointPath() {
@@ -201,16 +216,13 @@ void ModifyGDataFileResourceUrl(Profile* profile,
GDataCache::CACHE_TYPE_TMP).IsParent(gdata_cache_path)) {
const std::string resource_id =
gdata_cache_path.BaseName().RemoveExtension().AsUTF8Unsafe();
- GDataEntry* entry = NULL;
- file_system->FindEntryByResourceIdSync(
- resource_id, base::Bind(&ReadOnlyFindEntryCallback, &entry));
-
- std::string file_name;
- if (entry && entry->AsGDataFile())
- file_name = entry->AsGDataFile()->file_name();
-
- *url = gdata::util::GetFileResourceUrl(resource_id, file_name);
- DVLOG(1) << "ModifyGDataFileResourceUrl " << *url;
+ file_system->FindEntryByResourceIdAsync(resource_id,
+ base::Bind(
+ &OnFindEntryByResourceIdAsync,
+ profile,
+ resource_id));
+ *url = GURL();
+ return;
}
}

Powered by Google App Engine
This is Rietveld 408576698