OLD | NEW |
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_OPERATIONS_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 typedef base::Callback<void(GDataErrorCode error, | 25 typedef base::Callback<void(GDataErrorCode error, |
26 scoped_ptr<FileResource> entry)> | 26 scoped_ptr<FileResource> entry)> |
27 FileResourceCallback; | 27 FileResourceCallback; |
28 | 28 |
29 | 29 |
30 //============================== GetAboutOperation ============================= | 30 //============================== GetAboutOperation ============================= |
31 | 31 |
32 // This class performs the operation for fetching About data. | 32 // This class performs the operation for fetching About data. |
33 class GetAboutOperation : public GetDataRequest { | 33 class GetAboutOperation : public GetDataRequest { |
34 public: | 34 public: |
35 GetAboutOperation(OperationRunner* runner, | 35 GetAboutOperation(RequestSender* runner, |
36 net::URLRequestContextGetter* url_request_context_getter, | 36 net::URLRequestContextGetter* url_request_context_getter, |
37 const DriveApiUrlGenerator& url_generator, | 37 const DriveApiUrlGenerator& url_generator, |
38 const GetAboutResourceCallback& callback); | 38 const GetAboutResourceCallback& callback); |
39 virtual ~GetAboutOperation(); | 39 virtual ~GetAboutOperation(); |
40 | 40 |
41 protected: | 41 protected: |
42 // Overridden from GetDataRequest. | 42 // Overridden from GetDataRequest. |
43 virtual GURL GetURL() const OVERRIDE; | 43 virtual GURL GetURL() const OVERRIDE; |
44 | 44 |
45 private: | 45 private: |
46 const DriveApiUrlGenerator url_generator_; | 46 const DriveApiUrlGenerator url_generator_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(GetAboutOperation); | 48 DISALLOW_COPY_AND_ASSIGN(GetAboutOperation); |
49 }; | 49 }; |
50 | 50 |
51 //============================= GetApplistOperation ============================ | 51 //============================= GetApplistOperation ============================ |
52 | 52 |
53 // This class performs the operation for fetching Applist. | 53 // This class performs the operation for fetching Applist. |
54 class GetApplistOperation : public GetDataRequest { | 54 class GetApplistOperation : public GetDataRequest { |
55 public: | 55 public: |
56 GetApplistOperation(OperationRunner* runner, | 56 GetApplistOperation(RequestSender* runner, |
57 net::URLRequestContextGetter* url_request_context_getter, | 57 net::URLRequestContextGetter* url_request_context_getter, |
58 const DriveApiUrlGenerator& url_generator, | 58 const DriveApiUrlGenerator& url_generator, |
59 const GetDataCallback& callback); | 59 const GetDataCallback& callback); |
60 virtual ~GetApplistOperation(); | 60 virtual ~GetApplistOperation(); |
61 | 61 |
62 protected: | 62 protected: |
63 // Overridden from GetDataRequest. | 63 // Overridden from GetDataRequest. |
64 virtual GURL GetURL() const OVERRIDE; | 64 virtual GURL GetURL() const OVERRIDE; |
65 | 65 |
66 private: | 66 private: |
67 const DriveApiUrlGenerator url_generator_; | 67 const DriveApiUrlGenerator url_generator_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(GetApplistOperation); | 69 DISALLOW_COPY_AND_ASSIGN(GetApplistOperation); |
70 }; | 70 }; |
71 | 71 |
72 //============================ GetChangelistOperation ========================== | 72 //============================ GetChangelistOperation ========================== |
73 | 73 |
74 // This class performs the operation for fetching changelist. | 74 // This class performs the operation for fetching changelist. |
75 // The result may contain only first part of the result. The remaining result | 75 // The result may contain only first part of the result. The remaining result |
76 // should be able to be fetched by ContinueGetFileListOperation defined below. | 76 // should be able to be fetched by ContinueGetFileListOperation defined below. |
77 class GetChangelistOperation : public GetDataRequest { | 77 class GetChangelistOperation : public GetDataRequest { |
78 public: | 78 public: |
79 // |include_deleted| specifies if the response should contain the changes | 79 // |include_deleted| specifies if the response should contain the changes |
80 // for deleted entries or not. | 80 // for deleted entries or not. |
81 // |start_changestamp| specifies the starting point of change list or 0 if | 81 // |start_changestamp| specifies the starting point of change list or 0 if |
82 // all changes are necessary. | 82 // all changes are necessary. |
83 // |max_results| specifies the max of the number of files resource in the | 83 // |max_results| specifies the max of the number of files resource in the |
84 // response. | 84 // response. |
85 GetChangelistOperation( | 85 GetChangelistOperation( |
86 OperationRunner* runner, | 86 RequestSender* runner, |
87 net::URLRequestContextGetter* url_request_context_getter, | 87 net::URLRequestContextGetter* url_request_context_getter, |
88 const DriveApiUrlGenerator& url_generator, | 88 const DriveApiUrlGenerator& url_generator, |
89 bool include_deleted, | 89 bool include_deleted, |
90 int64 start_changestamp, | 90 int64 start_changestamp, |
91 int max_results, | 91 int max_results, |
92 const GetDataCallback& callback); | 92 const GetDataCallback& callback); |
93 virtual ~GetChangelistOperation(); | 93 virtual ~GetChangelistOperation(); |
94 | 94 |
95 protected: | 95 protected: |
96 // Overridden from GetDataRequest. | 96 // Overridden from GetDataRequest. |
97 virtual GURL GetURL() const OVERRIDE; | 97 virtual GURL GetURL() const OVERRIDE; |
98 | 98 |
99 private: | 99 private: |
100 const DriveApiUrlGenerator url_generator_; | 100 const DriveApiUrlGenerator url_generator_; |
101 const bool include_deleted_; | 101 const bool include_deleted_; |
102 const int64 start_changestamp_; | 102 const int64 start_changestamp_; |
103 const int max_results_; | 103 const int max_results_; |
104 | 104 |
105 DISALLOW_COPY_AND_ASSIGN(GetChangelistOperation); | 105 DISALLOW_COPY_AND_ASSIGN(GetChangelistOperation); |
106 }; | 106 }; |
107 | 107 |
108 //============================= GetFilelistOperation =========================== | 108 //============================= GetFilelistOperation =========================== |
109 | 109 |
110 // This class performs the operation for fetching Filelist. | 110 // This class performs the operation for fetching Filelist. |
111 // The result may contain only first part of the result. The remaining result | 111 // The result may contain only first part of the result. The remaining result |
112 // should be able to be fetched by ContinueGetFileListOperation defined below. | 112 // should be able to be fetched by ContinueGetFileListOperation defined below. |
113 class GetFilelistOperation : public GetDataRequest { | 113 class GetFilelistOperation : public GetDataRequest { |
114 public: | 114 public: |
115 GetFilelistOperation( | 115 GetFilelistOperation( |
116 OperationRunner* runner, | 116 RequestSender* runner, |
117 net::URLRequestContextGetter* url_request_context_getter, | 117 net::URLRequestContextGetter* url_request_context_getter, |
118 const DriveApiUrlGenerator& url_generator, | 118 const DriveApiUrlGenerator& url_generator, |
119 const std::string& search_string, | 119 const std::string& search_string, |
120 int max_results, | 120 int max_results, |
121 const GetDataCallback& callback); | 121 const GetDataCallback& callback); |
122 virtual ~GetFilelistOperation(); | 122 virtual ~GetFilelistOperation(); |
123 | 123 |
124 protected: | 124 protected: |
125 // Overridden from GetDataRequest. | 125 // Overridden from GetDataRequest. |
126 virtual GURL GetURL() const OVERRIDE; | 126 virtual GURL GetURL() const OVERRIDE; |
127 | 127 |
128 private: | 128 private: |
129 const DriveApiUrlGenerator url_generator_; | 129 const DriveApiUrlGenerator url_generator_; |
130 const std::string search_string_; | 130 const std::string search_string_; |
131 const int max_results_; | 131 const int max_results_; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(GetFilelistOperation); | 133 DISALLOW_COPY_AND_ASSIGN(GetFilelistOperation); |
134 }; | 134 }; |
135 | 135 |
136 //=============================== GetFileOperation ============================= | 136 //=============================== GetFileOperation ============================= |
137 | 137 |
138 // This class performs the operation for fetching a file. | 138 // This class performs the operation for fetching a file. |
139 class GetFileOperation : public GetDataRequest { | 139 class GetFileOperation : public GetDataRequest { |
140 public: | 140 public: |
141 GetFileOperation(OperationRunner* runner, | 141 GetFileOperation(RequestSender* runner, |
142 net::URLRequestContextGetter* url_request_context_getter, | 142 net::URLRequestContextGetter* url_request_context_getter, |
143 const DriveApiUrlGenerator& url_generator, | 143 const DriveApiUrlGenerator& url_generator, |
144 const std::string& file_id, | 144 const std::string& file_id, |
145 const FileResourceCallback& callback); | 145 const FileResourceCallback& callback); |
146 virtual ~GetFileOperation(); | 146 virtual ~GetFileOperation(); |
147 | 147 |
148 protected: | 148 protected: |
149 // Overridden from GetDataRequest. | 149 // Overridden from GetDataRequest. |
150 virtual GURL GetURL() const OVERRIDE; | 150 virtual GURL GetURL() const OVERRIDE; |
151 | 151 |
(...skipping 11 matching lines...) Expand all Loading... |
163 // TODO(hidehiko): Move all the operations defined in this file into drive | 163 // TODO(hidehiko): Move all the operations defined in this file into drive |
164 // namespace. crbug.com/180808 | 164 // namespace. crbug.com/180808 |
165 namespace drive { | 165 namespace drive { |
166 | 166 |
167 //======================= ContinueGetFileListOperation ========================= | 167 //======================= ContinueGetFileListOperation ========================= |
168 | 168 |
169 // This class performs the operation to fetch remaining Filelist result. | 169 // This class performs the operation to fetch remaining Filelist result. |
170 class ContinueGetFileListOperation : public GetDataRequest { | 170 class ContinueGetFileListOperation : public GetDataRequest { |
171 public: | 171 public: |
172 ContinueGetFileListOperation( | 172 ContinueGetFileListOperation( |
173 OperationRunner* runner, | 173 RequestSender* runner, |
174 net::URLRequestContextGetter* url_request_context_getter, | 174 net::URLRequestContextGetter* url_request_context_getter, |
175 const GURL& url, | 175 const GURL& url, |
176 const GetDataCallback& callback); | 176 const GetDataCallback& callback); |
177 virtual ~ContinueGetFileListOperation(); | 177 virtual ~ContinueGetFileListOperation(); |
178 | 178 |
179 protected: | 179 protected: |
180 virtual GURL GetURL() const OVERRIDE; | 180 virtual GURL GetURL() const OVERRIDE; |
181 | 181 |
182 private: | 182 private: |
183 const GURL url_; | 183 const GURL url_; |
184 | 184 |
185 DISALLOW_COPY_AND_ASSIGN(ContinueGetFileListOperation); | 185 DISALLOW_COPY_AND_ASSIGN(ContinueGetFileListOperation); |
186 }; | 186 }; |
187 | 187 |
188 //========================== CreateDirectoryOperation ========================== | 188 //========================== CreateDirectoryOperation ========================== |
189 | 189 |
190 // This class performs the operation for creating a directory. | 190 // This class performs the operation for creating a directory. |
191 class CreateDirectoryOperation : public GetDataRequest { | 191 class CreateDirectoryOperation : public GetDataRequest { |
192 public: | 192 public: |
193 CreateDirectoryOperation( | 193 CreateDirectoryOperation( |
194 OperationRunner* runner, | 194 RequestSender* runner, |
195 net::URLRequestContextGetter* url_request_context_getter, | 195 net::URLRequestContextGetter* url_request_context_getter, |
196 const DriveApiUrlGenerator& url_generator, | 196 const DriveApiUrlGenerator& url_generator, |
197 const std::string& parent_resource_id, | 197 const std::string& parent_resource_id, |
198 const std::string& directory_name, | 198 const std::string& directory_name, |
199 const FileResourceCallback& callback); | 199 const FileResourceCallback& callback); |
200 virtual ~CreateDirectoryOperation(); | 200 virtual ~CreateDirectoryOperation(); |
201 | 201 |
202 protected: | 202 protected: |
203 // Overridden from GetDataRequest. | 203 // Overridden from GetDataRequest. |
204 virtual GURL GetURL() const OVERRIDE; | 204 virtual GURL GetURL() const OVERRIDE; |
205 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 205 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
206 virtual bool GetContentData(std::string* upload_content_type, | 206 virtual bool GetContentData(std::string* upload_content_type, |
207 std::string* upload_content) OVERRIDE; | 207 std::string* upload_content) OVERRIDE; |
208 | 208 |
209 private: | 209 private: |
210 const DriveApiUrlGenerator url_generator_; | 210 const DriveApiUrlGenerator url_generator_; |
211 const std::string parent_resource_id_; | 211 const std::string parent_resource_id_; |
212 const std::string directory_name_; | 212 const std::string directory_name_; |
213 | 213 |
214 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); | 214 DISALLOW_COPY_AND_ASSIGN(CreateDirectoryOperation); |
215 }; | 215 }; |
216 | 216 |
217 //=========================== RenameResourceOperation ========================== | 217 //=========================== RenameResourceOperation ========================== |
218 | 218 |
219 // This class performs the operation for renaming a document/file/directory. | 219 // This class performs the operation for renaming a document/file/directory. |
220 class RenameResourceOperation : public EntryActionRequest { | 220 class RenameResourceOperation : public EntryActionRequest { |
221 public: | 221 public: |
222 // |callback| must not be null. | 222 // |callback| must not be null. |
223 RenameResourceOperation( | 223 RenameResourceOperation( |
224 OperationRunner* runner, | 224 RequestSender* runner, |
225 net::URLRequestContextGetter* url_request_context_getter, | 225 net::URLRequestContextGetter* url_request_context_getter, |
226 const DriveApiUrlGenerator& url_generator, | 226 const DriveApiUrlGenerator& url_generator, |
227 const std::string& resource_id, | 227 const std::string& resource_id, |
228 const std::string& new_name, | 228 const std::string& new_name, |
229 const EntryActionCallback& callback); | 229 const EntryActionCallback& callback); |
230 virtual ~RenameResourceOperation(); | 230 virtual ~RenameResourceOperation(); |
231 | 231 |
232 protected: | 232 protected: |
233 // UrlFetchRequestBase overrides. | 233 // UrlFetchRequestBase overrides. |
234 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 234 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
249 //=========================== TouchResourceOperation =========================== | 249 //=========================== TouchResourceOperation =========================== |
250 | 250 |
251 // This class performs the operation to touch a document/file/directory. | 251 // This class performs the operation to touch a document/file/directory. |
252 // This uses "files.patch" of Drive API v2 rather than "files.touch". See also: | 252 // This uses "files.patch" of Drive API v2 rather than "files.touch". See also: |
253 // https://developers.google.com/drive/v2/reference/files/patch, and | 253 // https://developers.google.com/drive/v2/reference/files/patch, and |
254 // https://developers.google.com/drive/v2/reference/files/touch | 254 // https://developers.google.com/drive/v2/reference/files/touch |
255 class TouchResourceOperation : public GetDataRequest { | 255 class TouchResourceOperation : public GetDataRequest { |
256 public: | 256 public: |
257 // |callback| must not be null. | 257 // |callback| must not be null. |
258 TouchResourceOperation( | 258 TouchResourceOperation( |
259 OperationRunner* runner, | 259 RequestSender* runner, |
260 net::URLRequestContextGetter* url_request_context_getter, | 260 net::URLRequestContextGetter* url_request_context_getter, |
261 const DriveApiUrlGenerator& url_generator, | 261 const DriveApiUrlGenerator& url_generator, |
262 const std::string& resource_id, | 262 const std::string& resource_id, |
263 const base::Time& modified_date, | 263 const base::Time& modified_date, |
264 const base::Time& last_viewed_by_me_date, | 264 const base::Time& last_viewed_by_me_date, |
265 const FileResourceCallback& callback); | 265 const FileResourceCallback& callback); |
266 virtual ~TouchResourceOperation(); | 266 virtual ~TouchResourceOperation(); |
267 | 267 |
268 protected: | 268 protected: |
269 // UrlFetchRequestBase overrides. | 269 // UrlFetchRequestBase overrides. |
(...skipping 22 matching lines...) Expand all Loading... |
292 // |parent_resource_id| can be empty. In the case, the copy will be created | 292 // |parent_resource_id| can be empty. In the case, the copy will be created |
293 // directly under the default root directory (this is the default behavior | 293 // directly under the default root directory (this is the default behavior |
294 // of Drive API v2's copy operation). | 294 // of Drive API v2's copy operation). |
295 // | 295 // |
296 // This operation corresponds to "Files: copy" operation on Drive API v2. See | 296 // This operation corresponds to "Files: copy" operation on Drive API v2. See |
297 // also: https://developers.google.com/drive/v2/reference/files/copy | 297 // also: https://developers.google.com/drive/v2/reference/files/copy |
298 class CopyResourceOperation : public GetDataRequest { | 298 class CopyResourceOperation : public GetDataRequest { |
299 public: | 299 public: |
300 // Upon completion, |callback| will be called. |callback| must not be null. | 300 // Upon completion, |callback| will be called. |callback| must not be null. |
301 CopyResourceOperation( | 301 CopyResourceOperation( |
302 OperationRunner* runner, | 302 RequestSender* runner, |
303 net::URLRequestContextGetter* url_request_context_getter, | 303 net::URLRequestContextGetter* url_request_context_getter, |
304 const DriveApiUrlGenerator& url_generator, | 304 const DriveApiUrlGenerator& url_generator, |
305 const std::string& resource_id, | 305 const std::string& resource_id, |
306 const std::string& parent_resource_id, | 306 const std::string& parent_resource_id, |
307 const std::string& new_name, | 307 const std::string& new_name, |
308 const FileResourceCallback& callback); | 308 const FileResourceCallback& callback); |
309 virtual ~CopyResourceOperation(); | 309 virtual ~CopyResourceOperation(); |
310 | 310 |
311 protected: | 311 protected: |
312 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 312 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
(...skipping 19 matching lines...) Expand all Loading... |
332 // response from WAPI server. For the transition, we simply ignore the result, | 332 // response from WAPI server. For the transition, we simply ignore the result, |
333 // because now we do not handle resources in trash. | 333 // because now we do not handle resources in trash. |
334 // Note for the naming: the name "trash" comes from the server's operation | 334 // Note for the naming: the name "trash" comes from the server's operation |
335 // name. In order to be consistent with the server, we chose "trash" here, | 335 // name. In order to be consistent with the server, we chose "trash" here, |
336 // although we are preferring the term "remove" in drive/google_api code. | 336 // although we are preferring the term "remove" in drive/google_api code. |
337 // TODO(hidehiko): Replace the base class to GetDataRequest. | 337 // TODO(hidehiko): Replace the base class to GetDataRequest. |
338 class TrashResourceOperation : public EntryActionRequest { | 338 class TrashResourceOperation : public EntryActionRequest { |
339 public: | 339 public: |
340 // |callback| must not be null. | 340 // |callback| must not be null. |
341 TrashResourceOperation( | 341 TrashResourceOperation( |
342 OperationRunner* runner, | 342 RequestSender* runner, |
343 net::URLRequestContextGetter* url_request_context_getter, | 343 net::URLRequestContextGetter* url_request_context_getter, |
344 const DriveApiUrlGenerator& url_generator, | 344 const DriveApiUrlGenerator& url_generator, |
345 const std::string& resource_id, | 345 const std::string& resource_id, |
346 const EntryActionCallback& callback); | 346 const EntryActionCallback& callback); |
347 virtual ~TrashResourceOperation(); | 347 virtual ~TrashResourceOperation(); |
348 | 348 |
349 protected: | 349 protected: |
350 // UrlFetchRequestBase overrides. | 350 // UrlFetchRequestBase overrides. |
351 virtual GURL GetURL() const OVERRIDE; | 351 virtual GURL GetURL() const OVERRIDE; |
352 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | 352 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
353 | 353 |
354 private: | 354 private: |
355 const DriveApiUrlGenerator url_generator_; | 355 const DriveApiUrlGenerator url_generator_; |
356 const std::string resource_id_; | 356 const std::string resource_id_; |
357 | 357 |
358 DISALLOW_COPY_AND_ASSIGN(TrashResourceOperation); | 358 DISALLOW_COPY_AND_ASSIGN(TrashResourceOperation); |
359 }; | 359 }; |
360 | 360 |
361 //========================== InsertResourceOperation =========================== | 361 //========================== InsertResourceOperation =========================== |
362 | 362 |
363 // This class performs the operation for inserting a resource to a directory. | 363 // This class performs the operation for inserting a resource to a directory. |
364 // Note that this is the operation of "Children: insert" of the Drive API v2. | 364 // Note that this is the operation of "Children: insert" of the Drive API v2. |
365 // https://developers.google.com/drive/v2/reference/children/insert. | 365 // https://developers.google.com/drive/v2/reference/children/insert. |
366 class InsertResourceOperation : public EntryActionRequest { | 366 class InsertResourceOperation : public EntryActionRequest { |
367 public: | 367 public: |
368 // |callback| must not be null. | 368 // |callback| must not be null. |
369 InsertResourceOperation( | 369 InsertResourceOperation( |
370 OperationRunner* runner, | 370 RequestSender* runner, |
371 net::URLRequestContextGetter* url_request_context_getter, | 371 net::URLRequestContextGetter* url_request_context_getter, |
372 const DriveApiUrlGenerator& url_generator, | 372 const DriveApiUrlGenerator& url_generator, |
373 const std::string& parent_resource_id, | 373 const std::string& parent_resource_id, |
374 const std::string& resource_id, | 374 const std::string& resource_id, |
375 const EntryActionCallback& callback); | 375 const EntryActionCallback& callback); |
376 virtual ~InsertResourceOperation(); | 376 virtual ~InsertResourceOperation(); |
377 | 377 |
378 protected: | 378 protected: |
379 // UrlFetchRequestBase overrides. | 379 // UrlFetchRequestBase overrides. |
380 virtual GURL GetURL() const OVERRIDE; | 380 virtual GURL GetURL() const OVERRIDE; |
(...skipping 14 matching lines...) Expand all Loading... |
395 // This class performs the operation for removing a resource from a directory. | 395 // This class performs the operation for removing a resource from a directory. |
396 // Note that we use "delete" for the name of this class, which comes from the | 396 // Note that we use "delete" for the name of this class, which comes from the |
397 // operation name of the Drive API v2, although we prefer "remove" for that | 397 // operation name of the Drive API v2, although we prefer "remove" for that |
398 // sense in "drive/google_api" | 398 // sense in "drive/google_api" |
399 // Also note that this is the operation of "Children: delete" of the Drive API | 399 // Also note that this is the operation of "Children: delete" of the Drive API |
400 // v2. https://developers.google.com/drive/v2/reference/children/delete | 400 // v2. https://developers.google.com/drive/v2/reference/children/delete |
401 class DeleteResourceOperation : public EntryActionRequest { | 401 class DeleteResourceOperation : public EntryActionRequest { |
402 public: | 402 public: |
403 // |callback| must not be null. | 403 // |callback| must not be null. |
404 DeleteResourceOperation( | 404 DeleteResourceOperation( |
405 OperationRunner* runner, | 405 RequestSender* runner, |
406 net::URLRequestContextGetter* url_request_context_getter, | 406 net::URLRequestContextGetter* url_request_context_getter, |
407 const DriveApiUrlGenerator& url_generator, | 407 const DriveApiUrlGenerator& url_generator, |
408 const std::string& parent_resource_id, | 408 const std::string& parent_resource_id, |
409 const std::string& resource_id, | 409 const std::string& resource_id, |
410 const EntryActionCallback& callback); | 410 const EntryActionCallback& callback); |
411 virtual ~DeleteResourceOperation(); | 411 virtual ~DeleteResourceOperation(); |
412 | 412 |
413 protected: | 413 protected: |
414 // UrlFetchRequestBase overrides. | 414 // UrlFetchRequestBase overrides. |
415 virtual GURL GetURL() const OVERRIDE; | 415 virtual GURL GetURL() const OVERRIDE; |
(...skipping 10 matching lines...) Expand all Loading... |
426 //======================= InitiateUploadNewFileOperation ======================= | 426 //======================= InitiateUploadNewFileOperation ======================= |
427 | 427 |
428 // This class performs the operation for initiating the upload of a new file. | 428 // This class performs the operation for initiating the upload of a new file. |
429 class InitiateUploadNewFileOperation : public InitiateUploadRequestBase { | 429 class InitiateUploadNewFileOperation : public InitiateUploadRequestBase { |
430 public: | 430 public: |
431 // |parent_resource_id| should be the resource id of the parent directory. | 431 // |parent_resource_id| should be the resource id of the parent directory. |
432 // |title| should be set. | 432 // |title| should be set. |
433 // See also the comments of InitiateUploadRequestBase for more details | 433 // See also the comments of InitiateUploadRequestBase for more details |
434 // about the other parameters. | 434 // about the other parameters. |
435 InitiateUploadNewFileOperation( | 435 InitiateUploadNewFileOperation( |
436 OperationRunner* runner, | 436 RequestSender* runner, |
437 net::URLRequestContextGetter* url_request_context_getter, | 437 net::URLRequestContextGetter* url_request_context_getter, |
438 const DriveApiUrlGenerator& url_generator, | 438 const DriveApiUrlGenerator& url_generator, |
439 const base::FilePath& drive_file_path, | 439 const base::FilePath& drive_file_path, |
440 const std::string& content_type, | 440 const std::string& content_type, |
441 int64 content_length, | 441 int64 content_length, |
442 const std::string& parent_resource_id, | 442 const std::string& parent_resource_id, |
443 const std::string& title, | 443 const std::string& title, |
444 const InitiateUploadCallback& callback); | 444 const InitiateUploadCallback& callback); |
445 virtual ~InitiateUploadNewFileOperation(); | 445 virtual ~InitiateUploadNewFileOperation(); |
446 | 446 |
(...skipping 18 matching lines...) Expand all Loading... |
465 // file. | 465 // file. |
466 class InitiateUploadExistingFileOperation | 466 class InitiateUploadExistingFileOperation |
467 : public InitiateUploadRequestBase { | 467 : public InitiateUploadRequestBase { |
468 public: | 468 public: |
469 // |upload_url| should be the upload_url() of the file | 469 // |upload_url| should be the upload_url() of the file |
470 // (resumable-create-media URL) | 470 // (resumable-create-media URL) |
471 // |etag| should be set if it is available to detect the upload confliction. | 471 // |etag| should be set if it is available to detect the upload confliction. |
472 // See also the comments of InitiateUploadRequestBase for more details | 472 // See also the comments of InitiateUploadRequestBase for more details |
473 // about the other parameters. | 473 // about the other parameters. |
474 InitiateUploadExistingFileOperation( | 474 InitiateUploadExistingFileOperation( |
475 OperationRunner* runner, | 475 RequestSender* runner, |
476 net::URLRequestContextGetter* url_request_context_getter, | 476 net::URLRequestContextGetter* url_request_context_getter, |
477 const DriveApiUrlGenerator& url_generator, | 477 const DriveApiUrlGenerator& url_generator, |
478 const base::FilePath& drive_file_path, | 478 const base::FilePath& drive_file_path, |
479 const std::string& content_type, | 479 const std::string& content_type, |
480 int64 content_length, | 480 int64 content_length, |
481 const std::string& resource_id, | 481 const std::string& resource_id, |
482 const std::string& etag, | 482 const std::string& etag, |
483 const InitiateUploadCallback& callback); | 483 const InitiateUploadCallback& callback); |
484 virtual ~InitiateUploadExistingFileOperation(); | 484 virtual ~InitiateUploadExistingFileOperation(); |
485 | 485 |
(...skipping 17 matching lines...) Expand all Loading... |
503 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; | 503 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; |
504 | 504 |
505 //============================ ResumeUploadOperation =========================== | 505 //============================ ResumeUploadOperation =========================== |
506 | 506 |
507 // Performs the operation for resuming the upload of a file. | 507 // Performs the operation for resuming the upload of a file. |
508 class ResumeUploadOperation : public ResumeUploadRequestBase { | 508 class ResumeUploadOperation : public ResumeUploadRequestBase { |
509 public: | 509 public: |
510 // See also ResumeUploadRequestBase's comment for parameters meaning. | 510 // See also ResumeUploadRequestBase's comment for parameters meaning. |
511 // |callback| must not be null. |progress_callback| may be null. | 511 // |callback| must not be null. |progress_callback| may be null. |
512 ResumeUploadOperation( | 512 ResumeUploadOperation( |
513 OperationRunner* runner, | 513 RequestSender* runner, |
514 net::URLRequestContextGetter* url_request_context_getter, | 514 net::URLRequestContextGetter* url_request_context_getter, |
515 const base::FilePath& drive_file_path, | 515 const base::FilePath& drive_file_path, |
516 const GURL& upload_location, | 516 const GURL& upload_location, |
517 int64 start_position, | 517 int64 start_position, |
518 int64 end_position, | 518 int64 end_position, |
519 int64 content_length, | 519 int64 content_length, |
520 const std::string& content_type, | 520 const std::string& content_type, |
521 const base::FilePath& local_file_path, | 521 const base::FilePath& local_file_path, |
522 const UploadRangeCallback& callback, | 522 const UploadRangeCallback& callback, |
523 const ProgressCallback& progress_callback); | 523 const ProgressCallback& progress_callback); |
(...skipping 16 matching lines...) Expand all Loading... |
540 }; | 540 }; |
541 | 541 |
542 //========================== GetUploadStatusOperation ========================== | 542 //========================== GetUploadStatusOperation ========================== |
543 | 543 |
544 // Performs the operation to request the current upload status of a file. | 544 // Performs the operation to request the current upload status of a file. |
545 class GetUploadStatusOperation : public GetUploadStatusRequestBase { | 545 class GetUploadStatusOperation : public GetUploadStatusRequestBase { |
546 public: | 546 public: |
547 // See also GetUploadStatusRequestBase's comment for parameters meaning. | 547 // See also GetUploadStatusRequestBase's comment for parameters meaning. |
548 // |callback| must not be null. | 548 // |callback| must not be null. |
549 GetUploadStatusOperation( | 549 GetUploadStatusOperation( |
550 OperationRunner* runner, | 550 RequestSender* runner, |
551 net::URLRequestContextGetter* url_request_context_getter, | 551 net::URLRequestContextGetter* url_request_context_getter, |
552 const base::FilePath& drive_file_path, | 552 const base::FilePath& drive_file_path, |
553 const GURL& upload_url, | 553 const GURL& upload_url, |
554 int64 content_length, | 554 int64 content_length, |
555 const UploadRangeCallback& callback); | 555 const UploadRangeCallback& callback); |
556 virtual ~GetUploadStatusOperation(); | 556 virtual ~GetUploadStatusOperation(); |
557 | 557 |
558 protected: | 558 protected: |
559 // UploadRangeRequestBase overrides. | 559 // UploadRangeRequestBase overrides. |
560 virtual void OnRangeRequestComplete( | 560 virtual void OnRangeRequestComplete( |
561 const UploadRangeResponse& response, | 561 const UploadRangeResponse& response, |
562 scoped_ptr<base::Value> value) OVERRIDE; | 562 scoped_ptr<base::Value> value) OVERRIDE; |
563 | 563 |
564 private: | 564 private: |
565 const UploadRangeCallback callback_; | 565 const UploadRangeCallback callback_; |
566 | 566 |
567 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusOperation); | 567 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusOperation); |
568 }; | 568 }; |
569 | 569 |
570 | 570 |
571 } // namespace drive | 571 } // namespace drive |
572 } // namespace google_apis | 572 } // namespace google_apis |
573 | 573 |
574 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ | 574 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_OPERATIONS_H_ |
OLD | NEW |