| 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* GetEasyUnlockKeyManager(); |
| 160 |
| 155 private: | 161 private: |
| 156 friend struct DefaultSingletonTraits<UserSessionManager>; | 162 friend struct DefaultSingletonTraits<UserSessionManager>; |
| 157 | 163 |
| 158 typedef std::set<std::string> SigninSessionRestoreStateSet; | 164 typedef std::set<std::string> SigninSessionRestoreStateSet; |
| 159 | 165 |
| 160 UserSessionManager(); | 166 UserSessionManager(); |
| 161 virtual ~UserSessionManager(); | 167 virtual ~UserSessionManager(); |
| 162 | 168 |
| 163 // OAuth2LoginManager::Observer overrides: | 169 // OAuth2LoginManager::Observer overrides: |
| 164 virtual void OnSessionRestoreStateChanged( | 170 virtual void OnSessionRestoreStateChanged( |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 234 |
| 229 // Called by OnRestoreActiveSessions() when there're user sessions in | 235 // Called by OnRestoreActiveSessions() when there're user sessions in |
| 230 // |pending_user_sessions_| that has to be restored one by one. | 236 // |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. | 237 // 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. | 238 // Process continues till |pending_user_sessions_| map is not empty. |
| 233 void RestorePendingUserSessions(); | 239 void RestorePendingUserSessions(); |
| 234 | 240 |
| 235 // Notifies observers that user pending sessions restore has finished. | 241 // Notifies observers that user pending sessions restore has finished. |
| 236 void NotifyPendingUserSessionsRestoreFinished(); | 242 void NotifyPendingUserSessionsRestoreFinished(); |
| 237 | 243 |
| 244 // Update Easy unlock cryptohome keys using the pairing data in user prefs. |
| 245 void UpdateEasyUnlockKeys(Profile* user_profile); |
| 246 |
| 238 UserSessionManagerDelegate* delegate_; | 247 UserSessionManagerDelegate* delegate_; |
| 239 | 248 |
| 240 // Authentication/user context. | 249 // Authentication/user context. |
| 241 UserContext user_context_; | 250 UserContext user_context_; |
| 242 scoped_refptr<Authenticator> authenticator_; | 251 scoped_refptr<Authenticator> authenticator_; |
| 243 | 252 |
| 244 // True if the authentication context's cookie jar contains authentication | 253 // True if the authentication context's cookie jar contains authentication |
| 245 // cookies from the authentication extension login flow. | 254 // cookies from the authentication extension login flow. |
| 246 bool has_auth_cookies_; | 255 bool has_auth_cookies_; |
| 247 | 256 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 274 | 283 |
| 275 // Kiosk mode related members. | 284 // Kiosk mode related members. |
| 276 // Chrome oauth client id and secret - override values for kiosk mode. | 285 // Chrome oauth client id and secret - override values for kiosk mode. |
| 277 std::string chrome_client_id_; | 286 std::string chrome_client_id_; |
| 278 std::string chrome_client_secret_; | 287 std::string chrome_client_secret_; |
| 279 | 288 |
| 280 // Per-user-session Input Methods states. | 289 // Per-user-session Input Methods states. |
| 281 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State> > | 290 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State> > |
| 282 default_ime_states_; | 291 default_ime_states_; |
| 283 | 292 |
| 293 // Manages Easy unlock cryptohome keys. |
| 294 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
| 295 |
| 284 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 296 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
| 285 }; | 297 }; |
| 286 | 298 |
| 287 } // namespace chromeos | 299 } // namespace chromeos |
| 288 | 300 |
| 289 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 301 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
| OLD | NEW |