| 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_DRIVE_DRIVE_SERVICE_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ | 6 #define CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Triggered when the service gets ready to send requests. | 25 // Triggered when the service gets ready to send requests. |
| 26 virtual void OnReadyToSendRequests() {} | 26 virtual void OnReadyToSendRequests() {} |
| 27 | 27 |
| 28 // Called when the refresh token was found to be invalid. | 28 // Called when the refresh token was found to be invalid. |
| 29 virtual void OnRefreshTokenInvalid() {} | 29 virtual void OnRefreshTokenInvalid() {} |
| 30 | 30 |
| 31 protected: | 31 protected: |
| 32 virtual ~DriveServiceObserver() {} | 32 virtual ~DriveServiceObserver() {} |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Optional parameters for AddNewDirectory(). |
| 36 struct AddNewDirectoryOptions { |
| 37 AddNewDirectoryOptions(); |
| 38 ~AddNewDirectoryOptions(); |
| 39 |
| 40 // modified_date of the directory. |
| 41 // Pass the null Time if you are not interested in setting this property. |
| 42 base::Time modified_date; |
| 43 |
| 44 // last_viewed_by_me_date of the directory. |
| 45 // Pass the null Time if you are not interested in setting this property. |
| 46 base::Time last_viewed_by_me_date; |
| 47 |
| 48 // List of properties for a new directory. |
| 49 google_apis::drive::Properties properties; |
| 50 }; |
| 51 |
| 52 // Optional parameters for InitiateUploadNewFile() and |
| 53 // MultipartUploadNewFile(). |
| 54 struct UploadNewFileOptions { |
| 55 UploadNewFileOptions(); |
| 56 ~UploadNewFileOptions(); |
| 57 |
| 58 // modified_date of the file. |
| 59 // Pass the null Time if you are not interested in setting this property. |
| 60 base::Time modified_date; |
| 61 |
| 62 // last_viewed_by_me_date of the file. |
| 63 // Pass the null Time if you are not interested in setting this property. |
| 64 base::Time last_viewed_by_me_date; |
| 65 |
| 66 // List of properties for a new file. |
| 67 google_apis::drive::Properties properties; |
| 68 }; |
| 69 |
| 70 // Optional parameters for InitiateUploadExistingFile() and |
| 71 // MultipartUploadExistingFile(). |
| 72 struct UploadExistingFileOptions { |
| 73 UploadExistingFileOptions(); |
| 74 ~UploadExistingFileOptions(); |
| 75 |
| 76 // Expected ETag of the file. UPLOAD_ERROR_CONFLICT error is generated when |
| 77 // matching fails. |
| 78 // Pass the empty string to disable this behavior. |
| 79 std::string etag; |
| 80 |
| 81 // New parent of the file. |
| 82 // Pass the empty string to keep the property unchanged. |
| 83 std::string parent_resource_id; |
| 84 |
| 85 // New title of the file. |
| 86 // Pass the empty string to keep the property unchanged. |
| 87 std::string title; |
| 88 |
| 89 // New modified_date of the file. |
| 90 // Pass the null Time if you are not interested in setting this property. |
| 91 base::Time modified_date; |
| 92 |
| 93 // New last_viewed_by_me_date of the file. |
| 94 // Pass the null Time if you are not interested in setting this property. |
| 95 base::Time last_viewed_by_me_date; |
| 96 |
| 97 // List of new properties for an existing file (it will be merged with |
| 98 // existing properties). |
| 99 google_apis::drive::Properties properties; |
| 100 }; |
| 101 |
| 35 // This defines an interface for sharing by DriveService and MockDriveService | 102 // This defines an interface for sharing by DriveService and MockDriveService |
| 36 // so that we can do testing of clients of DriveService. | 103 // so that we can do testing of clients of DriveService. |
| 37 // | 104 // |
| 38 // All functions must be called on UI thread. DriveService is built on top of | 105 // All functions must be called on UI thread. DriveService is built on top of |
| 39 // URLFetcher that runs on UI thread. | 106 // URLFetcher that runs on UI thread. |
| 40 class DriveServiceInterface { | 107 class DriveServiceInterface { |
| 41 public: | 108 public: |
| 42 // Optional parameters for AddNewDirectory(). | |
| 43 struct AddNewDirectoryOptions { | |
| 44 AddNewDirectoryOptions(); | |
| 45 ~AddNewDirectoryOptions(); | |
| 46 | |
| 47 // modified_date of the directory. | |
| 48 // Pass the null Time if you are not interested in setting this property. | |
| 49 base::Time modified_date; | |
| 50 | |
| 51 // last_viewed_by_me_date of the directory. | |
| 52 // Pass the null Time if you are not interested in setting this property. | |
| 53 base::Time last_viewed_by_me_date; | |
| 54 | |
| 55 // List of properties for a new directory. | |
| 56 google_apis::drive::Properties properties; | |
| 57 }; | |
| 58 | |
| 59 // Optional parameters for InitiateUploadNewFile() and | |
| 60 // MultipartUploadNewFile(). | |
| 61 struct UploadNewFileOptions { | |
| 62 UploadNewFileOptions(); | |
| 63 ~UploadNewFileOptions(); | |
| 64 | |
| 65 // modified_date of the file. | |
| 66 // Pass the null Time if you are not interested in setting this property. | |
| 67 base::Time modified_date; | |
| 68 | |
| 69 // last_viewed_by_me_date of the file. | |
| 70 // Pass the null Time if you are not interested in setting this property. | |
| 71 base::Time last_viewed_by_me_date; | |
| 72 | |
| 73 // List of properties for a new file. | |
| 74 google_apis::drive::Properties properties; | |
| 75 }; | |
| 76 | |
| 77 // Optional parameters for InitiateUploadExistingFile() and | |
| 78 // MultipartUploadExistingFile(). | |
| 79 struct UploadExistingFileOptions { | |
| 80 UploadExistingFileOptions(); | |
| 81 ~UploadExistingFileOptions(); | |
| 82 | |
| 83 // Expected ETag of the file. UPLOAD_ERROR_CONFLICT error is generated when | |
| 84 // matching fails. | |
| 85 // Pass the empty string to disable this behavior. | |
| 86 std::string etag; | |
| 87 | |
| 88 // New parent of the file. | |
| 89 // Pass the empty string to keep the property unchanged. | |
| 90 std::string parent_resource_id; | |
| 91 | |
| 92 // New title of the file. | |
| 93 // Pass the empty string to keep the property unchanged. | |
| 94 std::string title; | |
| 95 | |
| 96 // New modified_date of the file. | |
| 97 // Pass the null Time if you are not interested in setting this property. | |
| 98 base::Time modified_date; | |
| 99 | |
| 100 // New last_viewed_by_me_date of the file. | |
| 101 // Pass the null Time if you are not interested in setting this property. | |
| 102 base::Time last_viewed_by_me_date; | |
| 103 | |
| 104 // List of new properties for an existing file (it will be merged with | |
| 105 // existing properties). | |
| 106 google_apis::drive::Properties properties; | |
| 107 }; | |
| 108 | |
| 109 virtual ~DriveServiceInterface() {} | 109 virtual ~DriveServiceInterface() {} |
| 110 | 110 |
| 111 // Common service: | 111 // Common service: |
| 112 | 112 |
| 113 // Initializes the documents service with |account_id|. | 113 // Initializes the documents service with |account_id|. |
| 114 virtual void Initialize(const std::string& account_id) = 0; | 114 virtual void Initialize(const std::string& account_id) = 0; |
| 115 | 115 |
| 116 // Adds an observer. | 116 // Adds an observer. |
| 117 virtual void AddObserver(DriveServiceObserver* observer) = 0; | 117 virtual void AddObserver(DriveServiceObserver* observer) = 0; |
| 118 | 118 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 virtual google_apis::CancelCallback AddPermission( | 439 virtual google_apis::CancelCallback AddPermission( |
| 440 const std::string& resource_id, | 440 const std::string& resource_id, |
| 441 const std::string& email, | 441 const std::string& email, |
| 442 google_apis::drive::PermissionRole role, | 442 google_apis::drive::PermissionRole role, |
| 443 const google_apis::EntryActionCallback& callback) = 0; | 443 const google_apis::EntryActionCallback& callback) = 0; |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 } // namespace drive | 446 } // namespace drive |
| 447 | 447 |
| 448 #endif // CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ | 448 #endif // CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ |
| OLD | NEW |