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

Unified Diff: chrome/browser/google_apis/drive_api_requests.h

Issue 23575004: Refactor CreateDiretoryRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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/drive/drive_api_service.cc ('k') | chrome/browser/google_apis/drive_api_requests.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/drive_api_requests.h
diff --git a/chrome/browser/google_apis/drive_api_requests.h b/chrome/browser/google_apis/drive_api_requests.h
index 3e6319b150f955adfdf39308ca0bb8c8452938de..8053c5ea5cad25d113482fabdc3709f38b137a66 100644
--- a/chrome/browser/google_apis/drive_api_requests.h
+++ b/chrome/browser/google_apis/drive_api_requests.h
@@ -63,6 +63,49 @@ class FilesGetRequest : public GetDataRequest {
DISALLOW_COPY_AND_ASSIGN(FilesGetRequest);
};
+//============================ FilesInsertRequest =============================
+
+// This class performs the request for creating a resource.
+// This request is mapped to
+// https://developers.google.com/drive/v2/reference/files/insert
+// See also https://developers.google.com/drive/manage-uploads and
+// https://developers.google.com/drive/folder
+class FilesInsertRequest : public GetDataRequest {
+ public:
+ FilesInsertRequest(RequestSender* sender,
+ const DriveApiUrlGenerator& url_generator,
+ const FileResourceCallback& callback);
+ virtual ~FilesInsertRequest();
+
+ // Optional request body.
+ const std::string& mime_type() const { return mime_type_; }
+ void set_mime_type(const std::string& mime_type) {
+ mime_type_ = mime_type;
+ }
+
+ const std::vector<std::string>& parents() const { return parents_; }
+ void add_parent(const std::string& parent) { parents_.push_back(parent); }
+
+ const std::string& title() const { return title_; }
+ void set_title(const std::string& title) { title_ = title; }
+
+ protected:
+ // Overridden from GetDataRequest.
+ virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
+ virtual GURL GetURL() const OVERRIDE;
+ virtual bool GetContentData(std::string* upload_content_type,
+ std::string* upload_content) OVERRIDE;
+
+ private:
+ const DriveApiUrlGenerator url_generator_;
+
+ std::string mime_type_;
+ std::vector<std::string> parents_;
+ std::string title_;
+
+ DISALLOW_COPY_AND_ASSIGN(FilesInsertRequest);
+};
+
//============================== FilesPatchRequest ============================
// This class performs the request for patching file metadata.
@@ -326,33 +369,6 @@ class ContinueGetFileListRequest : public GetDataRequest {
DISALLOW_COPY_AND_ASSIGN(ContinueGetFileListRequest);
};
-//========================== CreateDirectoryRequest ==========================
-
-// This class performs the request for creating a directory.
-class CreateDirectoryRequest : public GetDataRequest {
- public:
- CreateDirectoryRequest(RequestSender* sender,
- const DriveApiUrlGenerator& url_generator,
- const std::string& parent_resource_id,
- const std::string& directory_title,
- const FileResourceCallback& callback);
- virtual ~CreateDirectoryRequest();
-
- protected:
- // Overridden from GetDataRequest.
- virtual GURL GetURL() const OVERRIDE;
- virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
- virtual bool GetContentData(std::string* upload_content_type,
- std::string* upload_content) OVERRIDE;
-
- private:
- const DriveApiUrlGenerator url_generator_;
- const std::string parent_resource_id_;
- const std::string directory_title_;
-
- DISALLOW_COPY_AND_ASSIGN(CreateDirectoryRequest);
-};
-
//=========================== TouchResourceRequest ===========================
// This class performs the request to touch a document/file/directory.
« no previous file with comments | « chrome/browser/drive/drive_api_service.cc ('k') | chrome/browser/google_apis/drive_api_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698