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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Marks current handle as invalid, new one should be obtained at next sign | 46 // Marks current handle as invalid, new one should be obtained at next sign |
47 // in. | 47 // in. |
48 void MarkHandleInvalid(const user_manager::UserID& user_id); | 48 void MarkHandleInvalid(const user_manager::UserID& user_id); |
49 | 49 |
50 // Indicates if token handle for |user_id| is missing or marked as invalid. | 50 // Indicates if token handle for |user_id| is missing or marked as invalid. |
51 bool ShouldObtainHandle(const user_manager::UserID& user_id); | 51 bool ShouldObtainHandle(const user_manager::UserID& user_id); |
52 | 52 |
53 // Performs token handle check for |user_id|. Will call |callback| with | 53 // Performs token handle check for |user_id|. Will call |callback| with |
54 // corresponding result. | 54 // corresponding result. |
55 void CheckToken(const user_manager::UserID& user_id, | 55 // Returns true if token check successfully started. Returns false if |
| 56 // there is already token check request for this token, and another one is not |
| 57 // possible now. |
| 58 bool CheckToken(const user_manager::UserID& user_id, |
56 const TokenValidationCallback& callback); | 59 const TokenValidationCallback& callback); |
57 | 60 |
58 // Given the token |handle| store it for |user_id|. | 61 // Given the token |handle| store it for |user_id|. |
59 void StoreTokenHandle(const user_manager::UserID& user_id, | 62 void StoreTokenHandle(const user_manager::UserID& user_id, |
60 const std::string& handle); | 63 const std::string& handle); |
61 | 64 |
62 private: | 65 private: |
63 // Associates GaiaOAuthClient::Delegate with User ID and Token. | 66 // Associates GaiaOAuthClient::Delegate with User ID and Token. |
64 class TokenDelegate : public gaia::GaiaOAuthClient::Delegate { | 67 class TokenDelegate : public gaia::GaiaOAuthClient::Delegate { |
65 public: | 68 public: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 103 |
101 // Instance of GAIA Client. | 104 // Instance of GAIA Client. |
102 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; | 105 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; |
103 | 106 |
104 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; | 107 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; |
105 | 108 |
106 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); | 109 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); |
107 }; | 110 }; |
108 | 111 |
109 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ | 112 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ |
OLD | NEW |