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

Side by Side Diff: google_apis/drive/drive_api_requests.h

Issue 139153006: drive: Add metadata parameters to InitiateUpload* methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 6 years, 11 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
« no previous file with comments | « no previous file | google_apis/drive/drive_api_requests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 5 #ifndef GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
6 #define GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 6 #define GOOGLE_APIS_DRIVE_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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 // about the other parameters. 617 // about the other parameters.
618 InitiateUploadNewFileRequest(RequestSender* sender, 618 InitiateUploadNewFileRequest(RequestSender* sender,
619 const DriveApiUrlGenerator& url_generator, 619 const DriveApiUrlGenerator& url_generator,
620 const std::string& content_type, 620 const std::string& content_type,
621 int64 content_length, 621 int64 content_length,
622 const std::string& parent_resource_id, 622 const std::string& parent_resource_id,
623 const std::string& title, 623 const std::string& title,
624 const InitiateUploadCallback& callback); 624 const InitiateUploadCallback& callback);
625 virtual ~InitiateUploadNewFileRequest(); 625 virtual ~InitiateUploadNewFileRequest();
626 626
627 // Optional parameters.
628 const base::Time& modified_date() const { return modified_date_; }
629 void set_modified_date(const base::Time& modified_date) {
630 modified_date_ = modified_date;
631 }
632 const base::Time& last_viewed_by_me_date() const {
633 return last_viewed_by_me_date_;
634 }
635 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
636 last_viewed_by_me_date_ = last_viewed_by_me_date;
637 }
638
627 protected: 639 protected:
628 // UrlFetchRequestBase overrides. 640 // UrlFetchRequestBase overrides.
629 virtual GURL GetURL() const OVERRIDE; 641 virtual GURL GetURL() const OVERRIDE;
630 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 642 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
631 virtual bool GetContentData(std::string* upload_content_type, 643 virtual bool GetContentData(std::string* upload_content_type,
632 std::string* upload_content) OVERRIDE; 644 std::string* upload_content) OVERRIDE;
633 645
634 private: 646 private:
635 const DriveApiUrlGenerator url_generator_; 647 const DriveApiUrlGenerator url_generator_;
636 const std::string parent_resource_id_; 648 const std::string parent_resource_id_;
637 const std::string title_; 649 const std::string title_;
638 650
651 base::Time modified_date_;
652 base::Time last_viewed_by_me_date_;
653
639 DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest); 654 DISALLOW_COPY_AND_ASSIGN(InitiateUploadNewFileRequest);
640 }; 655 };
641 656
642 //==================== InitiateUploadExistingFileRequest ===================== 657 //==================== InitiateUploadExistingFileRequest =====================
643 658
644 // This class performs the request for initiating the upload of an existing 659 // This class performs the request for initiating the upload of an existing
645 // file. 660 // file.
646 class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { 661 class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase {
647 public: 662 public:
648 // |upload_url| should be the upload_url() of the file 663 // |upload_url| should be the upload_url() of the file
649 // (resumable-create-media URL) 664 // (resumable-create-media URL)
650 // |etag| should be set if it is available to detect the upload confliction. 665 // |etag| should be set if it is available to detect the upload confliction.
651 // See also the comments of InitiateUploadRequestBase for more details 666 // See also the comments of InitiateUploadRequestBase for more details
652 // about the other parameters. 667 // about the other parameters.
653 InitiateUploadExistingFileRequest(RequestSender* sender, 668 InitiateUploadExistingFileRequest(RequestSender* sender,
654 const DriveApiUrlGenerator& url_generator, 669 const DriveApiUrlGenerator& url_generator,
655 const std::string& content_type, 670 const std::string& content_type,
656 int64 content_length, 671 int64 content_length,
657 const std::string& resource_id, 672 const std::string& resource_id,
658 const std::string& etag, 673 const std::string& etag,
659 const InitiateUploadCallback& callback); 674 const InitiateUploadCallback& callback);
660 virtual ~InitiateUploadExistingFileRequest(); 675 virtual ~InitiateUploadExistingFileRequest();
661 676
677
678 // Optional parameters.
679 const std::string& parent_resource_id() const { return parent_resource_id_; }
680 void set_parent_resource_id(const std::string& parent_resource_id) {
681 parent_resource_id_ = parent_resource_id;
682 }
683 const std::string& title() const { return title_; }
684 void set_title(const std::string& title) { title_ = title; }
685 const base::Time& modified_date() const { return modified_date_; }
686 void set_modified_date(const base::Time& modified_date) {
687 modified_date_ = modified_date;
688 }
689 const base::Time& last_viewed_by_me_date() const {
690 return last_viewed_by_me_date_;
691 }
692 void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
693 last_viewed_by_me_date_ = last_viewed_by_me_date;
694 }
695
662 protected: 696 protected:
663 // UrlFetchRequestBase overrides. 697 // UrlFetchRequestBase overrides.
664 virtual GURL GetURL() const OVERRIDE; 698 virtual GURL GetURL() const OVERRIDE;
665 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE; 699 virtual net::URLFetcher::RequestType GetRequestType() const OVERRIDE;
666 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE; 700 virtual std::vector<std::string> GetExtraRequestHeaders() const OVERRIDE;
701 virtual bool GetContentData(std::string* upload_content_type,
702 std::string* upload_content) OVERRIDE;
667 703
668 private: 704 private:
669 const DriveApiUrlGenerator url_generator_; 705 const DriveApiUrlGenerator url_generator_;
670 const std::string resource_id_; 706 const std::string resource_id_;
671 const std::string etag_; 707 const std::string etag_;
672 708
709 std::string parent_resource_id_;
710 std::string title_;
711 base::Time modified_date_;
712 base::Time last_viewed_by_me_date_;
713
673 DISALLOW_COPY_AND_ASSIGN(InitiateUploadExistingFileRequest); 714 DISALLOW_COPY_AND_ASSIGN(InitiateUploadExistingFileRequest);
674 }; 715 };
675 716
676 // Callback used for ResumeUpload() and GetUploadStatus(). 717 // Callback used for ResumeUpload() and GetUploadStatus().
677 typedef base::Callback<void( 718 typedef base::Callback<void(
678 const UploadRangeResponse& response, 719 const UploadRangeResponse& response,
679 scoped_ptr<FileResource> new_resource)> UploadRangeCallback; 720 scoped_ptr<FileResource> new_resource)> UploadRangeCallback;
680 721
681 //============================ ResumeUploadRequest =========================== 722 //============================ ResumeUploadRequest ===========================
682 723
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 const ProgressCallback& progress_callback); 793 const ProgressCallback& progress_callback);
753 virtual ~DownloadFileRequest(); 794 virtual ~DownloadFileRequest();
754 795
755 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest); 796 DISALLOW_COPY_AND_ASSIGN(DownloadFileRequest);
756 }; 797 };
757 798
758 } // namespace drive 799 } // namespace drive
759 } // namespace google_apis 800 } // namespace google_apis
760 801
761 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 802 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
OLDNEW
« no previous file with comments | « no previous file | google_apis/drive/drive_api_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698