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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 OAuth2LoginManager::SessionRestoreState state) override; | 242 OAuth2LoginManager::SessionRestoreState state) override; |
241 | 243 |
242 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: | 244 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: |
243 void OnConnectionTypeChanged( | 245 void OnConnectionTypeChanged( |
244 net::NetworkChangeNotifier::ConnectionType type) override; | 246 net::NetworkChangeNotifier::ConnectionType type) override; |
245 | 247 |
246 // UserSessionManagerDelegate overrides: | 248 // UserSessionManagerDelegate overrides: |
247 // Used when restoring user sessions after crash. | 249 // Used when restoring user sessions after crash. |
248 void OnProfilePrepared(Profile* profile, bool browser_launched) override; | 250 void OnProfilePrepared(Profile* profile, bool browser_launched) override; |
249 | 251 |
252 // ChildAccountStatusObserver override: | |
253 void OnChildAccountStatusChanged(bool is_child) override; | |
254 | |
255 void StopStatusObserving(); | |
256 | |
250 void CreateUserSession(const UserContext& user_context, | 257 void CreateUserSession(const UserContext& user_context, |
251 bool has_auth_cookies); | 258 bool has_auth_cookies); |
252 void PreStartSession(); | 259 void PreStartSession(); |
253 void StartCrosSession(); | 260 void StartCrosSession(); |
254 void NotifyUserLoggedIn(); | 261 void NotifyUserLoggedIn(); |
255 void PrepareProfile(); | 262 void PrepareProfile(); |
256 | 263 |
257 // Callback for asynchronous profile creation. | 264 // Callback for asynchronous profile creation. |
258 void OnProfileCreated(const UserContext& user_context, | 265 void OnProfileCreated(const UserContext& user_context, |
259 bool is_incognito_profile, | 266 bool is_incognito_profile, |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 ProfileCompare> default_ime_states_; | 412 ProfileCompare> default_ime_states_; |
406 | 413 |
407 // Manages Easy unlock cryptohome keys. | 414 // Manages Easy unlock cryptohome keys. |
408 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; | 415 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
409 bool running_easy_unlock_key_ops_; | 416 bool running_easy_unlock_key_ops_; |
410 base::Closure easy_unlock_key_ops_finished_callback_; | 417 base::Closure easy_unlock_key_ops_finished_callback_; |
411 | 418 |
412 // Whether should launch browser, tests may override this value. | 419 // Whether should launch browser, tests may override this value. |
413 bool should_launch_browser_; | 420 bool should_launch_browser_; |
414 | 421 |
422 // Whether we have postponed request for InitializeStartUrls call. | |
423 bool init_start_urls_was_postponed_; | |
424 Profile* profile_fetching_flags_; | |
Bernhard Bauer
2015/03/10 09:55:12
Nit: this variable name reads to me like it stores
Marc Treib
2015/03/10 10:43:34
It probably shouldn't talk about "flag fetching" a
merkulova
2015/03/10 11:53:57
Done.
| |
425 | |
426 base::WeakPtrFactory<UserSessionManager> weak_factory_; | |
427 | |
415 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 428 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
416 }; | 429 }; |
417 | 430 |
418 } // namespace chromeos | 431 } // namespace chromeos |
419 | 432 |
420 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 433 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
OLD | NEW |