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

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: address comments 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fbfe4d89eb82f800937d79b05728c000289f9aca..41b0840b6c49cf99c3463feee771cc031b303adb 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -1891,6 +1891,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);
@@ -1905,52 +1907,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(
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698