Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: chrome/browser/chromeos/login/signin/token_handle_util.h

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/containers/scoped_ptr_hash_map.h" 12 #include "base/containers/scoped_ptr_hash_map.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "components/signin/core/account_id/account_id.h" 15 #include "components/signin/core/account_id/account_id.h"
16 #include "google_apis/gaia/gaia_oauth_client.h" 16 #include "google_apis/gaia/gaia_oauth_client.h"
17 17
18 class AccountId; 18 class AccountId;
19 19
20 namespace base { 20 namespace base {
21 class DictionaryValue; 21 class DictionaryValue;
22 } 22 }
23 23
24 namespace user_manager {
25 class UserManager;
26 }
27
28 // This class is responsible for operations with External Token Handle. 24 // This class is responsible for operations with External Token Handle.
29 // Handle is an extra token associated with OAuth refresh token that have 25 // Handle is an extra token associated with OAuth refresh token that have
30 // exactly same lifetime. It is not secure, and it's only purpose is checking 26 // exactly same lifetime. It is not secure, and it's only purpose is checking
31 // validity of corresponding refresh token in the insecure environment. 27 // validity of corresponding refresh token in the insecure environment.
32 class TokenHandleUtil { 28 class TokenHandleUtil {
33 public: 29 public:
34 explicit TokenHandleUtil(user_manager::UserManager* user_manager); 30 TokenHandleUtil();
35 ~TokenHandleUtil(); 31 ~TokenHandleUtil();
36 32
37 enum TokenHandleStatus { VALID, INVALID, UNKNOWN }; 33 enum TokenHandleStatus { VALID, INVALID, UNKNOWN };
38 34
39 using TokenValidationCallback = 35 using TokenValidationCallback =
40 base::Callback<void(const AccountId&, TokenHandleStatus)>; 36 base::Callback<void(const AccountId&, TokenHandleStatus)>;
41 37
42 // Returns true if UserManager has token handle associated with |account_id|. 38 // Returns true if UserManager has token handle associated with |account_id|.
43 bool HasToken(const AccountId& account_id); 39 bool HasToken(const AccountId& account_id);
44 40
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 std::string token_; 77 std::string token_;
82 base::TimeTicks tokeninfo_response_start_time_; 78 base::TimeTicks tokeninfo_response_start_time_;
83 TokenValidationCallback callback_; 79 TokenValidationCallback callback_;
84 80
85 DISALLOW_COPY_AND_ASSIGN(TokenDelegate); 81 DISALLOW_COPY_AND_ASSIGN(TokenDelegate);
86 }; 82 };
87 83
88 void OnValidationComplete(const std::string& token); 84 void OnValidationComplete(const std::string& token);
89 void OnObtainTokenComplete(const AccountId& account_id); 85 void OnObtainTokenComplete(const AccountId& account_id);
90 86
91 // UserManager that stores corresponding user data.
92 user_manager::UserManager* user_manager_;
93
94 // Map of pending check operations. 87 // Map of pending check operations.
95 base::ScopedPtrHashMap<std::string, scoped_ptr<TokenDelegate>> 88 base::ScopedPtrHashMap<std::string, scoped_ptr<TokenDelegate>>
96 validation_delegates_; 89 validation_delegates_;
97 90
98 // Map of pending obtain operations. 91 // Map of pending obtain operations.
99 base::ScopedPtrHashMap<AccountId, scoped_ptr<TokenDelegate>> 92 base::ScopedPtrHashMap<AccountId, scoped_ptr<TokenDelegate>>
100 obtain_delegates_; 93 obtain_delegates_;
101 94
102 // Instance of GAIA Client. 95 // Instance of GAIA Client.
103 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_; 96 scoped_ptr<gaia::GaiaOAuthClient> gaia_client_;
104 97
105 base::WeakPtrFactory<TokenHandleUtil> weak_factory_; 98 base::WeakPtrFactory<TokenHandleUtil> weak_factory_;
106 99
107 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil); 100 DISALLOW_COPY_AND_ASSIGN(TokenHandleUtil);
108 }; 101 };
109 102
110 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_ 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIGNIN_TOKEN_HANDLE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698