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

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

Issue 1548673002: Switch to standard integer types in google_apis/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | 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 <stdint.h>
9
8 #include <string> 10 #include <string>
9 #include <vector> 11 #include <vector>
10 12
11 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
12 #include "base/location.h" 14 #include "base/location.h"
15 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
14 #include "base/sequenced_task_runner.h" 17 #include "base/sequenced_task_runner.h"
15 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
16 #include "base/time/time.h" 19 #include "base/time/time.h"
17 #include "base/values.h" 20 #include "base/values.h"
18 #include "google_apis/drive/base_requests.h" 21 #include "google_apis/drive/base_requests.h"
19 #include "google_apis/drive/drive_api_parser.h" 22 #include "google_apis/drive/drive_api_parser.h"
20 #include "google_apis/drive/drive_api_url_generator.h" 23 #include "google_apis/drive/drive_api_url_generator.h"
21 #include "google_apis/drive/drive_common_callbacks.h" 24 #include "google_apis/drive/drive_common_callbacks.h"
22 25
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 } 632 }
630 633
631 int max_results() const { return max_results_; } 634 int max_results() const { return max_results_; }
632 void set_max_results(int max_results) { max_results_ = max_results; } 635 void set_max_results(int max_results) { max_results_ = max_results; }
633 636
634 const std::string& page_token() const { return page_token_; } 637 const std::string& page_token() const { return page_token_; }
635 void set_page_token(const std::string& page_token) { 638 void set_page_token(const std::string& page_token) {
636 page_token_ = page_token; 639 page_token_ = page_token;
637 } 640 }
638 641
639 int64 start_change_id() const { return start_change_id_; } 642 int64_t start_change_id() const { return start_change_id_; }
640 void set_start_change_id(int64 start_change_id) { 643 void set_start_change_id(int64_t start_change_id) {
641 start_change_id_ = start_change_id; 644 start_change_id_ = start_change_id;
642 } 645 }
643 646
644 protected: 647 protected:
645 // Overridden from DriveApiDataRequest. 648 // Overridden from DriveApiDataRequest.
646 GURL GetURLInternal() const override; 649 GURL GetURLInternal() const override;
647 650
648 private: 651 private:
649 const DriveApiUrlGenerator url_generator_; 652 const DriveApiUrlGenerator url_generator_;
650 bool include_deleted_; 653 bool include_deleted_;
651 int max_results_; 654 int max_results_;
652 std::string page_token_; 655 std::string page_token_;
653 int64 start_change_id_; 656 int64_t start_change_id_;
654 657
655 DISALLOW_COPY_AND_ASSIGN(ChangesListRequest); 658 DISALLOW_COPY_AND_ASSIGN(ChangesListRequest);
656 }; 659 };
657 660
658 //======================== ChangesListNextPageRequest ========================= 661 //======================== ChangesListNextPageRequest =========================
659 662
660 // There are two ways to obtain next pages of "Changes: list" result (if paged). 663 // There are two ways to obtain next pages of "Changes: list" result (if paged).
661 // 1) Set pageToken and all params used for the initial request. 664 // 1) Set pageToken and all params used for the initial request.
662 // 2) Use URL in the nextLink field in the previous response. 665 // 2) Use URL in the nextLink field in the previous response.
663 // This class implements 2)'s request. 666 // This class implements 2)'s request.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // This class performs the request for initiating the upload of a new file. 814 // This class performs the request for initiating the upload of a new file.
812 class InitiateUploadNewFileRequest : public InitiateUploadRequestBase { 815 class InitiateUploadNewFileRequest : public InitiateUploadRequestBase {
813 public: 816 public:
814 // |parent_resource_id| should be the resource id of the parent directory. 817 // |parent_resource_id| should be the resource id of the parent directory.
815 // |title| should be set. 818 // |title| should be set.
816 // See also the comments of InitiateUploadRequestBase for more details 819 // See also the comments of InitiateUploadRequestBase for more details
817 // about the other parameters. 820 // about the other parameters.
818 InitiateUploadNewFileRequest(RequestSender* sender, 821 InitiateUploadNewFileRequest(RequestSender* sender,
819 const DriveApiUrlGenerator& url_generator, 822 const DriveApiUrlGenerator& url_generator,
820 const std::string& content_type, 823 const std::string& content_type,
821 int64 content_length, 824 int64_t content_length,
822 const std::string& parent_resource_id, 825 const std::string& parent_resource_id,
823 const std::string& title, 826 const std::string& title,
824 const InitiateUploadCallback& callback); 827 const InitiateUploadCallback& callback);
825 ~InitiateUploadNewFileRequest() override; 828 ~InitiateUploadNewFileRequest() override;
826 829
827 // Optional parameters. 830 // Optional parameters.
828 const base::Time& modified_date() const { return modified_date_; } 831 const base::Time& modified_date() const { return modified_date_; }
829 void set_modified_date(const base::Time& modified_date) { 832 void set_modified_date(const base::Time& modified_date) {
830 modified_date_ = modified_date; 833 modified_date_ = modified_date;
831 } 834 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase { 869 class InitiateUploadExistingFileRequest : public InitiateUploadRequestBase {
867 public: 870 public:
868 // |upload_url| should be the upload_url() of the file 871 // |upload_url| should be the upload_url() of the file
869 // (resumable-create-media URL) 872 // (resumable-create-media URL)
870 // |etag| should be set if it is available to detect the upload confliction. 873 // |etag| should be set if it is available to detect the upload confliction.
871 // See also the comments of InitiateUploadRequestBase for more details 874 // See also the comments of InitiateUploadRequestBase for more details
872 // about the other parameters. 875 // about the other parameters.
873 InitiateUploadExistingFileRequest(RequestSender* sender, 876 InitiateUploadExistingFileRequest(RequestSender* sender,
874 const DriveApiUrlGenerator& url_generator, 877 const DriveApiUrlGenerator& url_generator,
875 const std::string& content_type, 878 const std::string& content_type,
876 int64 content_length, 879 int64_t content_length,
877 const std::string& resource_id, 880 const std::string& resource_id,
878 const std::string& etag, 881 const std::string& etag,
879 const InitiateUploadCallback& callback); 882 const InitiateUploadCallback& callback);
880 ~InitiateUploadExistingFileRequest() override; 883 ~InitiateUploadExistingFileRequest() override;
881 884
882 // Optional parameters. 885 // Optional parameters.
883 const std::string& parent_resource_id() const { return parent_resource_id_; } 886 const std::string& parent_resource_id() const { return parent_resource_id_; }
884 void set_parent_resource_id(const std::string& parent_resource_id) { 887 void set_parent_resource_id(const std::string& parent_resource_id) {
885 parent_resource_id_ = parent_resource_id; 888 parent_resource_id_ = parent_resource_id;
886 } 889 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 933
931 //============================ ResumeUploadRequest =========================== 934 //============================ ResumeUploadRequest ===========================
932 935
933 // Performs the request for resuming the upload of a file. 936 // Performs the request for resuming the upload of a file.
934 class ResumeUploadRequest : public ResumeUploadRequestBase { 937 class ResumeUploadRequest : public ResumeUploadRequestBase {
935 public: 938 public:
936 // See also ResumeUploadRequestBase's comment for parameters meaning. 939 // See also ResumeUploadRequestBase's comment for parameters meaning.
937 // |callback| must not be null. |progress_callback| may be null. 940 // |callback| must not be null. |progress_callback| may be null.
938 ResumeUploadRequest(RequestSender* sender, 941 ResumeUploadRequest(RequestSender* sender,
939 const GURL& upload_location, 942 const GURL& upload_location,
940 int64 start_position, 943 int64_t start_position,
941 int64 end_position, 944 int64_t end_position,
942 int64 content_length, 945 int64_t content_length,
943 const std::string& content_type, 946 const std::string& content_type,
944 const base::FilePath& local_file_path, 947 const base::FilePath& local_file_path,
945 const UploadRangeCallback& callback, 948 const UploadRangeCallback& callback,
946 const ProgressCallback& progress_callback); 949 const ProgressCallback& progress_callback);
947 ~ResumeUploadRequest() override; 950 ~ResumeUploadRequest() override;
948 951
949 protected: 952 protected:
950 // UploadRangeRequestBase overrides. 953 // UploadRangeRequestBase overrides.
951 void OnRangeRequestComplete(const UploadRangeResponse& response, 954 void OnRangeRequestComplete(const UploadRangeResponse& response,
952 scoped_ptr<base::Value> value) override; 955 scoped_ptr<base::Value> value) override;
953 // content::UrlFetcherDelegate overrides. 956 // content::UrlFetcherDelegate overrides.
954 void OnURLFetchUploadProgress(const net::URLFetcher* source, 957 void OnURLFetchUploadProgress(const net::URLFetcher* source,
955 int64 current, 958 int64_t current,
956 int64 total) override; 959 int64_t total) override;
957 960
958 private: 961 private:
959 const UploadRangeCallback callback_; 962 const UploadRangeCallback callback_;
960 const ProgressCallback progress_callback_; 963 const ProgressCallback progress_callback_;
961 964
962 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest); 965 DISALLOW_COPY_AND_ASSIGN(ResumeUploadRequest);
963 }; 966 };
964 967
965 //========================== GetUploadStatusRequest ========================== 968 //========================== GetUploadStatusRequest ==========================
966 969
967 // Performs the request to fetch the current upload status of a file. 970 // Performs the request to fetch the current upload status of a file.
968 class GetUploadStatusRequest : public GetUploadStatusRequestBase { 971 class GetUploadStatusRequest : public GetUploadStatusRequestBase {
969 public: 972 public:
970 // See also GetUploadStatusRequestBase's comment for parameters meaning. 973 // See also GetUploadStatusRequestBase's comment for parameters meaning.
971 // |callback| must not be null. 974 // |callback| must not be null.
972 GetUploadStatusRequest(RequestSender* sender, 975 GetUploadStatusRequest(RequestSender* sender,
973 const GURL& upload_url, 976 const GURL& upload_url,
974 int64 content_length, 977 int64_t content_length,
975 const UploadRangeCallback& callback); 978 const UploadRangeCallback& callback);
976 ~GetUploadStatusRequest() override; 979 ~GetUploadStatusRequest() override;
977 980
978 protected: 981 protected:
979 // UploadRangeRequestBase overrides. 982 // UploadRangeRequestBase overrides.
980 void OnRangeRequestComplete(const UploadRangeResponse& response, 983 void OnRangeRequestComplete(const UploadRangeResponse& response,
981 scoped_ptr<base::Value> value) override; 984 scoped_ptr<base::Value> value) override;
982 985
983 private: 986 private:
984 const UploadRangeCallback callback_; 987 const UploadRangeCallback callback_;
985 988
986 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest); 989 DISALLOW_COPY_AND_ASSIGN(GetUploadStatusRequest);
987 }; 990 };
988 991
989 //======================= MultipartUploadNewFileDelegate ======================= 992 //======================= MultipartUploadNewFileDelegate =======================
990 993
991 // This class performs the request for initiating the upload of a new file. 994 // This class performs the request for initiating the upload of a new file.
992 class MultipartUploadNewFileDelegate : public MultipartUploadRequestBase { 995 class MultipartUploadNewFileDelegate : public MultipartUploadRequestBase {
993 public: 996 public:
994 // |parent_resource_id| should be the resource id of the parent directory. 997 // |parent_resource_id| should be the resource id of the parent directory.
995 // |title| should be set. 998 // |title| should be set.
996 // See also the comments of MultipartUploadRequestBase for more details 999 // See also the comments of MultipartUploadRequestBase for more details
997 // about the other parameters. 1000 // about the other parameters.
998 MultipartUploadNewFileDelegate(base::SequencedTaskRunner* task_runner, 1001 MultipartUploadNewFileDelegate(base::SequencedTaskRunner* task_runner,
999 const std::string& title, 1002 const std::string& title,
1000 const std::string& parent_resource_id, 1003 const std::string& parent_resource_id,
1001 const std::string& content_type, 1004 const std::string& content_type,
1002 int64 content_length, 1005 int64_t content_length,
1003 const base::Time& modified_date, 1006 const base::Time& modified_date,
1004 const base::Time& last_viewed_by_me_date, 1007 const base::Time& last_viewed_by_me_date,
1005 const base::FilePath& local_file_path, 1008 const base::FilePath& local_file_path,
1006 const Properties& properties, 1009 const Properties& properties,
1007 const DriveApiUrlGenerator& url_generator, 1010 const DriveApiUrlGenerator& url_generator,
1008 const FileResourceCallback& callback, 1011 const FileResourceCallback& callback,
1009 const ProgressCallback& progress_callback); 1012 const ProgressCallback& progress_callback);
1010 ~MultipartUploadNewFileDelegate() override; 1013 ~MultipartUploadNewFileDelegate() override;
1011 1014
1012 protected: 1015 protected:
(...skipping 16 matching lines...) Expand all
1029 // |parent_resource_id| should be the resource id of the parent directory. 1032 // |parent_resource_id| should be the resource id of the parent directory.
1030 // |title| should be set. 1033 // |title| should be set.
1031 // See also the comments of MultipartUploadRequestBase for more details 1034 // See also the comments of MultipartUploadRequestBase for more details
1032 // about the other parameters. 1035 // about the other parameters.
1033 MultipartUploadExistingFileDelegate( 1036 MultipartUploadExistingFileDelegate(
1034 base::SequencedTaskRunner* task_runner, 1037 base::SequencedTaskRunner* task_runner,
1035 const std::string& title, 1038 const std::string& title,
1036 const std::string& resource_id, 1039 const std::string& resource_id,
1037 const std::string& parent_resource_id, 1040 const std::string& parent_resource_id,
1038 const std::string& content_type, 1041 const std::string& content_type,
1039 int64 content_length, 1042 int64_t content_length,
1040 const base::Time& modified_date, 1043 const base::Time& modified_date,
1041 const base::Time& last_viewed_by_me_date, 1044 const base::Time& last_viewed_by_me_date,
1042 const base::FilePath& local_file_path, 1045 const base::FilePath& local_file_path,
1043 const std::string& etag, 1046 const std::string& etag,
1044 const Properties& properties, 1047 const Properties& properties,
1045 const DriveApiUrlGenerator& url_generator, 1048 const DriveApiUrlGenerator& url_generator,
1046 const FileResourceCallback& callback, 1049 const FileResourceCallback& callback,
1047 const ProgressCallback& progress_callback); 1050 const ProgressCallback& progress_callback);
1048 ~MultipartUploadExistingFileDelegate() override; 1051 ~MultipartUploadExistingFileDelegate() override;
1049 1052
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 private: 1144 private:
1142 GURL GetURL() const override; 1145 GURL GetURL() const override;
1143 net::URLFetcher::RequestType GetRequestType() const override; 1146 net::URLFetcher::RequestType GetRequestType() const override;
1144 std::vector<std::string> GetExtraRequestHeaders() const override; 1147 std::vector<std::string> GetExtraRequestHeaders() const override;
1145 void Prepare(const PrepareCallback& callback) override; 1148 void Prepare(const PrepareCallback& callback) override;
1146 bool GetContentData(std::string* upload_content_type, 1149 bool GetContentData(std::string* upload_content_type,
1147 std::string* upload_content) override; 1150 std::string* upload_content) override;
1148 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; 1151 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override;
1149 void ProcessURLFetchResults(const net::URLFetcher* source) override; 1152 void ProcessURLFetchResults(const net::URLFetcher* source) override;
1150 void OnURLFetchUploadProgress(const net::URLFetcher* source, 1153 void OnURLFetchUploadProgress(const net::URLFetcher* source,
1151 int64 current, 1154 int64_t current,
1152 int64 total) override; 1155 int64_t total) override;
1153 scoped_ptr<BatchableDelegate> delegate_; 1156 scoped_ptr<BatchableDelegate> delegate_;
1154 1157
1155 // Note: This should remain the last member so it'll be destroyed and 1158 // Note: This should remain the last member so it'll be destroyed and
1156 // invalidate its weak pointers before any other members are destroyed. 1159 // invalidate its weak pointers before any other members are destroyed.
1157 base::WeakPtrFactory<SingleBatchableDelegateRequest> weak_ptr_factory_; 1160 base::WeakPtrFactory<SingleBatchableDelegateRequest> weak_ptr_factory_;
1158 1161
1159 DISALLOW_COPY_AND_ASSIGN(SingleBatchableDelegateRequest); 1162 DISALLOW_COPY_AND_ASSIGN(SingleBatchableDelegateRequest);
1160 }; 1163 };
1161 1164
1162 //========================== BatchUploadRequest ========================== 1165 //========================== BatchUploadRequest ==========================
1163 1166
1164 class BatchUploadChildEntry { 1167 class BatchUploadChildEntry {
1165 public: 1168 public:
1166 explicit BatchUploadChildEntry(BatchableDelegate* request); 1169 explicit BatchUploadChildEntry(BatchableDelegate* request);
1167 ~BatchUploadChildEntry(); 1170 ~BatchUploadChildEntry();
1168 scoped_ptr<BatchableDelegate> request; 1171 scoped_ptr<BatchableDelegate> request;
1169 bool prepared; 1172 bool prepared;
1170 int64 data_offset; 1173 int64_t data_offset;
1171 int64 data_size; 1174 int64_t data_size;
1172 1175
1173 private: 1176 private:
1174 DISALLOW_COPY_AND_ASSIGN(BatchUploadChildEntry); 1177 DISALLOW_COPY_AND_ASSIGN(BatchUploadChildEntry);
1175 }; 1178 };
1176 1179
1177 class BatchUploadRequest : public UrlFetchRequestBase { 1180 class BatchUploadRequest : public UrlFetchRequestBase {
1178 public: 1181 public:
1179 BatchUploadRequest(RequestSender* sender, 1182 BatchUploadRequest(RequestSender* sender,
1180 const DriveApiUrlGenerator& url_generator); 1183 const DriveApiUrlGenerator& url_generator);
1181 ~BatchUploadRequest() override; 1184 ~BatchUploadRequest() override;
(...skipping 24 matching lines...) Expand all
1206 GURL GetURL() const override; 1209 GURL GetURL() const override;
1207 net::URLFetcher::RequestType GetRequestType() const override; 1210 net::URLFetcher::RequestType GetRequestType() const override;
1208 std::vector<std::string> GetExtraRequestHeaders() const override; 1211 std::vector<std::string> GetExtraRequestHeaders() const override;
1209 bool GetContentData(std::string* upload_content_type, 1212 bool GetContentData(std::string* upload_content_type,
1210 std::string* upload_content) override; 1213 std::string* upload_content) override;
1211 void ProcessURLFetchResults(const net::URLFetcher* source) override; 1214 void ProcessURLFetchResults(const net::URLFetcher* source) override;
1212 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override; 1215 void RunCallbackOnPrematureFailure(DriveApiErrorCode code) override;
1213 1216
1214 // content::UrlFetcherDelegate overrides. 1217 // content::UrlFetcherDelegate overrides.
1215 void OnURLFetchUploadProgress(const net::URLFetcher* source, 1218 void OnURLFetchUploadProgress(const net::URLFetcher* source,
1216 int64 current, 1219 int64_t current,
1217 int64 total) override; 1220 int64_t total) override;
1218 1221
1219 private: 1222 private:
1220 typedef void* RequestID; 1223 typedef void* RequestID;
1221 // Obtains corresponding child entry of |request_id|. Returns NULL if the 1224 // Obtains corresponding child entry of |request_id|. Returns NULL if the
1222 // entry is not found. 1225 // entry is not found.
1223 ScopedVector<BatchUploadChildEntry>::iterator GetChildEntry( 1226 ScopedVector<BatchUploadChildEntry>::iterator GetChildEntry(
1224 RequestID request_id); 1227 RequestID request_id);
1225 1228
1226 // Called after child requests' |Prepare| method. 1229 // Called after child requests' |Prepare| method.
1227 void OnChildRequestPrepared(RequestID request_id, DriveApiErrorCode result); 1230 void OnChildRequestPrepared(RequestID request_id, DriveApiErrorCode result);
(...skipping 11 matching lines...) Expand all
1239 PrepareCallback prepare_callback_; 1242 PrepareCallback prepare_callback_;
1240 bool committed_; 1243 bool committed_;
1241 1244
1242 // Boundary of multipart body. 1245 // Boundary of multipart body.
1243 std::string boundary_; 1246 std::string boundary_;
1244 1247
1245 // Multipart of child requests. 1248 // Multipart of child requests.
1246 ContentTypeAndData upload_content_; 1249 ContentTypeAndData upload_content_;
1247 1250
1248 // Last reported progress value. 1251 // Last reported progress value.
1249 int64 last_progress_value_; 1252 int64_t last_progress_value_;
1250 1253
1251 // Note: This should remain the last member so it'll be destroyed and 1254 // Note: This should remain the last member so it'll be destroyed and
1252 // invalidate its weak pointers before any other members are destroyed. 1255 // invalidate its weak pointers before any other members are destroyed.
1253 base::WeakPtrFactory<BatchUploadRequest> weak_ptr_factory_; 1256 base::WeakPtrFactory<BatchUploadRequest> weak_ptr_factory_;
1254 1257
1255 DISALLOW_COPY_AND_ASSIGN(BatchUploadRequest); 1258 DISALLOW_COPY_AND_ASSIGN(BatchUploadRequest);
1256 }; 1259 };
1257 1260
1258 } // namespace drive 1261 } // namespace drive
1259 } // namespace google_apis 1262 } // namespace google_apis
1260 1263
1261 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_ 1264 #endif // GOOGLE_APIS_DRIVE_DRIVE_API_REQUESTS_H_
OLDNEW
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | google_apis/drive/drive_api_requests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698