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, int64 total)> ProgressCallback; | |
84 | |
85 // This defines an interface for sharing by DriveService and MockDriveService | 82 // This defines an interface for sharing by DriveService and MockDriveService |
86 // so that we can do testing of clients of DriveService. | 83 // so that we can do testing of clients of DriveService. |
87 // | 84 // |
88 // All functions must be called on UI thread. DriveService is built on top of | 85 // All functions must be called on UI thread. DriveService is built on top of |
89 // URLFetcher that runs on UI thread. | 86 // URLFetcher that runs on UI thread. |
90 class DriveServiceInterface { | 87 class DriveServiceInterface { |
91 public: | 88 public: |
92 virtual ~DriveServiceInterface() {} | 89 virtual ~DriveServiceInterface() {} |
93 | 90 |
94 // Common service: | 91 // Common service: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 virtual void AddNewDirectory(const std::string& parent_resource_id, | 279 virtual void AddNewDirectory(const std::string& parent_resource_id, |
283 const std::string& directory_name, | 280 const std::string& directory_name, |
284 const GetResourceEntryCallback& callback) = 0; | 281 const GetResourceEntryCallback& callback) = 0; |
285 | 282 |
286 // Downloads a file from |download_url|. The downloaded file will | 283 // Downloads a file from |download_url|. The downloaded file will |
287 // be stored at |local_cache_path| location. Upon completion, invokes | 284 // be stored at |local_cache_path| location. Upon completion, invokes |
288 // |download_action_callback| with results on the calling thread. | 285 // |download_action_callback| with results on the calling thread. |
289 // If |get_content_callback| is not empty, | 286 // If |get_content_callback| is not empty, |
290 // URLFetcherDelegate::OnURLFetchDownloadData will be called, which will in | 287 // URLFetcherDelegate::OnURLFetchDownloadData will be called, which will in |
291 // turn invoke |get_content_callback| on the calling thread. | 288 // turn invoke |get_content_callback| on the calling thread. |
| 289 // If |progress_callback| is not empty, it is invoked periodically when |
| 290 // the download made some progress. |
292 // | 291 // |
293 // |download_action_callback| must not be null. | 292 // |download_action_callback| must not be null. |
294 // |get_content_callback| may be null. | 293 // |get_content_callback| and |progress_callback| may be null. |
295 virtual void DownloadFile( | 294 virtual void DownloadFile( |
296 const base::FilePath& virtual_path, | 295 const base::FilePath& virtual_path, |
297 const base::FilePath& local_cache_path, | 296 const base::FilePath& local_cache_path, |
298 const GURL& download_url, | 297 const GURL& download_url, |
299 const DownloadActionCallback& download_action_callback, | 298 const DownloadActionCallback& download_action_callback, |
300 const GetContentCallback& get_content_callback) = 0; | 299 const GetContentCallback& get_content_callback, |
| 300 const ProgressCallback& progress_callback) = 0; |
301 | 301 |
302 // Initiates uploading of a new document/file. | 302 // Initiates uploading of a new document/file. |
303 // |content_type| and |content_length| should be the ones of the file to be | 303 // |content_type| and |content_length| should be the ones of the file to be |
304 // uploaded. | 304 // uploaded. |
305 // |callback| must not be null. | 305 // |callback| must not be null. |
306 virtual void InitiateUploadNewFile( | 306 virtual void InitiateUploadNewFile( |
307 const base::FilePath& drive_file_path, | 307 const base::FilePath& drive_file_path, |
308 const std::string& content_type, | 308 const std::string& content_type, |
309 int64 content_length, | 309 int64 content_length, |
310 const std::string& parent_resource_id, | 310 const std::string& parent_resource_id, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 // Upon completion, invokes |callback| with the link to open the file with | 352 // Upon completion, invokes |callback| with the link to open the file with |
353 // the provided app. |callback| must not be null. | 353 // the provided app. |callback| must not be null. |
354 virtual void AuthorizeApp(const std::string& resource_id, | 354 virtual void AuthorizeApp(const std::string& resource_id, |
355 const std::string& app_id, | 355 const std::string& app_id, |
356 const AuthorizeAppCallback& callback) = 0; | 356 const AuthorizeAppCallback& callback) = 0; |
357 }; | 357 }; |
358 | 358 |
359 } // namespace google_apis | 359 } // namespace google_apis |
360 | 360 |
361 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ | 361 #endif // CHROME_BROWSER_GOOGLE_APIS_DRIVE_SERVICE_INTERFACE_H_ |
OLD | NEW |