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 COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ | 5 #ifndef COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ |
6 #define COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ | 6 #define COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/time/time.h" | 12 #include "base/time/time.h" |
11 #include "google_apis/drive/auth_service_interface.h" | 13 #include "google_apis/drive/auth_service_interface.h" |
12 #include "google_apis/drive/base_requests.h" | 14 #include "google_apis/drive/base_requests.h" |
13 #include "google_apis/drive/drive_api_requests.h" | 15 #include "google_apis/drive/drive_api_requests.h" |
14 #include "google_apis/drive/drive_common_callbacks.h" | 16 #include "google_apis/drive/drive_common_callbacks.h" |
15 | 17 |
16 namespace base { | 18 namespace base { |
17 class Time; | 19 class Time; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 class DriveServiceBatchOperationsInterface { | 108 class DriveServiceBatchOperationsInterface { |
107 public: | 109 public: |
108 virtual ~DriveServiceBatchOperationsInterface() {} | 110 virtual ~DriveServiceBatchOperationsInterface() {} |
109 | 111 |
110 // Uploads a file by a single request with multipart body. It's more efficient | 112 // Uploads a file by a single request with multipart body. It's more efficient |
111 // for small files than using |InitiateUploadNewFile| and |ResumeUpload|. | 113 // for small files than using |InitiateUploadNewFile| and |ResumeUpload|. |
112 // |content_type| and |content_length| should be the ones of the file to be | 114 // |content_type| and |content_length| should be the ones of the file to be |
113 // uploaded. |callback| must not be null. |progress_callback| may be null. | 115 // uploaded. |callback| must not be null. |progress_callback| may be null. |
114 virtual google_apis::CancelCallback MultipartUploadNewFile( | 116 virtual google_apis::CancelCallback MultipartUploadNewFile( |
115 const std::string& content_type, | 117 const std::string& content_type, |
116 int64 content_length, | 118 int64_t content_length, |
117 const std::string& parent_resource_id, | 119 const std::string& parent_resource_id, |
118 const std::string& title, | 120 const std::string& title, |
119 const base::FilePath& local_file_path, | 121 const base::FilePath& local_file_path, |
120 const UploadNewFileOptions& options, | 122 const UploadNewFileOptions& options, |
121 const google_apis::FileResourceCallback& callback, | 123 const google_apis::FileResourceCallback& callback, |
122 const google_apis::ProgressCallback& progress_callback) = 0; | 124 const google_apis::ProgressCallback& progress_callback) = 0; |
123 | 125 |
124 // Uploads a file by a single request with multipart body. It's more efficient | 126 // Uploads a file by a single request with multipart body. It's more efficient |
125 // for small files than using |InitiateUploadExistingFile| and |ResumeUpload|. | 127 // for small files than using |InitiateUploadExistingFile| and |ResumeUpload|. |
126 // |content_type| and |content_length| should be the ones of the file to be | 128 // |content_type| and |content_length| should be the ones of the file to be |
127 // uploaded. |callback| must not be null. |progress_callback| may be null. | 129 // uploaded. |callback| must not be null. |progress_callback| may be null. |
128 virtual google_apis::CancelCallback MultipartUploadExistingFile( | 130 virtual google_apis::CancelCallback MultipartUploadExistingFile( |
129 const std::string& content_type, | 131 const std::string& content_type, |
130 int64 content_length, | 132 int64_t content_length, |
131 const std::string& resource_id, | 133 const std::string& resource_id, |
132 const base::FilePath& local_file_path, | 134 const base::FilePath& local_file_path, |
133 const UploadExistingFileOptions& options, | 135 const UploadExistingFileOptions& options, |
134 const google_apis::FileResourceCallback& callback, | 136 const google_apis::FileResourceCallback& callback, |
135 const google_apis::ProgressCallback& progress_callback) = 0; | 137 const google_apis::ProgressCallback& progress_callback) = 0; |
136 }; | 138 }; |
137 | 139 |
138 // Builder returned by DriveServiceInterface to build batch request. | 140 // Builder returned by DriveServiceInterface to build batch request. |
139 class BatchRequestConfiguratorInterface | 141 class BatchRequestConfiguratorInterface |
140 : public DriveServiceBatchOperationsInterface { | 142 : public DriveServiceBatchOperationsInterface { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 const google_apis::FileListCallback& callback) = 0; | 242 const google_apis::FileListCallback& callback) = 0; |
241 | 243 |
242 // Fetches change list since |start_changestamp|. |callback| will be | 244 // Fetches change list since |start_changestamp|. |callback| will be |
243 // called upon completion. | 245 // called upon completion. |
244 // If the list is too long, it may be paged. In such a case, a URL to fetch | 246 // If the list is too long, it may be paged. In such a case, a URL to fetch |
245 // remaining results will be included in the returned result. See also | 247 // remaining results will be included in the returned result. See also |
246 // GetRemainingChangeList. | 248 // GetRemainingChangeList. |
247 // | 249 // |
248 // |callback| must not be null. | 250 // |callback| must not be null. |
249 virtual google_apis::CancelCallback GetChangeList( | 251 virtual google_apis::CancelCallback GetChangeList( |
250 int64 start_changestamp, | 252 int64_t start_changestamp, |
251 const google_apis::ChangeListCallback& callback) = 0; | 253 const google_apis::ChangeListCallback& callback) = 0; |
252 | 254 |
253 // The result of GetChangeList() may be paged. | 255 // The result of GetChangeList() may be paged. |
254 // In such a case, a next link to fetch remaining result is returned. | 256 // In such a case, a next link to fetch remaining result is returned. |
255 // The page token can be used for this method. |callback| will be called upon | 257 // The page token can be used for this method. |callback| will be called upon |
256 // completion. | 258 // completion. |
257 // | 259 // |
258 // |next_link| must not be empty. |callback| must not be null. | 260 // |next_link| must not be empty. |callback| must not be null. |
259 virtual google_apis::CancelCallback GetRemainingChangeList( | 261 virtual google_apis::CancelCallback GetRemainingChangeList( |
260 const GURL& next_link, | 262 const GURL& next_link, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 const google_apis::DownloadActionCallback& download_action_callback, | 397 const google_apis::DownloadActionCallback& download_action_callback, |
396 const google_apis::GetContentCallback& get_content_callback, | 398 const google_apis::GetContentCallback& get_content_callback, |
397 const google_apis::ProgressCallback& progress_callback) = 0; | 399 const google_apis::ProgressCallback& progress_callback) = 0; |
398 | 400 |
399 // Initiates uploading of a new document/file. | 401 // Initiates uploading of a new document/file. |
400 // |content_type| and |content_length| should be the ones of the file to be | 402 // |content_type| and |content_length| should be the ones of the file to be |
401 // uploaded. | 403 // uploaded. |
402 // |callback| must not be null. | 404 // |callback| must not be null. |
403 virtual google_apis::CancelCallback InitiateUploadNewFile( | 405 virtual google_apis::CancelCallback InitiateUploadNewFile( |
404 const std::string& content_type, | 406 const std::string& content_type, |
405 int64 content_length, | 407 int64_t content_length, |
406 const std::string& parent_resource_id, | 408 const std::string& parent_resource_id, |
407 const std::string& title, | 409 const std::string& title, |
408 const UploadNewFileOptions& options, | 410 const UploadNewFileOptions& options, |
409 const google_apis::InitiateUploadCallback& callback) = 0; | 411 const google_apis::InitiateUploadCallback& callback) = 0; |
410 | 412 |
411 // Initiates uploading of an existing document/file. | 413 // Initiates uploading of an existing document/file. |
412 // |content_type| and |content_length| should be the ones of the file to be | 414 // |content_type| and |content_length| should be the ones of the file to be |
413 // uploaded. | 415 // uploaded. |
414 // |callback| must not be null. | 416 // |callback| must not be null. |
415 virtual google_apis::CancelCallback InitiateUploadExistingFile( | 417 virtual google_apis::CancelCallback InitiateUploadExistingFile( |
416 const std::string& content_type, | 418 const std::string& content_type, |
417 int64 content_length, | 419 int64_t content_length, |
418 const std::string& resource_id, | 420 const std::string& resource_id, |
419 const UploadExistingFileOptions& options, | 421 const UploadExistingFileOptions& options, |
420 const google_apis::InitiateUploadCallback& callback) = 0; | 422 const google_apis::InitiateUploadCallback& callback) = 0; |
421 | 423 |
422 // Resumes uploading of a document/file on the calling thread. | 424 // Resumes uploading of a document/file on the calling thread. |
423 // |callback| must not be null. |progress_callback| may be null. | 425 // |callback| must not be null. |progress_callback| may be null. |
424 virtual google_apis::CancelCallback ResumeUpload( | 426 virtual google_apis::CancelCallback ResumeUpload( |
425 const GURL& upload_url, | 427 const GURL& upload_url, |
426 int64 start_position, | 428 int64_t start_position, |
427 int64 end_position, | 429 int64_t end_position, |
428 int64 content_length, | 430 int64_t content_length, |
429 const std::string& content_type, | 431 const std::string& content_type, |
430 const base::FilePath& local_file_path, | 432 const base::FilePath& local_file_path, |
431 const google_apis::drive::UploadRangeCallback& callback, | 433 const google_apis::drive::UploadRangeCallback& callback, |
432 const google_apis::ProgressCallback& progress_callback) = 0; | 434 const google_apis::ProgressCallback& progress_callback) = 0; |
433 | 435 |
434 // Gets the current status of the uploading to |upload_url| from the server. | 436 // Gets the current status of the uploading to |upload_url| from the server. |
435 // |drive_file_path| and |content_length| should be set to the same value | 437 // |drive_file_path| and |content_length| should be set to the same value |
436 // which is used for ResumeUpload. | 438 // which is used for ResumeUpload. |
437 // |callback| must not be null. | 439 // |callback| must not be null. |
438 virtual google_apis::CancelCallback GetUploadStatus( | 440 virtual google_apis::CancelCallback GetUploadStatus( |
439 const GURL& upload_url, | 441 const GURL& upload_url, |
440 int64 content_length, | 442 int64_t content_length, |
441 const google_apis::drive::UploadRangeCallback& callback) = 0; | 443 const google_apis::drive::UploadRangeCallback& callback) = 0; |
442 | 444 |
443 // Authorizes a Drive app with the id |app_id| to open the given file. | 445 // Authorizes a Drive app with the id |app_id| to open the given file. |
444 // Upon completion, invokes |callback| with the link to open the file with | 446 // Upon completion, invokes |callback| with the link to open the file with |
445 // the provided app. |callback| must not be null. | 447 // the provided app. |callback| must not be null. |
446 virtual google_apis::CancelCallback AuthorizeApp( | 448 virtual google_apis::CancelCallback AuthorizeApp( |
447 const std::string& resource_id, | 449 const std::string& resource_id, |
448 const std::string& app_id, | 450 const std::string& app_id, |
449 const google_apis::AuthorizeAppCallback& callback) = 0; | 451 const google_apis::AuthorizeAppCallback& callback) = 0; |
450 | 452 |
(...skipping 10 matching lines...) Expand all Loading... |
461 google_apis::drive::PermissionRole role, | 463 google_apis::drive::PermissionRole role, |
462 const google_apis::EntryActionCallback& callback) = 0; | 464 const google_apis::EntryActionCallback& callback) = 0; |
463 | 465 |
464 // Starts batch request and returns |BatchRequestConfigurator|. | 466 // Starts batch request and returns |BatchRequestConfigurator|. |
465 virtual scoped_ptr<BatchRequestConfiguratorInterface> StartBatchRequest() = 0; | 467 virtual scoped_ptr<BatchRequestConfiguratorInterface> StartBatchRequest() = 0; |
466 }; | 468 }; |
467 | 469 |
468 } // namespace drive | 470 } // namespace drive |
469 | 471 |
470 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ | 472 #endif // COMPONENTS_DRIVE_SERVICE_DRIVE_SERVICE_INTERFACE_H_ |
OLD | NEW |