| 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/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "chrome/browser/chromeos/base/locale_util.h" | 16 #include "chrome/browser/chromeos/base/locale_util.h" |
| 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
| 18 #include "chrome/browser/supervised_user/child_accounts/child_account_status_obs
erver.h" |
| 18 #include "chromeos/dbus/session_manager_client.h" | 19 #include "chromeos/dbus/session_manager_client.h" |
| 19 #include "chromeos/login/auth/authenticator.h" | 20 #include "chromeos/login/auth/authenticator.h" |
| 20 #include "chromeos/login/auth/user_context.h" | 21 #include "chromeos/login/auth/user_context.h" |
| 21 #include "components/user_manager/user.h" | 22 #include "components/user_manager/user.h" |
| 22 #include "components/user_manager/user_manager.h" | 23 #include "components/user_manager/user_manager.h" |
| 23 #include "net/base/network_change_notifier.h" | 24 #include "net/base/network_change_notifier.h" |
| 24 #include "ui/base/ime/chromeos/input_method_manager.h" | 25 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 25 | 26 |
| 26 class GURL; | 27 class GURL; |
| 27 class PrefRegistrySimple; | 28 class PrefRegistrySimple; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // * mark user as logged in and notify observers, | 69 // * mark user as logged in and notify observers, |
| 69 // * initialize OAuth2 authentication session, | 70 // * initialize OAuth2 authentication session, |
| 70 // * initialize and launch user session based on the user type. | 71 // * initialize and launch user session based on the user type. |
| 71 // Also supports restoring active user sessions after browser crash: | 72 // Also supports restoring active user sessions after browser crash: |
| 72 // load profile, restore OAuth authentication session etc. | 73 // load profile, restore OAuth authentication session etc. |
| 73 class UserSessionManager | 74 class UserSessionManager |
| 74 : public OAuth2LoginManager::Observer, | 75 : public OAuth2LoginManager::Observer, |
| 75 public net::NetworkChangeNotifier::ConnectionTypeObserver, | 76 public net::NetworkChangeNotifier::ConnectionTypeObserver, |
| 76 public base::SupportsWeakPtr<UserSessionManager>, | 77 public base::SupportsWeakPtr<UserSessionManager>, |
| 77 public UserSessionManagerDelegate, | 78 public UserSessionManagerDelegate, |
| 78 public user_manager::UserManager::UserSessionStateObserver { | 79 public user_manager::UserManager::UserSessionStateObserver, |
| 80 public ChildAccountStatusObserver { |
| 79 public: | 81 public: |
| 80 // Context of StartSession calls. | 82 // Context of StartSession calls. |
| 81 typedef enum { | 83 typedef enum { |
| 82 // Starting primary user session, through login UI. | 84 // Starting primary user session, through login UI. |
| 83 PRIMARY_USER_SESSION, | 85 PRIMARY_USER_SESSION, |
| 84 | 86 |
| 85 // Starting secondary user session, through multi-profiles login UI. | 87 // Starting secondary user session, through multi-profiles login UI. |
| 86 SECONDARY_USER_SESSION, | 88 SECONDARY_USER_SESSION, |
| 87 | 89 |
| 88 // Starting primary user session after browser crash. | 90 // Starting primary user session after browser crash. |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 OAuth2LoginManager::SessionRestoreState state) override; | 240 OAuth2LoginManager::SessionRestoreState state) override; |
| 239 | 241 |
| 240 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: | 242 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: |
| 241 void OnConnectionTypeChanged( | 243 void OnConnectionTypeChanged( |
| 242 net::NetworkChangeNotifier::ConnectionType type) override; | 244 net::NetworkChangeNotifier::ConnectionType type) override; |
| 243 | 245 |
| 244 // UserSessionManagerDelegate overrides: | 246 // UserSessionManagerDelegate overrides: |
| 245 // Used when restoring user sessions after crash. | 247 // Used when restoring user sessions after crash. |
| 246 void OnProfilePrepared(Profile* profile, bool browser_launched) override; | 248 void OnProfilePrepared(Profile* profile, bool browser_launched) override; |
| 247 | 249 |
| 250 // ChildAccountStatusObserver override: |
| 251 void OnChildAccountStatusChanged() override; |
| 252 |
| 253 void StopStatusObserving(); |
| 254 |
| 248 void CreateUserSession(const UserContext& user_context, | 255 void CreateUserSession(const UserContext& user_context, |
| 249 bool has_auth_cookies); | 256 bool has_auth_cookies); |
| 250 void PreStartSession(); | 257 void PreStartSession(); |
| 251 void StartCrosSession(); | 258 void StartCrosSession(); |
| 252 void NotifyUserLoggedIn(); | 259 void NotifyUserLoggedIn(); |
| 253 void PrepareProfile(); | 260 void PrepareProfile(); |
| 254 | 261 |
| 255 // Callback for asynchronous profile creation. | 262 // Callback for asynchronous profile creation. |
| 256 void OnProfileCreated(const UserContext& user_context, | 263 void OnProfileCreated(const UserContext& user_context, |
| 257 bool is_incognito_profile, | 264 bool is_incognito_profile, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 ProfileCompare> default_ime_states_; | 413 ProfileCompare> default_ime_states_; |
| 407 | 414 |
| 408 // Manages Easy unlock cryptohome keys. | 415 // Manages Easy unlock cryptohome keys. |
| 409 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; | 416 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
| 410 bool running_easy_unlock_key_ops_; | 417 bool running_easy_unlock_key_ops_; |
| 411 base::Closure easy_unlock_key_ops_finished_callback_; | 418 base::Closure easy_unlock_key_ops_finished_callback_; |
| 412 | 419 |
| 413 // Whether should launch browser, tests may override this value. | 420 // Whether should launch browser, tests may override this value. |
| 414 bool should_launch_browser_; | 421 bool should_launch_browser_; |
| 415 | 422 |
| 423 // Whether we have postponed request for InitializeStartUrls call. |
| 424 bool init_start_urls_was_postponed_; |
| 425 Profile* profile_fetching_flags_; |
| 426 |
| 427 base::WeakPtrFactory<UserSessionManager> weak_factory_; |
| 428 |
| 416 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 429 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
| 417 }; | 430 }; |
| 418 | 431 |
| 419 } // namespace chromeos | 432 } // namespace chromeos |
| 420 | 433 |
| 421 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 434 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
| OLD | NEW |