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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 | 227 |
226 private: | 228 private: |
227 friend class test::UserSessionManagerTestApi; | 229 friend class test::UserSessionManagerTestApi; |
228 friend struct DefaultSingletonTraits<UserSessionManager>; | 230 friend struct DefaultSingletonTraits<UserSessionManager>; |
229 | 231 |
230 typedef std::set<std::string> SigninSessionRestoreStateSet; | 232 typedef std::set<std::string> SigninSessionRestoreStateSet; |
231 | 233 |
232 UserSessionManager(); | 234 UserSessionManager(); |
233 ~UserSessionManager() override; | 235 ~UserSessionManager() override; |
234 | 236 |
237 // Milliseconds until we timeout our attempt to fetch flags from Child Account | |
238 // Service. | |
239 static const int kFlagsFetchingLoginTimeoutMs; | |
Marc Treib
2015/03/04 16:31:48
I think there's no reason for this to be in the he
merkulova
2015/03/04 19:06:49
Done.
| |
240 | |
235 // OAuth2LoginManager::Observer overrides: | 241 // OAuth2LoginManager::Observer overrides: |
236 void OnSessionRestoreStateChanged( | 242 void OnSessionRestoreStateChanged( |
237 Profile* user_profile, | 243 Profile* user_profile, |
238 OAuth2LoginManager::SessionRestoreState state) override; | 244 OAuth2LoginManager::SessionRestoreState state) override; |
239 | 245 |
240 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: | 246 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides: |
241 void OnConnectionTypeChanged( | 247 void OnConnectionTypeChanged( |
242 net::NetworkChangeNotifier::ConnectionType type) override; | 248 net::NetworkChangeNotifier::ConnectionType type) override; |
243 | 249 |
244 // UserSessionManagerDelegate overrides: | 250 // UserSessionManagerDelegate overrides: |
245 // Used when restoring user sessions after crash. | 251 // Used when restoring user sessions after crash. |
246 void OnProfilePrepared(Profile* profile, bool browser_launched) override; | 252 void OnProfilePrepared(Profile* profile, bool browser_launched) override; |
247 | 253 |
254 // ChildAccountStatusObserver override: | |
255 void OnChildAccountStatusChanged() override; | |
256 | |
257 void OnStatusObservingCancelled(); | |
258 | |
259 void StopStatusObserving(); | |
260 | |
248 void CreateUserSession(const UserContext& user_context, | 261 void CreateUserSession(const UserContext& user_context, |
249 bool has_auth_cookies); | 262 bool has_auth_cookies); |
250 void PreStartSession(); | 263 void PreStartSession(); |
251 void StartCrosSession(); | 264 void StartCrosSession(); |
252 void NotifyUserLoggedIn(); | 265 void NotifyUserLoggedIn(); |
253 void PrepareProfile(); | 266 void PrepareProfile(); |
254 | 267 |
255 // Callback for asynchronous profile creation. | 268 // Callback for asynchronous profile creation. |
256 void OnProfileCreated(const UserContext& user_context, | 269 void OnProfileCreated(const UserContext& user_context, |
257 bool is_incognito_profile, | 270 bool is_incognito_profile, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
406 ProfileCompare> default_ime_states_; | 419 ProfileCompare> default_ime_states_; |
407 | 420 |
408 // Manages Easy unlock cryptohome keys. | 421 // Manages Easy unlock cryptohome keys. |
409 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; | 422 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
410 bool running_easy_unlock_key_ops_; | 423 bool running_easy_unlock_key_ops_; |
411 base::Closure easy_unlock_key_ops_finished_callback_; | 424 base::Closure easy_unlock_key_ops_finished_callback_; |
412 | 425 |
413 // Whether should launch browser, tests may override this value. | 426 // Whether should launch browser, tests may override this value. |
414 bool should_launch_browser_; | 427 bool should_launch_browser_; |
415 | 428 |
429 // Whether we have postponed request for InitializeStartUrls call. | |
430 bool requesting_start_urls_; | |
Marc Treib
2015/03/04 16:31:48
This name sounds like "we're currently requesting
merkulova
2015/03/04 19:06:49
Done.
| |
431 Profile* profile_fetching_flags_; | |
432 | |
433 base::WeakPtrFactory<UserSessionManager> weak_factory_; | |
434 | |
416 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 435 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
417 }; | 436 }; |
418 | 437 |
419 } // namespace chromeos | 438 } // namespace chromeos |
420 | 439 |
421 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 440 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
OLD | NEW |