| 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 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
| 49 #include "chromeos/cert_loader.h" | 49 #include "chromeos/cert_loader.h" |
| 50 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
| 51 #include "chromeos/cryptohome/cryptohome_util.h" | 51 #include "chromeos/cryptohome/cryptohome_util.h" |
| 52 #include "chromeos/dbus/cryptohome_client.h" | 52 #include "chromeos/dbus/cryptohome_client.h" |
| 53 #include "chromeos/dbus/dbus_thread_manager.h" | 53 #include "chromeos/dbus/dbus_thread_manager.h" |
| 54 #include "chromeos/dbus/session_manager_client.h" | 54 #include "chromeos/dbus/session_manager_client.h" |
| 55 #include "chromeos/ime/input_method_manager.h" | 55 #include "chromeos/ime/input_method_manager.h" |
| 56 #include "chromeos/network/portal_detector/network_portal_detector.h" | 56 #include "chromeos/network/portal_detector/network_portal_detector.h" |
| 57 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" | 57 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" |
| 58 #include "components/session_manager/core/session_manager.h" |
| 58 #include "components/signin/core/browser/signin_manager_base.h" | 59 #include "components/signin/core/browser/signin_manager_base.h" |
| 59 #include "content/public/browser/notification_service.h" | 60 #include "content/public/browser/notification_service.h" |
| 60 | 61 |
| 61 namespace chromeos { | 62 namespace chromeos { |
| 62 | 63 |
| 63 namespace { | 64 namespace { |
| 64 | 65 |
| 65 void InitLocaleAndInputMethodsForNewUser(PrefService* prefs) { | 66 void InitLocaleAndInputMethodsForNewUser(PrefService* prefs) { |
| 66 // First, we'll set kLanguagePreloadEngines. | 67 // First, we'll set kLanguagePreloadEngines. |
| 67 std::string locale = g_browser_process->GetApplicationLocale(); | 68 std::string locale = g_browser_process->GetApplicationLocale(); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 420 |
| 420 LOG(WARNING) << "Exiting after new refresh token fetched"; | 421 LOG(WARNING) << "Exiting after new refresh token fetched"; |
| 421 | 422 |
| 422 // We need to restart cleanly in this case to make sure OAuth2 RT is actually | 423 // We need to restart cleanly in this case to make sure OAuth2 RT is actually |
| 423 // saved. | 424 // saved. |
| 424 chrome::AttemptRestart(); | 425 chrome::AttemptRestart(); |
| 425 } | 426 } |
| 426 | 427 |
| 427 void UserSessionManager::OnConnectionTypeChanged( | 428 void UserSessionManager::OnConnectionTypeChanged( |
| 428 net::NetworkChangeNotifier::ConnectionType type) { | 429 net::NetworkChangeNotifier::ConnectionType type) { |
| 430 bool is_running_test = |
| 431 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 432 ::switches::kTestName) || |
| 433 base::CommandLine::ForCurrentProcess()->HasSwitch(::switches::kTestType); |
| 429 UserManager* user_manager = UserManager::Get(); | 434 UserManager* user_manager = UserManager::Get(); |
| 430 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || | 435 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || |
| 431 !user_manager->IsUserLoggedIn() || | 436 !user_manager->IsUserLoggedIn() || |
| 432 !user_manager->IsLoggedInAsRegularUser() || | 437 !user_manager->IsLoggedInAsRegularUser() || |
| 433 user_manager->IsLoggedInAsStub()) { | 438 user_manager->IsLoggedInAsStub() || is_running_test) { |
| 434 return; | 439 return; |
| 435 } | 440 } |
| 436 | 441 |
| 437 // Need to iterate over all users and their OAuth2 session state. | 442 // Need to iterate over all users and their OAuth2 session state. |
| 438 const UserList& users = user_manager->GetLoggedInUsers(); | 443 const UserList& users = user_manager->GetLoggedInUsers(); |
| 439 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 444 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| 440 if (!(*it)->is_profile_created()) | 445 if (!(*it)->is_profile_created()) |
| 441 continue; | 446 continue; |
| 442 | 447 |
| 443 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(*it); | 448 Profile* user_profile = ProfileHelper::Get()->GetProfileByUser(*it); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 UserManager* user_manager = UserManager::Get(); | 624 UserManager* user_manager = UserManager::Get(); |
| 620 if (user_manager->IsLoggedInAsRegularUser()) { | 625 if (user_manager->IsLoggedInAsRegularUser()) { |
| 621 SAMLOfflineSigninLimiter* saml_offline_signin_limiter = | 626 SAMLOfflineSigninLimiter* saml_offline_signin_limiter = |
| 622 SAMLOfflineSigninLimiterFactory::GetForProfile(profile); | 627 SAMLOfflineSigninLimiterFactory::GetForProfile(profile); |
| 623 if (saml_offline_signin_limiter) | 628 if (saml_offline_signin_limiter) |
| 624 saml_offline_signin_limiter->SignedIn(user_context_.GetAuthFlow()); | 629 saml_offline_signin_limiter->SignedIn(user_context_.GetAuthFlow()); |
| 625 } | 630 } |
| 626 | 631 |
| 627 profile->OnLogin(); | 632 profile->OnLogin(); |
| 628 | 633 |
| 634 g_browser_process->platform_part()->session_manager()->SetSessionState( |
| 635 session_manager::SessionManager::SESSION_STATE_LOGGED_IN_NOT_ACTIVE); |
| 636 |
| 629 // Send the notification before creating the browser so additional objects | 637 // Send the notification before creating the browser so additional objects |
| 630 // that need the profile (e.g. the launcher) can be created first. | 638 // that need the profile (e.g. the launcher) can be created first. |
| 631 content::NotificationService::current()->Notify( | 639 content::NotificationService::current()->Notify( |
| 632 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 640 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 633 content::NotificationService::AllSources(), | 641 content::NotificationService::AllSources(), |
| 634 content::Details<Profile>(profile)); | 642 content::Details<Profile>(profile)); |
| 635 | 643 |
| 636 InitializeCertsForPrimaryUser(profile); | 644 InitializeCertsForPrimaryUser(profile); |
| 637 | 645 |
| 638 // Initialize RLZ only for primary user. | 646 // Initialize RLZ only for primary user. |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 primary_user && | 759 primary_user && |
| 752 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && | 760 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && |
| 753 CertLoader::IsInitialized() && | 761 CertLoader::IsInitialized() && |
| 754 base::SysInfo::IsRunningOnChromeOS()) { | 762 base::SysInfo::IsRunningOnChromeOS()) { |
| 755 GetNSSCertDatabaseForProfile(profile, | 763 GetNSSCertDatabaseForProfile(profile, |
| 756 base::Bind(&OnGetNSSCertDatabaseForUser)); | 764 base::Bind(&OnGetNSSCertDatabaseForUser)); |
| 757 } | 765 } |
| 758 } | 766 } |
| 759 | 767 |
| 760 } // namespace chromeos | 768 } // namespace chromeos |
| OLD | NEW |