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 3// found in the LICENSE file. 4 5#ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 6#define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 7 8#include <string> 9 10#include "base/callback_forward.h" 11#include "base/time/time.h" 12#include "google_apis/drive/base_requests.h" 13#include "google_apis/drive/drive_api_url_generator.h" 14#include "google_apis/drive/drive_common_callbacks.h" 15 16namespace google_apis { 17 18class ChangeList; 19class FileResource; 20class FileList; 21 22// Callback used for requests that the server returns FileResource data 23// formatted into JSON value. 24typedef base::Callback<void(GDataErrorCode error, 25 scoped_ptr<FileResource> entry)> 26 FileResourceCallback; 27 28// Callback used for requests that the server returns FileList data 29// formatted into JSON value. 30typedef base::Callback<void(GDataErrorCode error, 31 scoped_ptr<FileList> entry)> FileListCallback; 32 33// Callback used for requests that the server returns ChangeList data 34// formatted into JSON value. 35typedef base::Callback<void(GDataErrorCode error, 36 scoped_ptr<ChangeList> entry)> ChangeListCallback; 37 38namespace drive { 39 40//============================ DriveApiDataRequest =========================== 41 42// This is base class of the Drive API related requests. All Drive API requests 43// support partial request (to improve the performance). The function can be 44// shared among the Drive API requests. 45// See also https://developers.google.com/drive/performance 46class DriveApiDataRequest : public GetDataRequest { 47 public: 48 DriveApiDataRequest(RequestSender* sender, const GetDataCallback& callback); 49 virtual ~DriveApiDataRequest(); 50 51 // Optional parameter. 52 const std::string& fields() const { return fields_; } 53 void set_fields(const std::string& fields) { fields_ = fields; } 54 55 protected: 56 // Overridden from GetDataRequest. 57 virtual GURL GetURL() const OVERRIDE; 58 59 // Derived classes should override GetURLInternal instead of GetURL() 60 // directly. 61 virtual GURL GetURLInternal() const = 0; 62 63 private: 64 std::string fields_; 65 66 DISALLOW_COPY_AND_ASSIGN(DriveApiDataRequest); 67}; 68 69//=============================== FilesGetRequest ============================= 70 71// This class performs the request for fetching a file. 72// This request is mapped to 73// https://developers.google.com/drive/v2/reference/files/get 74class FilesGetRequest : public DriveApiDataRequest { 75 public: 76 FilesGetRequest(RequestSender* sender, 77 const DriveApiUrlGenerator& url_generator, 78 const FileResourceCallback& callback); 79 virtual ~FilesGetRequest(); 80 81 // Required parameter. 82 const std::string& file_id() const { return file_id_; } 83 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 84 85 protected: 86 // Overridden from DriveApiDataRequest. 87 virtual GURL GetURLInternal() const OVERRIDE; 88 89 private: 90 const DriveApiUrlGenerator url_generator_; 91 std::string file_id_; 92 93 DISALLOW_COPY_AND_ASSIGN(FilesGetRequest); 94}; 95 96//============================ FilesInsertRequest ============================= 97 98// This class performs the request for creating a resource. 99// This request is mapped to 100// https://developers.google.com/drive/v2/reference/files/insert 101// See also https://developers.google.com/drive/manage-uploads and 102// https://developers.google.com/drive/folder 103class FilesInsertRequest : public DriveApiDataRequest { 104 public: 105 FilesInsertRequest(RequestSender* sender, 106 const DriveApiUrlGenerator& url_generator, 107 const FileResourceCallback& callback); 108 virtual ~FilesInsertRequest(); 109 110 // Optional request body. 111 const std::string& mime_type() const { return mime_type_; } 112 void set_mime_type(const std::string& mime_type) { 113 mime_type_ = mime_type; 114 } 115 116 const std::vector<std::string>& parents() const { return parents_; } 117 void add_parent(const std::string& parent) { parents_.push_back(parent); } 118 119 const std::string& title() const { return title_; } 120 void set_title(const std::string& title) { title_ = title; } 121 122 protected: 123 // Overridden from GetDataRequest. 124 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 125 virtual bool GetContentData(std::string* upload_content_type, 126 std::string* upload_content) OVERRIDE; 127 128 // Overridden from DriveApiDataRequest. 129 virtual GURL GetURLInternal() const OVERRIDE; 130 131 private: 132 const DriveApiUrlGenerator url_generator_; 133 134 std::string mime_type_; 135 std::vector<std::string> parents_; 136 std::string title_; 137 138 DISALLOW_COPY_AND_ASSIGN(FilesInsertRequest); 139}; 140 141//============================== FilesPatchRequest ============================ 142 143// This class performs the request for patching file metadata. 144// This request is mapped to 145// https://developers.google.com/drive/v2/reference/files/patch 146class FilesPatchRequest : public DriveApiDataRequest { 147 public: 148 FilesPatchRequest(RequestSender* sender, 149 const DriveApiUrlGenerator& url_generator, 150 const FileResourceCallback& callback); 151 virtual ~FilesPatchRequest(); 152 153 // Required parameter. 154 const std::string& file_id() const { return file_id_; } 155 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 156 157 // Optional parameter. 158 bool set_modified_date() const { return set_modified_date_; } 159 void set_set_modified_date(bool set_modified_date) { 160 set_modified_date_ = set_modified_date; 161 } 162 163 bool update_viewed_date() const { return update_viewed_date_; } 164 void set_update_viewed_date(bool update_viewed_date) { 165 update_viewed_date_ = update_viewed_date; 166 } 167 168 // Optional request body. 169 // Note: "Files: patch" accepts any "Files resource" data, but this class 170 // only supports limited members of it for now. We can extend it upon 171 // requirments. 172 const std::string& title() const { return title_; } 173 void set_title(const std::string& title) { title_ = title; } 174 175 const base::Time& modified_date() const { return modified_date_; } 176 void set_modified_date(const base::Time& modified_date) { 177 modified_date_ = modified_date; 178 } 179 180 const base::Time& last_viewed_by_me_date() const { 181 return last_viewed_by_me_date_; 182 } 183 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) { 184 last_viewed_by_me_date_ = last_viewed_by_me_date; 185 } 186 187 const std::vector<std::string>& parents() const { return parents_; } 188 void add_parent(const std::string& parent) { parents_.push_back(parent); } 189 190 protected: 191 // Overridden from URLFetchRequestBase. 192 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 193 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 194 virtual bool GetContentData(std::string* upload_content_type, 195 std::string* upload_content) OVERRIDE; 196 197 // Overridden from DriveApiDataRequest. 198 virtual GURL GetURLInternal() const OVERRIDE; 199 200 private: 201 const DriveApiUrlGenerator url_generator_; 202 203 std::string file_id_; 204 bool set_modified_date_; 205 bool update_viewed_date_; 206 207 std::string title_; 208 base::Time modified_date_; 209 base::Time last_viewed_by_me_date_; 210 std::vector<std::string> parents_; 211 212 DISALLOW_COPY_AND_ASSIGN(FilesPatchRequest); 213}; 214 215//============================= FilesCopyRequest ============================== 216 217// This class performs the request for copying a resource. 218// This request is mapped to 219// https://developers.google.com/drive/v2/reference/files/copy 220class FilesCopyRequest : public DriveApiDataRequest { 221 public: 222 // Upon completion, |callback| will be called. |callback| must not be null. 223 FilesCopyRequest(RequestSender* sender, 224 const DriveApiUrlGenerator& url_generator, 225 const FileResourceCallback& callback); 226 virtual ~FilesCopyRequest(); 227 228 // Required parameter. 229 const std::string& file_id() const { return file_id_; } 230 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 231 232 // Optional request body. 233 const std::vector<std::string>& parents() const { return parents_; } 234 void add_parent(const std::string& parent) { parents_.push_back(parent); } 235 236 const base::Time& modified_date() const { return modified_date_; } 237 void set_modified_date(const base::Time& modified_date) { 238 modified_date_ = modified_date; 239 } 240 241 const std::string& title() const { return title_; } 242 void set_title(const std::string& title) { title_ = title; } 243 244 protected: 245 // Overridden from URLFetchRequestBase. 246 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 247 virtual bool GetContentData(std::string* upload_content_type, 248 std::string* upload_content) OVERRIDE; 249 250 // Overridden from DriveApiDataRequest. 251 virtual GURL GetURLInternal() const OVERRIDE; 252 253 private: 254 const DriveApiUrlGenerator url_generator_; 255 256 std::string file_id_; 257 base::Time modified_date_; 258 std::vector<std::string> parents_; 259 std::string title_; 260 261 DISALLOW_COPY_AND_ASSIGN(FilesCopyRequest); 262}; 263 264//============================= FilesListRequest ============================= 265 266// This class performs the request for fetching FileList. 267// The result may contain only first part of the result. The remaining result 268// should be able to be fetched by ContinueGetFileListRequest defined below, 269// or by FilesListRequest with setting page token. 270// This request is mapped to 271// https://developers.google.com/drive/v2/reference/files/list 272class FilesListRequest : public DriveApiDataRequest { 273 public: 274 FilesListRequest(RequestSender* sender, 275 const DriveApiUrlGenerator& url_generator, 276 const FileListCallback& callback); 277 virtual ~FilesListRequest(); 278 279 // Optional parameter 280 int max_results() const { return max_results_; } 281 void set_max_results(int max_results) { max_results_ = max_results; } 282 283 const std::string& page_token() const { return page_token_; } 284 void set_page_token(const std::string& page_token) { 285 page_token_ = page_token; 286 } 287 288 const std::string& q() const { return q_; } 289 void set_q(const std::string& q) { q_ = q; } 290 291 protected: 292 // Overridden from DriveApiDataRequest. 293 virtual GURL GetURLInternal() const OVERRIDE; 294 295 private: 296 const DriveApiUrlGenerator url_generator_; 297 int max_results_; 298 std::string page_token_; 299 std::string q_; 300 301 DISALLOW_COPY_AND_ASSIGN(FilesListRequest); 302}; 303 304//========================= FilesListNextPageRequest ========================== 305 306// There are two ways to obtain next pages of "Files: list" result (if paged). 307// 1) Set pageToken and all params used for the initial request. 308// 2) Use URL in the nextLink field in the previous response. 309// This class implements 2)'s request. 310class FilesListNextPageRequest : public DriveApiDataRequest { 311 public: 312 FilesListNextPageRequest(RequestSender* sender, 313 const FileListCallback& callback); 314 virtual ~FilesListNextPageRequest(); 315 316 const GURL& next_link() const { return next_link_; } 317 void set_next_link(const GURL& next_link) { next_link_ = next_link; } 318 319 protected: 320 // Overridden from DriveApiDataRequest. 321 virtual GURL GetURLInternal() const OVERRIDE; 322 323 private: 324 GURL next_link_; 325 326 DISALLOW_COPY_AND_ASSIGN(FilesListNextPageRequest); 327}; 328 329//============================= FilesDeleteRequest ============================= 330 331// This class performs the request for deleting a resource. 332// This request is mapped to 333// https://developers.google.com/drive/v2/reference/files/delete 334class FilesDeleteRequest : public EntryActionRequest { 335 public: 336 FilesDeleteRequest(RequestSender* sender, 337 const DriveApiUrlGenerator& url_generator, 338 const EntryActionCallback& callback); 339 virtual ~FilesDeleteRequest(); 340 341 // Required parameter. 342 const std::string& file_id() const { return file_id_; } 343 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 344 void set_etag(const std::string& etag) { etag_ = etag; } 345 346 protected: 347 // Overridden from UrlFetchRequestBase. 348 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 349 virtual GURL GetURL() const OVERRIDE; 350 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 351 352 private: 353 const DriveApiUrlGenerator url_generator_; 354 std::string file_id_; 355 std::string etag_; 356 357 DISALLOW_COPY_AND_ASSIGN(FilesDeleteRequest); 358}; 359 360//============================= FilesTrashRequest ============================== 361 362// This class performs the request for trashing a resource. 363// This request is mapped to 364// https://developers.google.com/drive/v2/reference/files/trash 365class FilesTrashRequest : public DriveApiDataRequest { 366 public: 367 FilesTrashRequest(RequestSender* sender, 368 const DriveApiUrlGenerator& url_generator, 369 const FileResourceCallback& callback); 370 virtual ~FilesTrashRequest(); 371 372 // Required parameter. 373 const std::string& file_id() const { return file_id_; } 374 void set_file_id(const std::string& file_id) { file_id_ = file_id; } 375 376 protected: 377 // Overridden from UrlFetchRequestBase. 378 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 379 380 // Overridden from DriveApiDataRequest. 381 virtual GURL GetURLInternal() const OVERRIDE; 382 383 private: 384 const DriveApiUrlGenerator url_generator_; 385 std::string file_id_; 386 387 DISALLOW_COPY_AND_ASSIGN(FilesTrashRequest); 388}; 389 390//============================== AboutGetRequest ============================= 391 392// This class performs the request for fetching About data. 393// This request is mapped to 394// https://developers.google.com/drive/v2/reference/about/get 395class AboutGetRequest : public DriveApiDataRequest { 396 public: 397 AboutGetRequest(RequestSender* sender, 398 const DriveApiUrlGenerator& url_generator, 399 const AboutResourceCallback& callback); 400 virtual ~AboutGetRequest(); 401 402 protected: 403 // Overridden from DriveApiDataRequest. 404 virtual GURL GetURLInternal() const OVERRIDE; 405 406 private: 407 const DriveApiUrlGenerator url_generator_; 408 409 DISALLOW_COPY_AND_ASSIGN(AboutGetRequest); 410}; 411 412//============================ ChangesListRequest ============================ 413 414// This class performs the request for fetching ChangeList. 415// The result may contain only first part of the result. The remaining result 416// should be able to be fetched by ContinueGetFileListRequest defined below. 417// or by ChangesListRequest with setting page token. 418// This request is mapped to 419// https://developers.google.com/drive/v2/reference/changes/list 420class ChangesListRequest : public DriveApiDataRequest { 421 public: 422 ChangesListRequest(RequestSender* sender, 423 const DriveApiUrlGenerator& url_generator, 424 const ChangeListCallback& callback); 425 virtual ~ChangesListRequest(); 426 427 // Optional parameter 428 bool include_deleted() const { return include_deleted_; } 429 void set_include_deleted(bool include_deleted) { 430 include_deleted_ = include_deleted; 431 } 432 433 int max_results() const { return max_results_; } 434 void set_max_results(int max_results) { max_results_ = max_results; } 435 436 const std::string& page_token() const { return page_token_; } 437 void set_page_token(const std::string& page_token) { 438 page_token_ = page_token; 439 } 440 441 int64 start_change_id() const { return start_change_id_; } 442 void set_start_change_id(int64 start_change_id) { 443 start_change_id_ = start_change_id; 444 } 445 446 protected: 447 // Overridden from DriveApiDataRequest. 448 virtual GURL GetURLInternal() const OVERRIDE; 449 450 private: 451 const DriveApiUrlGenerator url_generator_; 452 bool include_deleted_; 453 int max_results_; 454 std::string page_token_; 455 int64 start_change_id_; 456 457 DISALLOW_COPY_AND_ASSIGN(ChangesListRequest); 458}; 459 460//======================== ChangesListNextPageRequest ========================= 461 462// There are two ways to obtain next pages of "Changes: list" result (if paged). 463// 1) Set pageToken and all params used for the initial request. 464// 2) Use URL in the nextLink field in the previous response. 465// This class implements 2)'s request. 466class ChangesListNextPageRequest : public DriveApiDataRequest { 467 public: 468 ChangesListNextPageRequest(RequestSender* sender, 469 const ChangeListCallback& callback); 470 virtual ~ChangesListNextPageRequest(); 471 472 const GURL& next_link() const { return next_link_; } 473 void set_next_link(const GURL& next_link) { next_link_ = next_link; } 474 475 protected: 476 // Overridden from DriveApiDataRequest. 477 virtual GURL GetURLInternal() const OVERRIDE; 478 479 private: 480 GURL next_link_; 481 482 DISALLOW_COPY_AND_ASSIGN(ChangesListNextPageRequest); 483}; 484 485//============================= AppsListRequest ============================ 486 487// This class performs the request for fetching AppList. 488// This request is mapped to 489// https://developers.google.com/drive/v2/reference/apps/list 490class AppsListRequest : public DriveApiDataRequest { 491 public: 492 AppsListRequest(RequestSender* sender, 493 const DriveApiUrlGenerator& url_generator, 494 const AppListCallback& callback); 495 virtual ~AppsListRequest(); 496 497 protected: 498 // Overridden from DriveApiDataRequest. 499 virtual GURL GetURLInternal() const OVERRIDE; 500 501 private: 502 const DriveApiUrlGenerator url_generator_; 503 504 DISALLOW_COPY_AND_ASSIGN(AppsListRequest); 505}; 506 507//========================== ChildrenInsertRequest ============================ 508 509// This class performs the request for inserting a resource to a directory. 510// This request is mapped to 511// https://developers.google.com/drive/v2/reference/children/insert 512class ChildrenInsertRequest : public EntryActionRequest { 513 public: 514 ChildrenInsertRequest(RequestSender* sender, 515 const DriveApiUrlGenerator& url_generator, 516 const EntryActionCallback& callback); 517 virtual ~ChildrenInsertRequest(); 518 519 // Required parameter. 520 const std::string& folder_id() const { return folder_id_; } 521 void set_folder_id(const std::string& folder_id) { 522 folder_id_ = folder_id; 523 } 524 525 // Required body. 526 const std::string& id() const { return id_; } 527 void set_id(const std::string& id) { id_ = id; } 528 529 protected: 530 // UrlFetchRequestBase overrides. 531 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 532 virtual GURL GetURL() const OVERRIDE; 533 virtual bool GetContentData(std::string* upload_content_type, 534 std::string* upload_content) OVERRIDE; 535 536 private: 537 const DriveApiUrlGenerator url_generator_; 538 std::string folder_id_; 539 std::string id_; 540 541 DISALLOW_COPY_AND_ASSIGN(ChildrenInsertRequest); 542}; 543 544//========================== ChildrenDeleteRequest ============================ 545 546// This class performs the request for removing a resource from a directory. 547// This request is mapped to 548// https://developers.google.com/drive/v2/reference/children/delete 549class ChildrenDeleteRequest : public EntryActionRequest { 550 public: 551 // |callback| must not be null. 552 ChildrenDeleteRequest(RequestSender* sender, 553 const DriveApiUrlGenerator& url_generator, 554 const EntryActionCallback& callback); 555 virtual ~ChildrenDeleteRequest(); 556 557 // Required parameter. 558 const std::string& child_id() const { return child_id_; } 559 void set_child_id(const std::string& child_id) { 560 child_id_ = child_id; 561 } 562 563 const std::string& folder_id() const { return folder_id_; } 564 void set_folder_id(const std::string& folder_id) { 565 folder_id_ = folder_id; 566 } 567 568 protected: 569 // UrlFetchRequestBase overrides. 570 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 571 virtual GURL GetURL() const OVERRIDE; 572 573 private: 574 const DriveApiUrlGenerator url_generator_; 575 std::string child_id_; 576 std::string folder_id_; 577 578 DISALLOW_COPY_AND_ASSIGN(ChildrenDeleteRequest); 579}; 580 581//======================= InitiateUploadNewFileRequest ======================= 582 583// This class performs the request for initiating the upload of a new file. 584class InitiateUploadNewFileRequest : public InitiateUploadRequestBase { 585 public: 586 // |parent_resource_id| should be the resource id of the parent directory. 587 // |title| should be set. 588 // See also the comments of InitiateUploadRequestBase for more details 589 // about the other parameters. 590 InitiateUploadNewFileRequest(RequestSender* sender, 591 const DriveApiUrlGenerator& url_generator, 592 const std::string& content_type, 593 int64 content_length, 594 const std::string& parent_resource_id, 595 const std::string& title, 596 const InitiateUploadCallback& callback); 597 virtual ~InitiateUploadNewFileRequest(); 598 599 protected: 600 // UrlFetchRequestBase overrides. 601 virtual GURL GetURL() const OVERRIDE; 602 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 603 virtual bool GetContentData(std::string* upload_content_type, 604 std::string* upload_content) OVERRIDE; 605 606 private: 607 const DriveApiUrlGenerator url_generator_; 608 const std::string parent_resource_id_; 609 const std::string title_; 610 611 DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest); 612}; 613 614//==================== InitiateUploadExistingFileRequest ===================== 615 616// This class performs the request for initiating the upload of an existing 617// file. 618class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { 619 public: 620 // |upload_url| should be the upload_url() of the file 621 // (resumable-create-media URL) 622 // |etag| should be set if it is available to detect the upload confliction. 623 // See also the comments of InitiateUploadRequestBase for more details 624 // about the other parameters. 625 InitiateUploadExistingFileRequest(RequestSender* sender, 626 const DriveApiUrlGenerator& url_generator, 627 const std::string& content_type, 628 int64 content_length, 629 const std::string& resource_id, 630 const std::string& etag, 631 const InitiateUploadCallback& callback); 632 virtual ~InitiateUploadExistingFileRequest(); 633 634 protected: 635 // UrlFetchRequestBase overrides. 636 virtual GURL GetURL() const OVERRIDE; 637 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 638 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 639 640 private: 641 const DriveApiUrlGenerator url_generator_; 642 const std::string resource_id_; 643 const std::string etag_; 644 645 DISALLOW_COPY_AND_ASSIGN(InitiateUploadExistingFileRequest); 646}; 647 648// Callback used for ResumeUpload() and GetUploadStatus(). 649typedef base::Callback<void( 650 const UploadRangeResponse& response, 651 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; 652 653//============================ ResumeUploadRequest =========================== 654 655// Performs the request for resuming the upload of a file. 656class ResumeUploadRequest : public ResumeUploadRequestBase { 657 public: 658 // See also ResumeUploadRequestBase's comment for parameters meaning. 659 // |callback| must not be null. |progress_callback| may be null. 660 ResumeUploadRequest(RequestSender* sender, 661 const GURL& upload_location, 662 int64 start_position, 663 int64 end_position, 664 int64 content_length, 665 const std::string& content_type, 666 const base::FilePath& local_file_path, 667 const UploadRangeCallback& callback, 668 const ProgressCallback& progress_callback); 669 virtual ~ResumeUploadRequest(); 670 671 protected: 672 // UploadRangeRequestBase overrides. 673 virtual void OnRangeRequestComplete( 674 const UploadRangeResponse& response, 675 scoped_ptr<base::Value> value) OVERRIDE; 676 // content::UrlFetcherDelegate overrides. 677 virtual void OnURLFetchUploadProgress(const net::URLFetcher* source, 678 int64 current, int64 total) OVERRIDE; 679 680 private: 681 const UploadRangeCallback callback_; 682 const ProgressCallback progress_callback_; 683 684 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest); 685}; 686 687//========================== GetUploadStatusRequest ========================== 688 689// Performs the request to fetch the current upload status of a file. 690class GetUploadStatusRequest : public GetUploadStatusRequestBase { 691 public: 692 // See also GetUploadStatusRequestBase's comment for parameters meaning. 693 // |callback| must not be null. 694 GetUploadStatusRequest(RequestSender* sender, 695 const GURL& upload_url, 696 int64 content_length, 697 const UploadRangeCallback& callback); 698 virtual ~GetUploadStatusRequest(); 699 700 protected: 701 // UploadRangeRequestBase overrides. 702 virtual void OnRangeRequestComplete( 703 const UploadRangeResponse& response, 704 scoped_ptr<base::Value> value) OVERRIDE; 705 706 private: 707 const UploadRangeCallback callback_; 708 709 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest); 710}; 711 712//========================== DownloadFileRequest ========================== 713 714// This class performs the request for downloading of a specified file. 715class DownloadFileRequest : public DownloadFileRequestBase { 716 public: 717 // See also DownloadFileRequestBase's comment for parameters meaning. 718 DownloadFileRequest(RequestSender* sender, 719 const DriveApiUrlGenerator& url_generator, 720 const std::string& resource_id, 721 const base::FilePath& output_file_path, 722 const DownloadActionCallback& download_action_callback, 723 const GetContentCallback& get_content_callback, 724 const ProgressCallback& progress_callback); 725 virtual ~DownloadFileRequest(); 726 727 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); 728}; 729 730} // namespace drive 731} // namespace google_apis 732 733#endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 734