Chromium Code Reviews| 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..010ec6ed5c67960bb7805d1d9efbf9a71392e2d7 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 completion of FindEntryByResourceId initiated by |
| +// ModifyGDataFileResourceUrl. |
| +void OnFindEntryByResourceId(Profile* profile, |
|
achuithb
2012/06/11 21:48:41
Could we move this next to OpenEditURLUIThread? Th
hshi1
2012/06/11 22:42:21
Sounds reasonable, done.
On 2012/06/11 21:48:41,
|
| + const std::string& resource_id, |
|
achuithb
2012/06/11 21:48:41
indentation is off
hshi1
2012/06/11 22:42:21
Done.
|
| + base::PlatformFileError error, |
| + GDataEntry* entry) { |
| + if (error != base::PLATFORM_FILE_OK || !entry || !entry->AsGDataFile()) |
|
achuithb
2012/06/11 21:48:41
Could you please add a DCHECK for UI thread here?
hshi1
2012/06/11 22:42:21
Again, this is run on the CALLER thread, not on UI
achuithb
2012/06/11 22:56:11
Which I believe is the UI thread in this case, rig
hshi1
2012/06/11 23:17:52
Yes you're right. Done.
|
| + return; |
| + |
| + std::string file_name = entry->AsGDataFile()->file_name(); |
|
achuithb
2012/06/11 21:48:41
could we make this const?
hshi1
2012/06/11 22:42:21
Done.
|
| + GURL edit_url = GetFileResourceUrl(resource_id, file_name); |
|
achuithb
2012/06/11 21:48:41
could we make this const too? You may need to chan
hshi1
2012/06/11 22:42:21
If I declare the object as "const GURL edit_url" h
achuithb
2012/06/11 22:56:11
That's strange. It should be const GURL* since edi
hshi1
2012/06/11 23:17:52
Sorry I was mistaken. It should be "const GURL*".
|
| + OpenEditURLUIThread(profile, &edit_url); |
| + DVLOG(1) << "OnFindEntryByResourceId " << edit_url; |
| +} |
| + |
| } // namespace |
| const FilePath& GetGDataMountPointPath() { |
| @@ -201,16 +216,12 @@ 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->FindEntryByResourceId(resource_id, |
| + base::Bind(&OnFindEntryByResourceId, |
| + profile, |
| + resource_id)); |
| + *url = GURL(); |
| + return; |
|
achuithb
2012/06/11 21:48:41
this return seems unnecessary
hshi1
2012/06/11 22:42:21
Done.
|
| } |
| } |