Chromium Code Reviews| 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); |