Index: chrome/browser/chromeos/drive/file_system.cc |
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc |
index 19467fee172fcfea32ce268362a436b30660bed9..6c506624167ee2ecb603277c431dcb1ed58f4a99 100644 |
--- a/chrome/browser/chromeos/drive/file_system.cc |
+++ b/chrome/browser/chromeos/drive/file_system.cc |
@@ -39,17 +39,6 @@ namespace { |
//================================ Helper functions ============================ |
-// Helper function for binding |path| to GetResourceEntryWithFilePathCallback |
-// and create GetResourceEntryCallback. |
-void RunGetResourceEntryWithFilePathCallback( |
- const GetResourceEntryWithFilePathCallback& callback, |
- const base::FilePath& path, |
- FileError error, |
- scoped_ptr<ResourceEntry> entry) { |
- DCHECK(!callback.is_null()); |
- callback.Run(error, path, entry.Pass()); |
-} |
- |
// Callback for ResourceMetadata::GetLargestChangestamp. |
// |callback| must not be null. |
void OnGetLargestChangestamp( |
@@ -179,7 +168,7 @@ void FileSystem::RemoveObserver(FileSystemObserver* observer) { |
void FileSystem::GetResourceEntryById( |
const std::string& resource_id, |
- const GetResourceEntryWithFilePathCallback& callback) { |
+ const GetResourceEntryCallback& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!resource_id.empty()); |
DCHECK(!callback.is_null()); |
@@ -192,24 +181,19 @@ void FileSystem::GetResourceEntryById( |
} |
void FileSystem::GetResourceEntryByIdAfterGetEntry( |
- const GetResourceEntryWithFilePathCallback& callback, |
+ const GetResourceEntryCallback& callback, |
FileError error, |
- const base::FilePath& file_path, |
scoped_ptr<ResourceEntry> entry) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!callback.is_null()); |
if (error != FILE_ERROR_OK) { |
- callback.Run(error, base::FilePath(), scoped_ptr<ResourceEntry>()); |
+ callback.Run(error, scoped_ptr<ResourceEntry>()); |
return; |
} |
DCHECK(entry.get()); |
- CheckLocalModificationAndRun( |
- entry.Pass(), |
- base::Bind(&RunGetResourceEntryWithFilePathCallback, |
- callback, |
- file_path)); |
+ CheckLocalModificationAndRun(entry.Pass(), callback); |
} |
void FileSystem::TransferFileFromRemoteToLocal( |
@@ -398,26 +382,28 @@ void FileSystem::GetFileByResourceId( |
DCHECK(!resource_id.empty()); |
DCHECK(!get_file_callback.is_null()); |
- resource_metadata_->GetResourceEntryByIdOnUIThread( |
- resource_id, |
- base::Bind(&FileSystem::GetFileByResourceIdAfterGetEntry, |
+ base::PostTaskAndReplyWithResult( |
+ blocking_task_runner_, |
+ FROM_HERE, |
+ base::Bind(&internal::ResourceMetadata::GetFilePath, |
satorux1
2013/05/29 06:07:03
This seems to be awkward. Why do we need to conver
|
+ base::Unretained(resource_metadata_), |
+ resource_id), |
+ base::Bind(&FileSystem::GetFileByResourceIdAfterGetFilePath, |
weak_ptr_factory_.GetWeakPtr(), |
context, |
get_file_callback, |
get_content_callback)); |
} |
-void FileSystem::GetFileByResourceIdAfterGetEntry( |
+void FileSystem::GetFileByResourceIdAfterGetFilePath( |
const DriveClientContext& context, |
const GetFileCallback& get_file_callback, |
const google_apis::GetContentCallback& get_content_callback, |
- FileError error, |
- const base::FilePath& file_path, |
- scoped_ptr<ResourceEntry> entry) { |
+ const base::FilePath& file_path) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
DCHECK(!get_file_callback.is_null()); |
- if (error != FILE_ERROR_OK) { |
+ if (file_path.empty()) { |
get_file_callback.Run(FILE_ERROR_NOT_FOUND, base::FilePath(), |
scoped_ptr<ResourceEntry>()); |
return; |