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" |
11 #include "google_apis/drive/auth_service_interface.h" | 11 #include "google_apis/drive/auth_service_interface.h" |
12 #include "google_apis/drive/base_requests.h" | 12 #include "google_apis/drive/base_requests.h" |
13 #include "google_apis/drive/drive_api_requests.h" | 13 #include "google_apis/drive/drive_api_requests.h" |
14 #include "google_apis/drive/drive_common_callbacks.h" | 14 #include "google_apis/drive/drive_common_callbacks.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class Time; | 17 class Time; |
18 } | 18 } |
19 | 19 |
20 namespace drive { | 20 namespace drive { |
21 | 21 |
22 // Function which converts the given resource ID into the desired format. | |
23 typedef base::Callback<std::string( | |
24 const std::string& resource_id)> ResourceIdCanonicalizer; | |
25 | |
26 // Observer interface for DriveServiceInterface. | 22 // Observer interface for DriveServiceInterface. |
27 class DriveServiceObserver { | 23 class DriveServiceObserver { |
28 public: | 24 public: |
29 // Triggered when the service gets ready to send requests. | 25 // Triggered when the service gets ready to send requests. |
30 virtual void OnReadyToSendRequests() {} | 26 virtual void OnReadyToSendRequests() {} |
31 | 27 |
32 // Called when the refresh token was found to be invalid. | 28 // Called when the refresh token was found to be invalid. |
33 virtual void OnRefreshTokenInvalid() {} | 29 virtual void OnRefreshTokenInvalid() {} |
34 | 30 |
35 protected: | 31 protected: |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 103 |
108 // Adds an observer. | 104 // Adds an observer. |
109 virtual void AddObserver(DriveServiceObserver* observer) = 0; | 105 virtual void AddObserver(DriveServiceObserver* observer) = 0; |
110 | 106 |
111 // Removes an observer. | 107 // Removes an observer. |
112 virtual void RemoveObserver(DriveServiceObserver* observer) = 0; | 108 virtual void RemoveObserver(DriveServiceObserver* observer) = 0; |
113 | 109 |
114 // True if ready to send requests. | 110 // True if ready to send requests. |
115 virtual bool CanSendRequest() const = 0; | 111 virtual bool CanSendRequest() const = 0; |
116 | 112 |
117 // Returns a function which converts the given resource ID into the desired | |
118 // format. | |
119 virtual ResourceIdCanonicalizer GetResourceIdCanonicalizer() const = 0; | |
120 | |
121 // Authentication service: | 113 // Authentication service: |
122 | 114 |
123 // True if OAuth2 access token is retrieved and believed to be fresh. | 115 // True if OAuth2 access token is retrieved and believed to be fresh. |
124 virtual bool HasAccessToken() const = 0; | 116 virtual bool HasAccessToken() const = 0; |
125 | 117 |
126 // Gets the cached OAuth2 access token or if empty, then fetches a new one. | 118 // Gets the cached OAuth2 access token or if empty, then fetches a new one. |
127 virtual void RequestAccessToken( | 119 virtual void RequestAccessToken( |
128 const google_apis::AuthStatusCallback& callback) = 0; | 120 const google_apis::AuthStatusCallback& callback) = 0; |
129 | 121 |
130 // True if OAuth2 refresh token is present. | 122 // True if OAuth2 refresh token is present. |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 virtual google_apis::CancelCallback AddPermission( | 412 virtual google_apis::CancelCallback AddPermission( |
421 const std::string& resource_id, | 413 const std::string& resource_id, |
422 const std::string& email, | 414 const std::string& email, |
423 google_apis::drive::PermissionRole role, | 415 google_apis::drive::PermissionRole role, |
424 const google_apis::EntryActionCallback& callback) = 0; | 416 const google_apis::EntryActionCallback& callback) = 0; |
425 }; | 417 }; |
426 | 418 |
427 } // namespace drive | 419 } // namespace drive |
428 | 420 |
429 #endif // CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ | 421 #endif // CHROME_BROWSER_DRIVE_DRIVE_SERVICE_INTERFACE_H_ |
OLD | NEW |