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

Unified Diff: google_apis/drive/base_requests.cc

Issue 1053123004: Drive: Add BatchableRequest subclass. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « google_apis/drive/base_requests.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/base_requests.cc
diff --git a/google_apis/drive/base_requests.cc b/google_apis/drive/base_requests.cc
index b5fd2620c9d8d768a06621f29ec76d41c9f47084..bcd1bab623ebb427ac50d69b004898ce8ab6c7a3 100644
--- a/google_apis/drive/base_requests.cc
+++ b/google_apis/drive/base_requests.cc
@@ -556,6 +556,31 @@ UrlFetchRequestBase::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
+//============================ BatchableRequestBase ============================
+
+net::URLFetcher::RequestType BatchableRequestBase::GetRequestType() const {
+ return UrlFetchRequestBase::GetRequestType();
+}
+
+std::vector<std::string> BatchableRequestBase::GetExtraRequestHeaders() const {
+ return UrlFetchRequestBase::GetExtraRequestHeaders();
+}
+
+void BatchableRequestBase::Prepare(const PrepareCallback& callback) {
+ return UrlFetchRequestBase::Prepare(callback);
+}
+
+bool BatchableRequestBase::GetContentData(
+ std::string* upload_content_type, std::string* upload_content) {
+ return UrlFetchRequestBase::GetContentData(
+ upload_content_type, upload_content);
+}
+
+void BatchableRequestBase::ProcessURLFetchResults(
+ const net::URLFetcher* source) {
+ ProcessURLFetchResults(GetErrorCode(), response_writer()->data());
+}
+
//============================ EntryActionRequest ============================
EntryActionRequest::EntryActionRequest(RequestSender* sender,
@@ -832,7 +857,7 @@ MultipartUploadRequestBase::MultipartUploadRequestBase(
const base::FilePath& local_file_path,
const FileResourceCallback& callback,
const ProgressCallback& progress_callback)
- : UrlFetchRequestBase(sender),
+ : BatchableRequestBase(sender),
metadata_json_(metadata_json),
content_type_(content_type),
local_path_(local_file_path),
@@ -893,13 +918,12 @@ bool MultipartUploadRequestBase::GetContentData(
}
void MultipartUploadRequestBase::ProcessURLFetchResults(
- const URLFetcher* source) {
+ DriveApiErrorCode code, const std::string& body) {
// The upload is successfully done. Parse the response which should be
// the entry's metadata.
- const DriveApiErrorCode code = GetErrorCode();
if (code == HTTP_CREATED || code == HTTP_SUCCESS) {
ParseJsonOnBlockingPool(
- blocking_task_runner(), response_writer()->data(),
+ blocking_task_runner(), body,
base::Bind(&MultipartUploadRequestBase::OnDataParsed,
weak_ptr_factory_.GetWeakPtr(), code));
} else {
« no previous file with comments | « google_apis/drive/base_requests.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698