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

Unified Diff: google_apis/drive/base_requests.h

Issue 1053623004: Drive: Add multipart related utility methods. (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 | « no previous file | google_apis/drive/base_requests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/base_requests.h
diff --git a/google_apis/drive/base_requests.h b/google_apis/drive/base_requests.h
index 2cfddf07797ee2cfbcecca6aabce73f5d5d28831..9c66fe6becf761d8926bf70bb414b77860a5171c 100644
--- a/google_apis/drive/base_requests.h
+++ b/google_apis/drive/base_requests.h
@@ -30,6 +30,18 @@ namespace google_apis {
class FileResource;
class RequestSender;
+// Content type for multipart body.
+enum MultipartType {
+ MULTIPART_RELATED,
+ MULTIPART_MIXED
+};
+
+// Pair of content type and data.
+struct ContentTypeAndData {
+ std::string type;
+ std::string data;
+};
+
typedef base::Callback<void(DriveApiErrorCode)> PrepareCallback;
// Callback used for requests that the server returns FileResource data
@@ -49,6 +61,14 @@ typedef base::Callback<void(
// Parses JSON passed in |json|. Returns NULL on failure.
scoped_ptr<base::Value> ParseJson(const std::string& json);
+// Generate multipart body. If |predetermined_boundary| is not empty, it uses
+// the string as boundary. Otherwise it generates random boundary that does not
+// conflict with |parts|.
+void GenerateMultipartBody(MultipartType multipart_type,
+ const std::string& predetermined_boundary,
+ const std::vector<ContentTypeAndData>& parts,
+ ContentTypeAndData* output);
+
//======================= AuthenticatedRequestInterface ======================
// An interface class for implementing a request which requires OAuth2
« no previous file with comments | « no previous file | google_apis/drive/base_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698