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

Side by Side Diff: chrome/browser/google_apis/drive_api_requests.h

Issue 22909041: Refactor GetAboutRequest and GetApplistRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_ 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_ 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "chrome/browser/google_apis/base_requests.h" 11 #include "chrome/browser/google_apis/base_requests.h"
12 #include "chrome/browser/google_apis/drive_api_url_generator.h" 12 #include "chrome/browser/google_apis/drive_api_url_generator.h"
13 #include "chrome/browser/google_apis/drive_common_callbacks.h" 13 #include "chrome/browser/google_apis/drive_common_callbacks.h"
14 14
15 namespace google_apis { 15 namespace google_apis {
16 16
17 class FileResource; 17 class FileResource;
18 18
19 // Callback used for requests that the server returns FileResource data 19 // Callback used for requests that the server returns FileResource data
20 // formatted into JSON value. 20 // formatted into JSON value.
21 typedef base::Callback<void(GDataErrorCode error, 21 typedef base::Callback<void(GDataErrorCode error,
22 scoped_ptr<FileResource> entry)> 22 scoped_ptr<FileResource> entry)>
23 FileResourceCallback; 23 FileResourceCallback;
24 24
25
26 //============================== GetAboutRequest =============================
27
28 // This class performs the request for fetching About data.
29 class GetAboutRequest : public GetDataRequest {
30 public:
31 GetAboutRequest(RequestSender* sender,
32 const DriveApiUrlGenerator& url_generator,
33 const GetAboutResourceCallback& callback);
34 virtual ~GetAboutRequest();
35
36 protected:
37 // Overridden from GetDataRequest.
38 virtual GURL GetURL() const OVERRIDE;
39
40 private:
41 const DriveApiUrlGenerator url_generator_;
42
43 DISALLOW_COPY_AND_ASSIGN(GetAboutRequest);
44 };
45
46 //============================= GetApplistRequest ============================
47
48 // This class performs the request for fetching Applist.
49 class GetApplistRequest : public GetDataRequest {
50 public:
51 GetApplistRequest(RequestSender* sender,
52 const DriveApiUrlGenerator& url_generator,
53 const GetDataCallback& callback);
54 virtual ~GetApplistRequest();
55
56 protected:
57 // Overridden from GetDataRequest.
58 virtual GURL GetURL() const OVERRIDE;
59
60 private:
61 const DriveApiUrlGenerator url_generator_;
62
63 DISALLOW_COPY_AND_ASSIGN(GetApplistRequest);
64 };
65
66 //============================ GetChangelistRequest ========================== 25 //============================ GetChangelistRequest ==========================
67 26
68 // This class performs the request for fetching changelist. 27 // This class performs the request for fetching changelist.
69 // The result may contain only first part of the result. The remaining result 28 // The result may contain only first part of the result. The remaining result
70 // should be able to be fetched by ContinueGetFileListRequest defined below. 29 // should be able to be fetched by ContinueGetFileListRequest defined below.
71 class GetChangelistRequest : public GetDataRequest { 30 class GetChangelistRequest : public GetDataRequest {
72 public: 31 public:
73 // |include_deleted| specifies if the response should contain the changes 32 // |include_deleted| specifies if the response should contain the changes
74 // for deleted entries or not. 33 // for deleted entries or not.
75 // |start_changestamp| specifies the starting point of change list or 0 if 34 // |start_changestamp| specifies the starting point of change list or 0 if
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 }; 105 };
147 106
148 // This namespace is introduced to avoid class name confliction between 107 // This namespace is introduced to avoid class name confliction between
149 // the requests for Drive API v2 and GData WAPI for transition. 108 // the requests for Drive API v2 and GData WAPI for transition.
150 // And, when the migration is done and GData WAPI's code is cleaned up, 109 // And, when the migration is done and GData WAPI's code is cleaned up,
151 // classes inside this namespace should be moved to the google_apis namespace. 110 // classes inside this namespace should be moved to the google_apis namespace.
152 // TODO(hidehiko): Move all the requests defined in this file into drive 111 // TODO(hidehiko): Move all the requests defined in this file into drive
153 // namespace. crbug.com/180808 112 // namespace. crbug.com/180808
154 namespace drive { 113 namespace drive {
155 114
115 //============================== AboutGetRequest =============================
116
117 // This class performs the request for fetching About data.
118 // This request is mapped to
119 // https://developers.google.com/drive/v2/reference/about/get
120 class AboutGetRequest : public GetDataRequest {
121 public:
122 AboutGetRequest(RequestSender* sender,
123 const DriveApiUrlGenerator& url_generator,
124 const AboutResourceCallback& callback);
125 virtual ~AboutGetRequest();
126
127 protected:
128 // Overridden from GetDataRequest.
129 virtual GURL GetURL() const OVERRIDE;
130
131 private:
132 const DriveApiUrlGenerator url_generator_;
133
134 DISALLOW_COPY_AND_ASSIGN(AboutGetRequest);
135 };
136
137 //============================= AppsListRequest ============================
138
139 // This class performs the request for fetching AppList.
140 // This request is mapped to
141 // https://developers.google.com/drive/v2/reference/apps/list
142 class AppsListRequest : public GetDataRequest {
143 public:
144 AppsListRequest(RequestSender* sender,
145 const DriveApiUrlGenerator& url_generator,
146 const AppListCallback& callback);
147 virtual ~AppsListRequest();
148
149 protected:
150 // Overridden from GetDataRequest.
151 virtual GURL GetURL() const OVERRIDE;
152
153 private:
154 const DriveApiUrlGenerator url_generator_;
155
156 DISALLOW_COPY_AND_ASSIGN(AppsListRequest);
157 };
158
156 //======================= ContinueGetFileListRequest ========================= 159 //======================= ContinueGetFileListRequest =========================
157 160
158 // This class performs the request to fetch remaining Filelist result. 161 // This class performs the request to fetch remaining Filelist result.
159 class ContinueGetFileListRequest : public GetDataRequest { 162 class ContinueGetFileListRequest : public GetDataRequest {
160 public: 163 public:
161 ContinueGetFileListRequest(RequestSender* sender, 164 ContinueGetFileListRequest(RequestSender* sender,
162 const GURL& url, 165 const GURL& url,
163 const GetDataCallback& callback); 166 const GetDataCallback& callback);
164 virtual ~ContinueGetFileListRequest(); 167 virtual ~ContinueGetFileListRequest();
165 168
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 const ProgressCallback& progress_callback); 553 const ProgressCallback& progress_callback);
551 virtual ~DownloadFileRequest(); 554 virtual ~DownloadFileRequest();
552 555
553 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); 556 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest);
554 }; 557 };
555 558
556 } // namespace drive 559 } // namespace drive
557 } // namespace google_apis 560 } // namespace google_apis
558 561
559 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_ 562 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_
OLDNEW
« no previous file with comments | « chrome/browser/drive/gdata_wapi_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