| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.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/eol_notification.h" |
| 17 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" | 18 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h" |
| 18 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" | 19 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" |
| 19 #include "chromeos/dbus/session_manager_client.h" | 20 #include "chromeos/dbus/session_manager_client.h" |
| 20 #include "chromeos/login/auth/authenticator.h" | 21 #include "chromeos/login/auth/authenticator.h" |
| 21 #include "chromeos/login/auth/user_context.h" | 22 #include "chromeos/login/auth/user_context.h" |
| 22 #include "components/user_manager/user.h" | 23 #include "components/user_manager/user.h" |
| 23 #include "components/user_manager/user_manager.h" | 24 #include "components/user_manager/user_manager.h" |
| 24 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
| 25 #include "ui/base/ime/chromeos/input_method_manager.h" | 26 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 26 | 27 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 223 |
| 223 void ActiveUserChanged(const user_manager::User* active_user) override; | 224 void ActiveUserChanged(const user_manager::User* active_user) override; |
| 224 | 225 |
| 225 // This method will be called when user have obtained oauth2 tokens. | 226 // This method will be called when user have obtained oauth2 tokens. |
| 226 void OnOAuth2TokensFetched(UserContext context); | 227 void OnOAuth2TokensFetched(UserContext context); |
| 227 | 228 |
| 228 // Returns default IME state for user session. | 229 // Returns default IME state for user session. |
| 229 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( | 230 scoped_refptr<input_method::InputMethodManager::State> GetDefaultIMEState( |
| 230 Profile* profile); | 231 Profile* profile); |
| 231 | 232 |
| 233 // Check given profile's EndofLife Status and show notification accordingly. |
| 234 void CheckEolStatus(Profile* profile); |
| 235 |
| 232 // Note this could return NULL if not enabled. | 236 // Note this could return NULL if not enabled. |
| 233 EasyUnlockKeyManager* GetEasyUnlockKeyManager(); | 237 EasyUnlockKeyManager* GetEasyUnlockKeyManager(); |
| 234 | 238 |
| 235 // Update Easy unlock cryptohome keys for given user context. | 239 // Update Easy unlock cryptohome keys for given user context. |
| 236 void UpdateEasyUnlockKeys(const UserContext& user_context); | 240 void UpdateEasyUnlockKeys(const UserContext& user_context); |
| 237 | 241 |
| 238 // Returns the auth request context associated with auth data. | 242 // Returns the auth request context associated with auth data. |
| 239 net::URLRequestContextGetter* GetAuthRequestContext() const; | 243 net::URLRequestContextGetter* GetAuthRequestContext() const; |
| 240 | 244 |
| 241 // Removes a profile from the per-user input methods states map. | 245 // Removes a profile from the per-user input methods states map. |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 const locale_util::LanguageSwitchResult& result); | 374 const locale_util::LanguageSwitchResult& result); |
| 371 | 375 |
| 372 // Callback invoked when |token_handle_util_| has finished. | 376 // Callback invoked when |token_handle_util_| has finished. |
| 373 void OnTokenHandleObtained(const AccountId& account_id, bool success); | 377 void OnTokenHandleObtained(const AccountId& account_id, bool success); |
| 374 | 378 |
| 375 // Returns |true| if token handles should be used on this device. | 379 // Returns |true| if token handles should be used on this device. |
| 376 bool TokenHandlesEnabled(); | 380 bool TokenHandlesEnabled(); |
| 377 | 381 |
| 378 void CreateTokenUtilIfMissing(); | 382 void CreateTokenUtilIfMissing(); |
| 379 | 383 |
| 384 // Returns |true| if given profile show see EndofLife Notification when |
| 385 // applicable. |
| 386 bool ShouldShowEolNotification(Profile* profile); |
| 387 |
| 380 // Test API methods. | 388 // Test API methods. |
| 381 | 389 |
| 382 // Injects |user_context| that will be used to create StubAuthenticator | 390 // Injects |user_context| that will be used to create StubAuthenticator |
| 383 // instance when CreateAuthenticator() is called. | 391 // instance when CreateAuthenticator() is called. |
| 384 void InjectStubUserContext(const UserContext& user_context); | 392 void InjectStubUserContext(const UserContext& user_context); |
| 385 | 393 |
| 386 // Controls whether browser instance should be launched after sign in | 394 // Controls whether browser instance should be launched after sign in |
| 387 // (used in tests). | 395 // (used in tests). |
| 388 void set_should_launch_browser_in_tests(bool should_launch_browser) { | 396 void set_should_launch_browser_in_tests(bool should_launch_browser) { |
| 389 should_launch_browser_ = should_launch_browser; | 397 should_launch_browser_ = should_launch_browser; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 | 463 |
| 456 // Kiosk mode related members. | 464 // Kiosk mode related members. |
| 457 // Chrome oauth client id and secret - override values for kiosk mode. | 465 // Chrome oauth client id and secret - override values for kiosk mode. |
| 458 std::string chrome_client_id_; | 466 std::string chrome_client_id_; |
| 459 std::string chrome_client_secret_; | 467 std::string chrome_client_secret_; |
| 460 | 468 |
| 461 // Per-user-session Input Methods states. | 469 // Per-user-session Input Methods states. |
| 462 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>, | 470 std::map<Profile*, scoped_refptr<input_method::InputMethodManager::State>, |
| 463 ProfileCompare> default_ime_states_; | 471 ProfileCompare> default_ime_states_; |
| 464 | 472 |
| 473 // Per-user-session EndofLife Notification |
| 474 std::map<Profile*, std::unique_ptr<EolNotification>, ProfileCompare> |
| 475 eol_notification_handler_; |
| 476 |
| 465 // Manages Easy unlock cryptohome keys. | 477 // Manages Easy unlock cryptohome keys. |
| 466 std::unique_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; | 478 std::unique_ptr<EasyUnlockKeyManager> easy_unlock_key_manager_; |
| 467 bool running_easy_unlock_key_ops_; | 479 bool running_easy_unlock_key_ops_; |
| 468 base::Closure easy_unlock_key_ops_finished_callback_; | 480 base::Closure easy_unlock_key_ops_finished_callback_; |
| 469 | 481 |
| 470 // Whether should fetch token handles, tests may override this value. | 482 // Whether should fetch token handles, tests may override this value. |
| 471 bool should_obtain_handles_; | 483 bool should_obtain_handles_; |
| 472 | 484 |
| 473 std::unique_ptr<TokenHandleUtil> token_handle_util_; | 485 std::unique_ptr<TokenHandleUtil> token_handle_util_; |
| 474 std::unique_ptr<TokenHandleFetcher> token_handle_fetcher_; | 486 std::unique_ptr<TokenHandleFetcher> token_handle_fetcher_; |
| 475 | 487 |
| 476 // Whether should launch browser, tests may override this value. | 488 // Whether should launch browser, tests may override this value. |
| 477 bool should_launch_browser_; | 489 bool should_launch_browser_; |
| 478 | 490 |
| 479 // Child account status is necessary for InitializeStartUrls call. | 491 // Child account status is necessary for InitializeStartUrls call. |
| 480 bool waiting_for_child_account_status_; | 492 bool waiting_for_child_account_status_; |
| 481 | 493 |
| 482 base::WeakPtrFactory<UserSessionManager> weak_factory_; | 494 base::WeakPtrFactory<UserSessionManager> weak_factory_; |
| 483 | 495 |
| 484 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); | 496 DISALLOW_COPY_AND_ASSIGN(UserSessionManager); |
| 485 }; | 497 }; |
| 486 | 498 |
| 487 } // namespace chromeos | 499 } // namespace chromeos |
| 488 | 500 |
| 489 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ | 501 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SESSION_USER_SESSION_MANAGER_H_ |
| OLD | NEW |