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 "base/callback_forward.h" | 10 #include "base/callback_forward.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 AuthServiceObserver; | 17 class AuthServiceObserver; |
18 | 18 |
19 // Called when fetching of access token is complete. | 19 // Called when fetching of access token is complete. |
20 typedef base::Callback<void(GDataErrorCode error, | 20 typedef base::Callback<void(GDataErrorCode error, |
21 const std::string& access_token)> | 21 const std::string& access_token)> |
22 AuthStatusCallback; | 22 AuthStatusCallback; |
23 | 23 |
24 // This defines an interface for the authentication service which is required | 24 // This defines an interface for the authentication service which is required |
25 // by authenticated operations (AuthenticatedOperationInterface). | 25 // by authenticated operations (AuthenticatedRequestInterface). |
26 // All functions must be called on UI thread. | 26 // All functions must be called on UI thread. |
27 class AuthServiceInterface { | 27 class AuthServiceInterface { |
28 public: | 28 public: |
29 // Adds and removes the observer. AddObserver() should be called before | 29 // Adds and removes the observer. AddObserver() should be called before |
30 // Initialize() as it can change the refresh token. | 30 // Initialize() as it can change the refresh token. |
31 virtual void AddObserver(AuthServiceObserver* observer) = 0; | 31 virtual void AddObserver(AuthServiceObserver* observer) = 0; |
32 virtual void RemoveObserver(AuthServiceObserver* observer) = 0; | 32 virtual void RemoveObserver(AuthServiceObserver* observer) = 0; |
33 | 33 |
34 // Initializes the auth service. Starts TokenService to retrieve the | 34 // Initializes the auth service. Starts TokenService to retrieve the |
35 // refresh token. | 35 // refresh token. |
(...skipping 18 matching lines...) Expand all Loading... |
54 // Clears OAuth2 access token. | 54 // Clears OAuth2 access token. |
55 virtual void ClearAccessToken() = 0; | 55 virtual void ClearAccessToken() = 0; |
56 | 56 |
57 // Clears OAuth2 refresh token. | 57 // Clears OAuth2 refresh token. |
58 virtual void ClearRefreshToken() = 0; | 58 virtual void ClearRefreshToken() = 0; |
59 }; | 59 }; |
60 | 60 |
61 } // namespace google_apis | 61 } // namespace google_apis |
62 | 62 |
63 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ | 63 #endif // CHROME_BROWSER_GOOGLE_APIS_AUTH_SERVICE_INTERFACE_H_ |
OLD | NEW |