| 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_AUTH_SERVICE_INTERFACE_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/google_apis/base_operations.h" | 10 #include "chrome/browser/google_apis/base_operations.h" |
| 11 #include "chrome/browser/google_apis/gdata_errorcode.h" | 11 #include "chrome/browser/google_apis/gdata_errorcode.h" |
| 12 | 12 |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 namespace google_apis { | 15 namespace google_apis { |
| 16 | 16 |
| 17 class OperationRegistry; | 17 class OperationRegistry; |
| 18 class AuthServiceObserver; | 18 class AuthServiceObserver; |
| 19 | 19 |
| 20 // Called when fetching of access token is complete. | 20 // Called when fetching of access token is complete. |
| 21 typedef base::Callback<void(GDataErrorCode error, | 21 typedef base::Callback<void(GDataErrorCode error, |
| 22 const std::string& access_token)> | 22 const std::string& access_token)> |
| 23 AuthStatusCallback; | 23 AuthStatusCallback; |
| 24 | 24 |
| 25 // This defines an interface for the authentication service which is required | 25 // This defines an interface for the authentication service which is required |
| 26 // by authenticated operations (AuthenticatedOperationInterface). | 26 // by authenticated operations (AuthenticatedOperationInterface). |
| 27 // All functions must be called on UI thread. | 27 // All functions must be called on UI thread. |
| 28 class AuthServiceInterface { | 28 class AuthServiceInterface { |
| 29 public: | 29 public: |
| 30 virtual ~AuthServiceInterface() { } |
| 31 |
| 30 // Adds and removes the observer. AddObserver() should be called before | 32 // Adds and removes the observer. AddObserver() should be called before |
| 31 // Initialize() as it can change the refresh token. | 33 // Initialize() as it can change the refresh token. |
| 32 virtual void AddObserver(AuthServiceObserver* observer) = 0; | 34 virtual void AddObserver(AuthServiceObserver* observer) = 0; |
| 33 virtual void RemoveObserver(AuthServiceObserver* observer) = 0; | 35 virtual void RemoveObserver(AuthServiceObserver* observer) = 0; |
| 34 | 36 |
| 35 // Initializes the auth service. Starts TokenService to retrieve the | 37 // Initializes the auth service. Starts TokenService to retrieve the |
| 36 // refresh token. | 38 // refresh token. |
| 37 virtual void Initialize(Profile* profile) = 0; | 39 virtual void Initialize(Profile* profile) = 0; |
| 38 | 40 |
| 39 // Starts fetching OAuth2 access token from the refresh token. | 41 // Starts fetching OAuth2 access token from the refresh token. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 56 // Clears OAuth2 access token. | 58 // Clears OAuth2 access token. |
| 57 virtual void ClearAccessToken() = 0; | 59 virtual void ClearAccessToken() = 0; |
| 58 | 60 |
| 59 // Clears OAuth2 refresh token. | 61 // Clears OAuth2 refresh token. |
| 60 virtual void ClearRefreshToken() = 0; | 62 virtual void ClearRefreshToken() = 0; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 } // namespace google_apis | 65 } // namespace google_apis |
| 64 | 66 |
| 65 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ | 67 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ |
| OLD | NEW |