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/chromeos/login/signin/token_handle_util.h" | |
19 #include "chromeos/dbus/session_manager_client.h" | 18 #include "chromeos/dbus/session_manager_client.h" |
20 #include "chromeos/login/auth/authenticator.h" | 19 #include "chromeos/login/auth/authenticator.h" |
21 #include "chromeos/login/auth/user_context.h" | 20 #include "chromeos/login/auth/user_context.h" |
22 #include "components/user_manager/user.h" | 21 #include "components/user_manager/user.h" |
23 #include "components/user_manager/user_manager.h" | 22 #include "components/user_manager/user_manager.h" |
24 #include "net/base/network_change_notifier.h" | 23 #include "net/base/network_change_notifier.h" |
25 #include "ui/base/ime/chromeos/input_method_manager.h" | 24 #include "ui/base/ime/chromeos/input_method_manager.h" |
26 | 25 |
27 class GURL; | 26 class GURL; |
28 class PrefRegistrySimple; | 27 class PrefRegistrySimple; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 211 |
213 // Returns true if there are pending Easy unlock key operations and | 212 // Returns true if there are pending Easy unlock key operations and |
214 // |callback| will be invoked when it is done. | 213 // |callback| will be invoked when it is done. |
215 bool CheckEasyUnlockKeyOps(const base::Closure& callback); | 214 bool CheckEasyUnlockKeyOps(const base::Closure& callback); |
216 | 215 |
217 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer); | 216 void AddSessionStateObserver(chromeos::UserSessionStateObserver* observer); |
218 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer); | 217 void RemoveSessionStateObserver(chromeos::UserSessionStateObserver* observer); |
219 | 218 |
220 void ActiveUserChanged(const user_manager::User* active_user) override; | 219 void ActiveUserChanged(const user_manager::User* active_user) override; |
221 | 220 |
222 // This method will be called when user have obtained oauth2 tokens. | |
223 void OnOAuth2TokensFetched(UserContext context); | |
224 | |
225 // Returns default IME state for user session. | 221 // Returns default IME state for user session. |
226 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( | 222 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( |
227 Profile* profile); | 223 Profile* profile); |
228 | 224 |
229 // Note this could return NULL if not enabled. | 225 // Note this could return NULL if not enabled. |
230 EasyUnlockKeyManager* GetEasyUnlockKeyManager(); | 226 EasyUnlockKeyManager* GetEasyUnlockKeyManager(); |
231 | 227 |
232 // Update Easy unlock cryptohome keys for given user context. | 228 // Update Easy unlock cryptohome keys for given user context. |
233 void UpdateEasyUnlockKeys(const UserContext& user_context); | 229 void UpdateEasyUnlockKeys(const UserContext& user_context); |
234 | 230 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // completed this method is called with |locale_pref_checked| set to true. | 353 // completed this method is called with |locale_pref_checked| set to true. |
358 void DoBrowserLaunchInternal(Profile* profile, | 354 void DoBrowserLaunchInternal(Profile* profile, |
359 LoginDisplayHost* login_host, | 355 LoginDisplayHost* login_host, |
360 bool locale_pref_checked); | 356 bool locale_pref_checked); |
361 | 357 |
362 static void RunCallbackOnLocaleLoaded( | 358 static void RunCallbackOnLocaleLoaded( |
363 const base::Closure& callback, | 359 const base::Closure& callback, |
364 InputEventsBlocker* input_events_blocker, | 360 InputEventsBlocker* input_events_blocker, |
365 const locale_util::LanguageSwitchResult& result); | 361 const locale_util::LanguageSwitchResult& result); |
366 | 362 |
367 // Callback invoked when |token_handle_util_| has finished. | |
368 void OnTokenHandleObtained(const user_manager::UserID& id, | |
369 TokenHandleUtil::TokenHandleStatus status); | |
370 | |
371 // Returns |true| if token handles should be used on this device. | |
372 bool TokenHandlesEnabled(); | |
373 | |
374 // Test API methods. | 363 // Test API methods. |
375 | 364 |
376 // Injects |user_context| that will be used to create StubAuthenticator | 365 // Injects |user_context| that will be used to create StubAuthenticator |
377 // instance when CreateAuthenticator() is called. | 366 // instance when CreateAuthenticator() is called. |
378 void InjectStubUserContext(const UserContext& user_context); | 367 void InjectStubUserContext(const UserContext& user_context); |
379 | 368 |
380 // Controls whether browser instance should be launched after sign in | 369 // Controls whether browser instance should be launched after sign in |
381 // (used in tests). | 370 // (used in tests). |
382 void set_should_launch_browser_in_tests(bool should_launch_browser) { | 371 void set_should_launch_browser_in_tests(bool should_launch_browser) { |
383 should_launch_browser_ = should_launch_browser; | 372 should_launch_browser_ = should_launch_browser; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 | 437 |
449 // Per-user-session Input Methods states. | 438 // Per-user-session Input Methods states. |
450 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>, | 439 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>, |
451 ProfileCompare> default_ime_states_; | 440 ProfileCompare> default_ime_states_; |
452 | 441 |
453 // Manages Easy unlock cryptohome keys. | 442 // Manages Easy unlock cryptohome keys. |
454 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; | 443 scoped_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
455 bool running_easy_unlock_key_ops_; | 444 bool running_easy_unlock_key_ops_; |
456 base::Closure easy_unlock_key_ops_finished_callback_; | 445 base::Closure easy_unlock_key_ops_finished_callback_; |
457 | 446 |
458 scoped_ptr<TokenHandleUtil> token_handle_util_; | |
459 | |
460 // Whether should launch browser, tests may override this value. | 447 // Whether should launch browser, tests may override this value. |
461 bool should_launch_browser_; | 448 bool should_launch_browser_; |
462 | 449 |
463 // Child account status is necessary for InitializeStartUrls call. | 450 // Child account status is necessary for InitializeStartUrls call. |
464 bool waiting_for_child_account_status_; | 451 bool waiting_for_child_account_status_; |
465 | 452 |
466 base::WeakPtrFactory<UserSessionManager> weak_factory_; | 453 base::WeakPtrFactory<UserSessionManager> weak_factory_; |
467 | 454 |
468 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 455 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
469 }; | 456 }; |
470 | 457 |
471 } // namespace chromeos | 458 } // namespace chromeos |
472 | 459 |
473 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 460 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
OLD | NEW |