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

Unified Diff: google_apis/drive/drive_api_requests.h

Issue 1081313002: Drive: Add response handling to BatchUploadRequst class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 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 | « no previous file | google_apis/drive/drive_api_requests.cc » ('j') | google_apis/drive/drive_api_requests.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/drive_api_requests.h
diff --git a/google_apis/drive/drive_api_requests.h b/google_apis/drive/drive_api_requests.h
index 3aaee366c830378d9dae91fdac2b54c6e6e98a71..7f2fcb57c4ddd9d48a810c23511c9c9cebe70a6c 100644
--- a/google_apis/drive/drive_api_requests.h
+++ b/google_apis/drive/drive_api_requests.h
@@ -66,6 +66,31 @@ class Property {
// List of properties for a single file or a directory.
typedef std::vector<Property> Properties;
+// Child response embedded in multipart parent response.
+struct MultipartHttpResponse {
+ MultipartHttpResponse();
+ ~MultipartHttpResponse();
+ DriveApiErrorCode code;
+ std::string body;
+};
+
+// Splits multipart |response| into |parts|. Returns true on succcess.
+// https://www.ietf.org/rfc/rfc2046.txt
+// The |response| should consists of multiple parts split by specific boundary
+// string. It looks like:
kinaba 2015/04/27 08:09:37 In addition to the RFC, you are assuming that the
hirono 2015/04/27 12:32:45 Done.
+// --Boundary
+// Content-type: text/plain
+//
+// Content 1
+// --Boundary
+// Content-type: text/plain
+//
+// Content 2
+// --Boundary--
+bool ParseMultipartResponse(const std::string& boundary,
+ const std::string& response,
+ std::vector<MultipartHttpResponse>* parts);
+
//============================ DriveApiPartialFieldRequest ====================
// This is base class of the Drive API related requests. All Drive API requests
@@ -1135,9 +1160,8 @@ class BatchUploadRequest : public UrlFetchRequestBase {
GURL GetURL() const override;
net::URLFetcher::RequestType GetRequestType() const override;
std::vector<std::string> GetExtraRequestHeaders() const override;
- bool GetContentData(
- std::string* upload_content_type,
- std::string* upload_content) override;
+ bool GetContentData(std::string* upload_content_type,
+ std::string* upload_content) override;
void ProcessURLFetchResults(const net::URLFetcher* source) override;
void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override;
@@ -1145,8 +1169,8 @@ class BatchUploadRequest : public UrlFetchRequestBase {
typedef void* RequestID;
// Obtains corresponding child entry of |request_id|. Returns NULL if the
// entry is not found.
- std::vector<BatchUploadChildEntry>::iterator
- GetChildEntry(RequestID request_id);
+ std::vector<BatchUploadChildEntry>::iterator GetChildEntry(
+ RequestID request_id);
// Called after child requests' |Prepare| method.
void OnChildRequestPrepared(RequestID request_id, DriveApiErrorCode result);
« no previous file with comments | « no previous file | google_apis/drive/drive_api_requests.cc » ('j') | google_apis/drive/drive_api_requests.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698