OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 enum TokenHandleStatus { VALID, INVALID, UNKNOWN }; | 34 enum TokenHandleStatus { VALID, INVALID, UNKNOWN }; |
35 | 35 |
36 typedef base::Callback<void(const user_manager::UserID&, TokenHandleStatus)> | 36 typedef base::Callback<void(const user_manager::UserID&, TokenHandleStatus)> |
37 TokenValidationCallback; | 37 TokenValidationCallback; |
38 | 38 |
39 // Returns true if UserManager has token handle associated with |user_id|. | 39 // Returns true if UserManager has token handle associated with |user_id|. |
40 bool HasToken(const user_manager::UserID& user_id); | 40 bool HasToken(const user_manager::UserID& user_id); |
41 | 41 |
42 // Removes token handle for |user_id| from UserManager storage. | 42 // Removes token handle for |user_id| from UserManager storage. |
43 void DeleteToken(const user_manager::UserID& user_id); | 43 void DeleteHandle(const user_manager::UserID& user_id); |
| 44 |
| 45 // Marks current handle as invalid, new one should be obtained at next sign |
| 46 // in. |
| 47 void MarkHandleInvalid(const user_manager::UserID& user_id); |
| 48 |
| 49 // Indicates if token handle for |user_id| is missing or marked as invalid. |
| 50 bool ShouldObtainHandle(const user_manager::UserID& user_id); |
44 | 51 |
45 // Performs token handle check for |user_id|. Will call |callback| with | 52 // Performs token handle check for |user_id|. Will call |callback| with |
46 // corresponding result. | 53 // corresponding result. |
47 void CheckToken(const user_manager::UserID& user_id, | 54 void CheckToken(const user_manager::UserID& user_id, |
48 const TokenValidationCallback& callback); | 55 const TokenValidationCallback& callback); |
49 | 56 |
50 // Given the OAuth |access_token| attempt to obtain token handle and store it | 57 // Given the OAuth |access_token| attempt to obtain token handle and store it |
51 // for |user_id|. | 58 // for |user_id|. |
52 void GetTokenHandle(const user_manager::UserID& user_id, | 59 void GetTokenHandle(const user_manager::UserID& user_id, |
53 const std::string& access_token, | 60 const std::string& access_token, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 104 |
98 // Instance of GAIA Client. | 105 // Instance of GAIA Client. |
99 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; | 106 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; |
100 | 107 |
101 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; | 108 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; |
102 | 109 |
103 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); | 110 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); |
104 }; | 111 }; |
105 | 112 |
106 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 113 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
OLD | NEW |