| 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_SERVICE_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 // TODO(kochi): Further split gdata_operations.h and include only necessary | 10 // TODO(kochi): Further split gdata_operations.h and include only necessary |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 typedef base::Callback<void( | 72 typedef base::Callback<void( |
| 73 const UploadRangeResponse& response, | 73 const UploadRangeResponse& response, |
| 74 scoped_ptr<ResourceEntry> new_entry)> UploadRangeCallback; | 74 scoped_ptr<ResourceEntry> new_entry)> UploadRangeCallback; |
| 75 | 75 |
| 76 // Callback used for AuthorizeApp(). |open_url| is used to open the target | 76 // Callback used for AuthorizeApp(). |open_url| is used to open the target |
| 77 // file with the authorized app. | 77 // file with the authorized app. |
| 78 typedef base::Callback<void(GDataErrorCode error, | 78 typedef base::Callback<void(GDataErrorCode error, |
| 79 const GURL& open_url)> | 79 const GURL& open_url)> |
| 80 AuthorizeAppCallback; | 80 AuthorizeAppCallback; |
| 81 | 81 |
| 82 // Callback used for ResumeUpload(). |
| 83 typedef base::Callback<void(int64 progress)> ProgressCallback; |
| 84 |
| 82 // This defines an interface for sharing by DriveService and MockDriveService | 85 // This defines an interface for sharing by DriveService and MockDriveService |
| 83 // so that we can do testing of clients of DriveService. | 86 // so that we can do testing of clients of DriveService. |
| 84 // | 87 // |
| 85 // All functions must be called on UI thread. DriveService is built on top of | 88 // All functions must be called on UI thread. DriveService is built on top of |
| 86 // URLFetcher that runs on UI thread. | 89 // URLFetcher that runs on UI thread. |
| 87 class DriveServiceInterface { | 90 class DriveServiceInterface { |
| 88 public: | 91 public: |
| 89 virtual ~DriveServiceInterface() {} | 92 virtual ~DriveServiceInterface() {} |
| 90 | 93 |
| 91 // Common service: | 94 // Common service: |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // |callback| must not be null. | 345 // |callback| must not be null. |
| 343 virtual void InitiateUploadExistingFile( | 346 virtual void InitiateUploadExistingFile( |
| 344 const base::FilePath& drive_file_path, | 347 const base::FilePath& drive_file_path, |
| 345 const std::string& content_type, | 348 const std::string& content_type, |
| 346 int64 content_length, | 349 int64 content_length, |
| 347 const std::string& resource_id, | 350 const std::string& resource_id, |
| 348 const std::string& etag, | 351 const std::string& etag, |
| 349 const InitiateUploadCallback& callback) = 0; | 352 const InitiateUploadCallback& callback) = 0; |
| 350 | 353 |
| 351 // Resumes uploading of a document/file on the calling thread. | 354 // Resumes uploading of a document/file on the calling thread. |
| 352 // |callback| must not be null. | 355 // |callback| must not be null. |progress_callback| may be null. |
| 353 virtual void ResumeUpload( | 356 virtual void ResumeUpload( |
| 354 UploadMode upload_mode, | 357 UploadMode upload_mode, |
| 355 const base::FilePath& drive_file_path, | 358 const base::FilePath& drive_file_path, |
| 356 const GURL& upload_url, | 359 const GURL& upload_url, |
| 357 int64 start_position, | 360 int64 start_position, |
| 358 int64 end_position, | 361 int64 end_position, |
| 359 int64 content_length, | 362 int64 content_length, |
| 360 const std::string& content_type, | 363 const std::string& content_type, |
| 361 const scoped_refptr<net::IOBuffer>& buf, | 364 const scoped_refptr<net::IOBuffer>& buf, |
| 362 const UploadRangeCallback& callback) = 0; | 365 const UploadRangeCallback& callback, |
| 366 const ProgressCallback& progress_callback) = 0; |
| 363 | 367 |
| 364 // Gets the current status of the uploading to |upload_url| from the server. | 368 // Gets the current status of the uploading to |upload_url| from the server. |
| 365 // |upload_mode|, |drive_file_path| and |content_length| should be set to | 369 // |upload_mode|, |drive_file_path| and |content_length| should be set to |
| 366 // the same value which is used for ResumeUpload. | 370 // the same value which is used for ResumeUpload. |
| 367 // |callback| must not be null. | 371 // |callback| must not be null. |
| 368 virtual void GetUploadStatus( | 372 virtual void GetUploadStatus( |
| 369 UploadMode upload_mode, | 373 UploadMode upload_mode, |
| 370 const base::FilePath& drive_file_path, | 374 const base::FilePath& drive_file_path, |
| 371 const GURL& upload_url, | 375 const GURL& upload_url, |
| 372 int64 content_length, | 376 int64 content_length, |
| 373 const UploadRangeCallback& callback) = 0; | 377 const UploadRangeCallback& callback) = 0; |
| 374 | 378 |
| 375 // Authorizes a Drive app with the id |app_id| to open the given file. | 379 // Authorizes a Drive app with the id |app_id| to open the given file. |
| 376 // Upon completion, invokes |callback| with the link to open the file with | 380 // Upon completion, invokes |callback| with the link to open the file with |
| 377 // the provided app. |callback| must not be null. | 381 // the provided app. |callback| must not be null. |
| 378 virtual void AuthorizeApp(const std::string& resource_id, | 382 virtual void AuthorizeApp(const std::string& resource_id, |
| 379 const std::string& app_id, | 383 const std::string& app_id, |
| 380 const AuthorizeAppCallback& callback) = 0; | 384 const AuthorizeAppCallback& callback) = 0; |
| 381 }; | 385 }; |
| 382 | 386 |
| 383 } // namespace google_apis | 387 } // namespace google_apis |
| 384 | 388 |
| 385 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ | 389 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ |
| OLD | NEW |