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

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

Issue 23757004: Refactor InsertResourceRequest and DeleteResourceRequest. (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 b61ff2b375a37adb5f5ecf62e5ad536b8f368817..8819c9cad9d7283532ba7149035cc295a2c0a0ab 100644
--- a/chrome/browser/google_apis/drive_api_requests.h
+++ b/chrome/browser/google_apis/drive_api_requests.h
@@ -470,65 +470,78 @@ class MoveResourceRequest : public GetDataRequest {
DISALLOW_COPY_AND_ASSIGN(MoveResourceRequest);
};
-//========================== InsertResourceRequest ===========================
+//========================== ChildrenInsertRequest ============================
// This class performs the request for inserting a resource to a directory.
-// Note that this is the request of "Children: insert" of the Drive API v2.
-// https://developers.google.com/drive/v2/reference/children/insert.
-class InsertResourceRequest : public EntryActionRequest {
+// This request is mapped to
+// https://developers.google.com/drive/v2/reference/children/insert
+class ChildrenInsertRequest : public EntryActionRequest {
public:
- // |callback| must not be null.
- InsertResourceRequest(RequestSender* sender,
+ ChildrenInsertRequest(RequestSender* sender,
const DriveApiUrlGenerator& url_generator,
- const std::string& parent_resource_id,
- const std::string& resource_id,
const EntryActionCallback& callback);
- virtual ~InsertResourceRequest();
+ virtual ~ChildrenInsertRequest();
+
+ // Required parameter.
+ const std::string& folder_id() const { return folder_id_; }
+ void set_folder_id(const std::string& folder_id) {
+ folder_id_ = folder_id;
+ }
+
+ // Required body.
+ const std::string& id() const { return id_; }
+ void set_id(const std::string& id) { id_ = id; }
protected:
// UrlFetchRequestBase overrides.
- virtual GURL GetURL() const OVERRIDE;
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_;
- const std::string parent_resource_id_;
- const std::string resource_id_;
+ std::string folder_id_;
+ std::string id_;
- DISALLOW_COPY_AND_ASSIGN(InsertResourceRequest);
+ DISALLOW_COPY_AND_ASSIGN(ChildrenInsertRequest);
};
-//========================== DeleteResourceRequest ===========================
+//========================== ChildrenDeleteRequest ============================
// This class performs the request for removing a resource from a directory.
-// Note that we use "delete" for the name of this class, which comes from the
-// request name of the Drive API v2, although we prefer "remove" for that
-// sense in "drive/google_api"
-// Also note that this is the request of "Children: delete" of the Drive API
-// v2. https://developers.google.com/drive/v2/reference/children/delete
-class DeleteResourceRequest : public EntryActionRequest {
+// This request is mapped to
+// https://developers.google.com/drive/v2/reference/children/delete
+class ChildrenDeleteRequest : public EntryActionRequest {
public:
// |callback| must not be null.
- DeleteResourceRequest(RequestSender* sender,
+ ChildrenDeleteRequest(RequestSender* sender,
const DriveApiUrlGenerator& url_generator,
- const std::string& parent_resource_id,
- const std::string& resource_id,
const EntryActionCallback& callback);
- virtual ~DeleteResourceRequest();
+ virtual ~ChildrenDeleteRequest();
+
+ // Required parameter.
+ const std::string& child_id() const { return child_id_; }
+ void set_child_id(const std::string& child_id) {
+ child_id_ = child_id;
+ }
+
+ const std::string& folder_id() const { return folder_id_; }
+ void set_folder_id(const std::string& folder_id) {
+ folder_id_ = folder_id;
+ }
protected:
// UrlFetchRequestBase overrides.
- virtual GURL GetURL() const OVERRIDE;
virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
+ virtual GURL GetURL() const OVERRIDE;
private:
const DriveApiUrlGenerator url_generator_;
- const std::string parent_resource_id_;
- const std::string resource_id_;
+ std::string child_id_;
+ std::string folder_id_;
- DISALLOW_COPY_AND_ASSIGN(DeleteResourceRequest);
+ DISALLOW_COPY_AND_ASSIGN(ChildrenDeleteRequest);
};
//======================= InitiateUploadNewFileRequest =======================
« 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