OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SESSION_USER_SESSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
14 #include "chrome/browser/chromeos/base/locale_util.h" | 15 #include "chrome/browser/chromeos/base/locale_util.h" |
15 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 16 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
16 #include "chromeos/dbus/session_manager_client.h" | 17 #include "chromeos/dbus/session_manager_client.h" |
17 #include "chromeos/ime/input_method_manager.h" | 18 #include "chromeos/ime/input_method_manager.h" |
18 #include "chromeos/login/auth/authenticator.h" | 19 #include "chromeos/login/auth/authenticator.h" |
19 #include "chromeos/login/auth/user_context.h" | 20 #include "chromeos/login/auth/user_context.h" |
20 #include "components/user_manager/user.h" | 21 #include "components/user_manager/user.h" |
21 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
22 #include "net/base/network_change_notifier.h" | 23 #include "net/base/network_change_notifier.h" |
23 | 24 |
24 class PrefRegistrySimple; | 25 class PrefRegistrySimple; |
25 class PrefService; | 26 class PrefService; |
26 class Profile; | 27 class Profile; |
27 | 28 |
28 namespace user_manager { | 29 namespace user_manager { |
29 | 30 |
30 class User; | 31 class User; |
31 | 32 |
32 } // namespace user_manager | 33 } // namespace user_manager |
33 | 34 |
34 namespace chromeos { | 35 namespace chromeos { |
35 | 36 |
| 37 class EasyUnlockKeyManager; |
| 38 |
36 class UserSessionManagerDelegate { | 39 class UserSessionManagerDelegate { |
37 public: | 40 public: |
38 // Called after profile is loaded and prepared for the session. | 41 // Called after profile is loaded and prepared for the session. |
39 virtual void OnProfilePrepared(Profile* profile) = 0; | 42 virtual void OnProfilePrepared(Profile* profile) = 0; |
40 | 43 |
41 #if defined(ENABLE_RLZ) | 44 #if defined(ENABLE_RLZ) |
42 // Called after post-profile RLZ initialization. | 45 // Called after post-profile RLZ initialization. |
43 virtual void OnRlzInitialized(); | 46 virtual void OnRlzInitialized(); |
44 #endif | 47 #endif |
45 protected: | 48 protected: |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer); | 148 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer); |
146 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer); | 149 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer); |
147 | 150 |
148 virtual void ActiveUserChanged( | 151 virtual void ActiveUserChanged( |
149 const user_manager::User* active_user) OVERRIDE; | 152 const user_manager::User* active_user) OVERRIDE; |
150 | 153 |
151 // Returns default IME state for user session. | 154 // Returns default IME state for user session. |
152 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( | 155 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( |
153 Profile* profile); | 156 Profile* profile); |
154 | 157 |
| 158 // Note this could return NULL if not enabled. |
| 159 EasyUnlockKeyManager* easy_unlock_key_manager() { |
| 160 return easy_unlock_key_manager_.get(); |
| 161 } |
| 162 |
155 private: | 163 private: |
156 friend struct DefaultSingletonTraits<UserSessionManager>; | 164 friend struct DefaultSingletonTraits<UserSessionManager>; |
157 | 165 |
158 typedef std::set<std::string> SigninSessionRestoreStateSet; | 166 typedef std::set<std::string> SigninSessionRestoreStateSet; |
159 | 167 |
160 UserSessionManager(); | 168 UserSessionManager(); |
161 virtual ~UserSessionManager(); | 169 virtual ~UserSessionManager(); |
162 | 170 |
163 // OAuth2LoginManager::Observer overrides: | 171 // OAuth2LoginManager::Observer overrides: |
164 virtual void OnSessionRestoreStateChanged( | 172 virtual void OnSessionRestoreStateChanged( |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 236 |
229 // Called by OnRestoreActiveSessions() when there're user sessions in | 237 // Called by OnRestoreActiveSessions() when there're user sessions in |
230 // |pending_user_sessions_| that has to be restored one by one. | 238 // |pending_user_sessions_| that has to be restored one by one. |
231 // Also called after first user session from that list is restored and so on. | 239 // Also called after first user session from that list is restored and so on. |
232 // Process continues till |pending_user_sessions_| map is not empty. | 240 // Process continues till |pending_user_sessions_| map is not empty. |
233 void RestorePendingUserSessions(); | 241 void RestorePendingUserSessions(); |
234 | 242 |
235 // Notifies observers that user pending sessions restore has finished. | 243 // Notifies observers that user pending sessions restore has finished. |
236 void NotifyPendingUserSessionsRestoreFinished(); | 244 void NotifyPendingUserSessionsRestoreFinished(); |
237 | 245 |
| 246 // Update Easy unlock cryptohome keys using the pairing data in user prefs. |
| 247 void UpdateEasyUnlockKeys(Profile* user_profile); |
| 248 |
238 UserSessionManagerDelegate* delegate_; | 249 UserSessionManagerDelegate* delegate_; |
239 | 250 |
240 // Authentication/user context. | 251 // Authentication/user context. |
241 UserContext user_context_; | 252 UserContext user_context_; |
242 scoped_refptr<Authenticator> authenticator_; | 253 scoped_refptr<Authenticator> authenticator_; |
243 | 254 |
244 // True if the authentication context's cookie jar contains authentication | 255 // True if the authentication context's cookie jar contains authentication |
245 // cookies from the authentication extension login flow. | 256 // cookies from the authentication extension login flow. |
246 bool has_auth_cookies_; | 257 bool has_auth_cookies_; |
247 | 258 |
(...skipping 26 matching lines...) Expand all Loading... |
274 | 285 |
275 // Kiosk mode related members. | 286 // Kiosk mode related members. |
276 // Chrome oauth client id and secret - override values for kiosk mode. | 287 // Chrome oauth client id and secret - override values for kiosk mode. |
277 std::string chrome_client_id_; | 288 std::string chrome_client_id_; |
278 std::string chrome_client_secret_; | 289 std::string chrome_client_secret_; |
279 | 290 |
280 // Per-user-session Input Methods states. | 291 // Per-user-session Input Methods states. |
281 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State> > | 292 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State> > |
282 default_ime_states_; | 293 default_ime_states_; |
283 | 294 |
| 295 // Manages Easy unlock cryptohome keys. |
| 296 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
| 297 |
284 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 298 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
285 }; | 299 }; |
286 | 300 |
287 } // namespace chromeos | 301 } // namespace chromeos |
288 | 302 |
289 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 303 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
OLD | NEW |