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_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" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 private: | 252 private: |
253 const DriveApiUrlGenerator url_generator_; | 253 const DriveApiUrlGenerator url_generator_; |
254 int max_results_; | 254 int max_results_; |
255 std::string page_token_; | 255 std::string page_token_; |
256 std::string q_; | 256 std::string q_; |
257 | 257 |
258 DISALLOW_COPY_AND_ASSIGN(FilesListRequest); | 258 DISALLOW_COPY_AND_ASSIGN(FilesListRequest); |
259 }; | 259 }; |
260 | 260 |
| 261 //=========================== TrashResourceRequest =========================== |
| 262 |
| 263 // This class performs the request for trashing a resource. |
| 264 // This request is mapped to |
| 265 // https://developers.google.com/drive/v2/reference/files/trash |
| 266 class FilesTrashRequest : public GetDataRequest { |
| 267 public: |
| 268 FilesTrashRequest(RequestSender* sender, |
| 269 const DriveApiUrlGenerator& url_generator, |
| 270 const FileResourceCallback& callback); |
| 271 virtual ~FilesTrashRequest(); |
| 272 |
| 273 // Required parameter. |
| 274 const std::string& file_id() const { return file_id_; } |
| 275 void set_file_id(const std::string& file_id) { file_id_ = file_id; } |
| 276 |
| 277 protected: |
| 278 // UrlFetchRequestBase overrides. |
| 279 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; |
| 280 virtual GURL GetURL() const OVERRIDE; |
| 281 |
| 282 private: |
| 283 const DriveApiUrlGenerator url_generator_; |
| 284 std::string file_id_; |
| 285 |
| 286 DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest); |
| 287 }; |
| 288 |
| 289 |
261 //============================== AboutGetRequest ============================= | 290 //============================== AboutGetRequest ============================= |
262 | 291 |
263 // This class performs the request for fetching About data. | 292 // This class performs the request for fetching About data. |
264 // This request is mapped to | 293 // This request is mapped to |
265 // https://developers.google.com/drive/v2/reference/about/get | 294 // https://developers.google.com/drive/v2/reference/about/get |
266 class AboutGetRequest : public GetDataRequest { | 295 class AboutGetRequest : public GetDataRequest { |
267 public: | 296 public: |
268 AboutGetRequest(RequestSender* sender, | 297 AboutGetRequest(RequestSender* sender, |
269 const DriveApiUrlGenerator& url_generator, | 298 const DriveApiUrlGenerator& url_generator, |
270 const AboutResourceCallback& callback); | 299 const AboutResourceCallback& callback); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 std::string* upload_content) OVERRIDE; | 463 std::string* upload_content) OVERRIDE; |
435 private: | 464 private: |
436 const DriveApiUrlGenerator url_generator_; | 465 const DriveApiUrlGenerator url_generator_; |
437 const std::string resource_id_; | 466 const std::string resource_id_; |
438 const std::string parent_resource_id_; | 467 const std::string parent_resource_id_; |
439 const std::string new_title_; | 468 const std::string new_title_; |
440 | 469 |
441 DISALLOW_COPY_AND_ASSIGN(MoveResourceRequest); | 470 DISALLOW_COPY_AND_ASSIGN(MoveResourceRequest); |
442 }; | 471 }; |
443 | 472 |
444 //=========================== TrashResourceRequest =========================== | |
445 | |
446 // This class performs the request for trashing a resource. | |
447 // | |
448 // According to the document: | |
449 // https://developers.google.com/drive/v2/reference/files/trash | |
450 // the file resource will be returned from the server, which is not in the | |
451 // response from WAPI server. For the transition, we simply ignore the result, | |
452 // because now we do not handle resources in trash. | |
453 // Note for the naming: the name "trash" comes from the server's request | |
454 // name. In order to be consistent with the server, we chose "trash" here, | |
455 // although we are preferring the term "remove" in drive/google_api code. | |
456 // TODO(hidehiko): Replace the base class to GetDataRequest. | |
457 class TrashResourceRequest : public EntryActionRequest { | |
458 public: | |
459 // |callback| must not be null. | |
460 TrashResourceRequest(RequestSender* sender, | |
461 const DriveApiUrlGenerator& url_generator, | |
462 const std::string& resource_id, | |
463 const EntryActionCallback& callback); | |
464 virtual ~TrashResourceRequest(); | |
465 | |
466 protected: | |
467 // UrlFetchRequestBase overrides. | |
468 virtual GURL GetURL() const OVERRIDE; | |
469 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; | |
470 | |
471 private: | |
472 const DriveApiUrlGenerator url_generator_; | |
473 const std::string resource_id_; | |
474 | |
475 DISALLOW_COPY_AND_ASSIGN(TrashResourceRequest); | |
476 }; | |
477 | |
478 //========================== InsertResourceRequest =========================== | 473 //========================== InsertResourceRequest =========================== |
479 | 474 |
480 // This class performs the request for inserting a resource to a directory. | 475 // This class performs the request for inserting a resource to a directory. |
481 // Note that this is the request of "Children: insert" of the Drive API v2. | 476 // Note that this is the request of "Children: insert" of the Drive API v2. |
482 // https://developers.google.com/drive/v2/reference/children/insert. | 477 // https://developers.google.com/drive/v2/reference/children/insert. |
483 class InsertResourceRequest : public EntryActionRequest { | 478 class InsertResourceRequest : public EntryActionRequest { |
484 public: | 479 public: |
485 // |callback| must not be null. | 480 // |callback| must not be null. |
486 InsertResourceRequest(RequestSender* sender, | 481 InsertResourceRequest(RequestSender* sender, |
487 const DriveApiUrlGenerator& url_generator, | 482 const DriveApiUrlGenerator& url_generator, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 const ProgressCallback& progress_callback); | 678 const ProgressCallback& progress_callback); |
684 virtual ~DownloadFileRequest(); | 679 virtual ~DownloadFileRequest(); |
685 | 680 |
686 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); | 681 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); |
687 }; | 682 }; |
688 | 683 |
689 } // namespace drive | 684 } // namespace drive |
690 } // namespace google_apis | 685 } // namespace google_apis |
691 | 686 |
692 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_ | 687 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_API_REQUESTS_H_ |
OLD | NEW |