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

Unified Diff: chrome/browser/google_apis/gdata_wapi_service.cc

Issue 12207075: Split InitiateUpload method into two. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148632_extract_initiate_upload_operation_base
Patch Set: Created 7 years, 10 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/google_apis/gdata_wapi_service.h ('k') | chrome/browser/google_apis/mock_drive_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/gdata_wapi_service.cc
diff --git a/chrome/browser/google_apis/gdata_wapi_service.cc b/chrome/browser/google_apis/gdata_wapi_service.cc
index de2c470c2b951869e76f0d6dd1046fad7574f778..c3dd974e9a3d75d90d8b4b0a027571b4c3669af5 100644
--- a/chrome/browser/google_apis/gdata_wapi_service.cc
+++ b/chrome/browser/google_apis/gdata_wapi_service.cc
@@ -408,43 +408,56 @@ void GDataWapiService::RemoveResourceFromDirectory(
resource_id));
}
-void GDataWapiService::InitiateUpload(
- const InitiateUploadParams& params,
+void GDataWapiService::InitiateUploadNewFile(
+ const FilePath& drive_file_path,
+ const std::string& content_type,
+ int64 content_length,
+ const GURL& parent_upload_url,
+ const std::string& title,
const InitiateUploadCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!callback.is_null());
- if (params.upload_location.is_empty()) {
+ if (parent_upload_url.is_empty()) {
hashimoto 2013/02/08 10:14:57 nit: DriveUploader is DCHECKing that url is not em
hidehiko 2013/02/08 12:01:50 Can I keep this as is at the moment, because I'm a
hashimoto 2013/02/08 12:45:02 OK. Please go ahead.
callback.Run(HTTP_BAD_REQUEST, GURL());
return;
}
- // TODO(hidehiko): Remove this if-statement by splitting the InitiateUpload
- // method into two InitiateUploadNewFile and InitiateUploadExistingFile.
- if (params.upload_mode == UPLOAD_NEW_FILE) {
- runner_->StartOperationWithRetry(
- new InitiateUploadNewFileOperation(
- operation_registry(),
- url_request_context_getter_,
- callback,
- params.drive_file_path,
- params.content_type,
- params.content_length,
- params.upload_location, // Here, upload_location has parent's URL.
- params.title));
- } else {
- DCHECK_EQ(params.upload_mode, UPLOAD_EXISTING_FILE);
- runner_->StartOperationWithRetry(
- new InitiateUploadExistingFileOperation(
- operation_registry(),
- url_request_context_getter_,
- callback,
- params.drive_file_path,
- params.content_type,
- params.content_length,
- params.upload_location, // Here, upload_location has file's URL.
- params.etag));
+ runner_->StartOperationWithRetry(
+ new InitiateUploadNewFileOperation(operation_registry(),
+ url_request_context_getter_,
+ callback,
+ drive_file_path,
+ content_type,
+ content_length,
+ parent_upload_url,
+ title));
+}
+
+void GDataWapiService::InitiateUploadExistingFile(
+ const FilePath& drive_file_path,
+ const std::string& content_type,
+ int64 content_length,
+ const GURL& upload_url,
+ const std::string& etag,
+ const InitiateUploadCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(!callback.is_null());
+
+ if (upload_url.is_empty()) {
+ callback.Run(HTTP_BAD_REQUEST, GURL());
+ return;
}
+
+ runner_->StartOperationWithRetry(
+ new InitiateUploadExistingFileOperation(operation_registry(),
+ url_request_context_getter_,
+ callback,
+ drive_file_path,
+ content_type,
+ content_length,
+ upload_url,
+ etag));
}
void GDataWapiService::ResumeUpload(const ResumeUploadParams& params,
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_service.h ('k') | chrome/browser/google_apis/mock_drive_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698