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

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

Issue 23514007: Refactor TrashResourceRequest. (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 8053c5ea5cad25d113482fabdc3709f38b137a66..b61ff2b375a37adb5f5ecf62e5ad536b8f368817 100644
--- a/chrome/browser/google_apis/drive_api_requests.h
+++ b/chrome/browser/google_apis/drive_api_requests.h
@@ -258,6 +258,35 @@ class FilesListRequest : public GetDataRequest {
DISALLOW_COPY_AND_ASSIGN(FilesListRequest);
};
+//=========================== TrashResourceRequest ===========================
+
+// This class performs the request for trashing a resource.
+// This request is mapped to
+// https://developers.google.com/drive/v2/reference/files/trash
+class FilesTrashRequest : public GetDataRequest {
+ public:
+ FilesTrashRequest(RequestSender* sender,
+ const DriveApiUrlGenerator& url_generator,
+ const FileResourceCallback& callback);
+ virtual ~FilesTrashRequest();
+
+ // Required parameter.
+ const std::string& file_id() const { return file_id_; }
+ void set_file_id(const std::string& file_id) { file_id_ = file_id; }
+
+ protected:
+ // UrlFetchRequestBase overrides.
+ virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
+ virtual GURL GetURL() const OVERRIDE;
+
+ private:
+ const DriveApiUrlGenerator url_generator_;
+ std::string file_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest);
+};
+
+
//============================== AboutGetRequest =============================
// This class performs the request for fetching About data.
@@ -441,40 +470,6 @@ class MoveResourceRequest : public GetDataRequest {
DISALLOW_COPY_AND_ASSIGN(MoveResourceRequest);
};
-//=========================== TrashResourceRequest ===========================
-
-// This class performs the request for trashing a resource.
-//
-// According to the document:
-// https://developers.google.com/drive/v2/reference/files/trash
-// the file resource will be returned from the server, which is not in the
-// response from WAPI server. For the transition, we simply ignore the result,
-// because now we do not handle resources in trash.
-// Note for the naming: the name "trash" comes from the server's request
-// name. In order to be consistent with the server, we chose "trash" here,
-// although we are preferring the term "remove" in drive/google_api code.
-// TODO(hidehiko): Replace the base class to GetDataRequest.
-class TrashResourceRequest : public EntryActionRequest {
- public:
- // |callback| must not be null.
- TrashResourceRequest(RequestSender* sender,
- const DriveApiUrlGenerator& url_generator,
- const std::string& resource_id,
- const EntryActionCallback& callback);
- virtual ~TrashResourceRequest();
-
- protected:
- // UrlFetchRequestBase overrides.
- virtual GURL GetURL() const OVERRIDE;
- virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
-
- private:
- const DriveApiUrlGenerator url_generator_;
- const std::string resource_id_;
-
- DISALLOW_COPY_AND_ASSIGN(TrashResourceRequest);
-};
-
//========================== InsertResourceRequest ===========================
// This class performs the request for inserting a resource to a 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