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

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

Issue 10207022: gdata: Simplify InitiateUpload() and ResumeUpload() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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_file_system.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc
index e2824acb99791eada3c0e54ecf17ee89ec6899f5..18eae5de1d87487ce19e7264c9841371d9dcfcc0 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -1888,6 +1888,8 @@ void GDataFileSystem::InitiateUpload(
const FilePath& destination_directory,
const FilePath& virtual_path,
const InitiateUploadCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
GURL destination_directory_url =
GetUploadUrlForDirectory(destination_directory);
@@ -1902,52 +1904,20 @@ void GDataFileSystem::InitiateUpload(
}
documents_service_->InitiateUpload(
- InitiateUploadParams(file_name,
- content_type,
- content_length,
- destination_directory_url,
- virtual_path),
- base::Bind(&GDataFileSystem::OnUploadLocationReceived,
- GetWeakPtrForCurrentThread(),
- callback,
- // MessageLoopProxy is used to run |callback| on the
- // thread where this function was called.
- base::MessageLoopProxy::current()));
-}
-
-void GDataFileSystem::OnUploadLocationReceived(
- const InitiateUploadCallback& callback,
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
- GDataErrorCode code,
- const GURL& upload_location) {
-
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!callback.is_null()) {
- message_loop_proxy->PostTask(FROM_HERE, base::Bind(callback, code,
- upload_location));
- }
+ InitiateUploadParams(file_name,
+ content_type,
+ content_length,
+ destination_directory_url,
+ virtual_path),
+ callback);
}
void GDataFileSystem::ResumeUpload(
const ResumeUploadParams& params,
const ResumeFileUploadCallback& callback) {
- documents_service_->ResumeUpload(
- params,
- base::Bind(&GDataFileSystem::OnResumeUpload,
- GetWeakPtrForCurrentThread(),
- base::MessageLoopProxy::current(),
- callback));
-}
-
-void GDataFileSystem::OnResumeUpload(
- scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
- const ResumeFileUploadCallback& callback,
- const ResumeUploadResponse& response,
- scoped_ptr<DocumentEntry> new_entry) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (!callback.is_null())
- message_loop_proxy->PostTask(FROM_HERE,
- base::Bind(callback, response, base::Passed(&new_entry)));
+
+ documents_service_->ResumeUpload(params, callback);
}
void GDataFileSystem::UnsafeFindEntryByPath(

Powered by Google App Engine
This is Rietveld 408576698