| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 UserSessionManager* UserSessionManager::GetInstance() { | 133 UserSessionManager* UserSessionManager::GetInstance() { |
| 134 return Singleton<UserSessionManager, | 134 return Singleton<UserSessionManager, |
| 135 DefaultSingletonTraits<UserSessionManager> >::get(); | 135 DefaultSingletonTraits<UserSessionManager> >::get(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // static | 138 // static |
| 139 void UserSessionManager::OverrideHomedir() { | 139 void UserSessionManager::OverrideHomedir() { |
| 140 // Override user homedir, check for ProfileManager being initialized as | 140 // Override user homedir, check for ProfileManager being initialized as |
| 141 // it may not exist in unit tests. | 141 // it may not exist in unit tests. |
| 142 if (g_browser_process->profile_manager()) { | 142 if (g_browser_process->profile_manager()) { |
| 143 UserManager* user_manager = UserManager::Get(); | 143 UserManager* user_manager = GetUserManager(); |
| 144 if (user_manager->GetLoggedInUsers().size() == 1) { | 144 if (user_manager->GetLoggedInUsers().size() == 1) { |
| 145 base::FilePath homedir = ProfileHelper::GetProfilePathByUserIdHash( | 145 base::FilePath homedir = ProfileHelper::GetProfilePathByUserIdHash( |
| 146 user_manager->GetPrimaryUser()->username_hash()); | 146 user_manager->GetPrimaryUser()->username_hash()); |
| 147 // This path has been either created by cryptohome (on real Chrome OS | 147 // This path has been either created by cryptohome (on real Chrome OS |
| 148 // device) or by ProfileManager (on chromeos=1 desktop builds). | 148 // device) or by ProfileManager (on chromeos=1 desktop builds). |
| 149 PathService::OverrideAndCreateIfNeeded(base::DIR_HOME, | 149 PathService::OverrideAndCreateIfNeeded(base::DIR_HOME, |
| 150 homedir, | 150 homedir, |
| 151 true /* path is absolute */, | 151 true /* path is absolute */, |
| 152 false /* don't create */); | 152 false /* don't create */); |
| 153 } | 153 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 if (!has_active_session) | 189 if (!has_active_session) |
| 190 StartCrosSession(); | 190 StartCrosSession(); |
| 191 | 191 |
| 192 // TODO(nkostylev): Notify UserLoggedIn() after profile is actually | 192 // TODO(nkostylev): Notify UserLoggedIn() after profile is actually |
| 193 // ready to be used (http://crbug.com/361528). | 193 // ready to be used (http://crbug.com/361528). |
| 194 NotifyUserLoggedIn(); | 194 NotifyUserLoggedIn(); |
| 195 PrepareProfile(); | 195 PrepareProfile(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void UserSessionManager::PerformPostUserLoggedInActions() { | 198 void UserSessionManager::PerformPostUserLoggedInActions() { |
| 199 UserManager* user_manager = UserManager::Get(); | 199 UserManager* user_manager = GetUserManager(); |
| 200 if (user_manager->GetLoggedInUsers().size() == 1) { | 200 if (user_manager->GetLoggedInUsers().size() == 1) { |
| 201 // Owner must be first user in session. DeviceSettingsService can't deal | 201 // Owner must be first user in session. DeviceSettingsService can't deal |
| 202 // with multiple user and will mix up ownership, crbug.com/230018. | 202 // with multiple user and will mix up ownership, crbug.com/230018. |
| 203 OwnerSettingsServiceFactory::GetInstance()-> | 203 OwnerSettingsServiceFactory::GetInstance()-> |
| 204 SetUsername(user_manager->GetActiveUser()->email()); | 204 SetUsername(user_manager->GetActiveUser()->email()); |
| 205 | 205 |
| 206 if (NetworkPortalDetector::IsInitialized()) { | 206 if (NetworkPortalDetector::IsInitialized()) { |
| 207 NetworkPortalDetector::Get()->SetStrategy( | 207 NetworkPortalDetector::Get()->SetStrategy( |
| 208 PortalDetectorStrategy::STRATEGY_ID_SESSION); | 208 PortalDetectorStrategy::STRATEGY_ID_SESSION); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 void UserSessionManager::RestoreAuthenticationSession(Profile* user_profile) { | 213 void UserSessionManager::RestoreAuthenticationSession(Profile* user_profile) { |
| 214 UserManager* user_manager = UserManager::Get(); | 214 UserManager* user_manager = GetUserManager(); |
| 215 // We need to restore session only for logged in regular (GAIA) users. | 215 // We need to restore session only for logged in regular (GAIA) users. |
| 216 // Note: stub user is a special case that is used for tests, running | 216 // Note: stub user is a special case that is used for tests, running |
| 217 // linux_chromeos build on dev workstations w/o user_id parameters. | 217 // linux_chromeos build on dev workstations w/o user_id parameters. |
| 218 // Stub user is considered to be a regular GAIA user but it has special | 218 // Stub user is considered to be a regular GAIA user but it has special |
| 219 // user_id (kStubUser) and certain services like restoring OAuth session are | 219 // user_id (kStubUser) and certain services like restoring OAuth session are |
| 220 // explicitly disabled for it. | 220 // explicitly disabled for it. |
| 221 if (!user_manager->IsUserLoggedIn() || | 221 if (!user_manager->IsUserLoggedIn() || |
| 222 !user_manager->IsLoggedInAsRegularUser() || | 222 !user_manager->IsLoggedInAsRegularUser() || |
| 223 user_manager->IsLoggedInAsStub()) { | 223 user_manager->IsLoggedInAsStub()) { |
| 224 return; | 224 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 bool UserSessionManager::RespectLocalePreference( | 297 bool UserSessionManager::RespectLocalePreference( |
| 298 Profile* profile, | 298 Profile* profile, |
| 299 const User* user, | 299 const User* user, |
| 300 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { | 300 scoped_ptr<locale_util::SwitchLanguageCallback> callback) const { |
| 301 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in | 301 // TODO(alemate): http://crbug.com/288941 : Respect preferred language list in |
| 302 // the Google user profile. | 302 // the Google user profile. |
| 303 if (g_browser_process == NULL) | 303 if (g_browser_process == NULL) |
| 304 return false; | 304 return false; |
| 305 | 305 |
| 306 UserManager* user_manager = UserManager::Get(); | 306 UserManager* user_manager = GetUserManager(); |
| 307 if ((user == NULL) || (user != user_manager->GetPrimaryUser()) || | 307 if ((user == NULL) || (user != user_manager->GetPrimaryUser()) || |
| 308 (!user->is_profile_created())) | 308 (!user->is_profile_created())) |
| 309 return false; | 309 return false; |
| 310 | 310 |
| 311 // In case of multi-profiles session we don't apply profile locale | 311 // In case of multi-profiles session we don't apply profile locale |
| 312 // because it is unsafe. | 312 // because it is unsafe. |
| 313 if (user_manager->GetLoggedInUsers().size() != 1) | 313 if (user_manager->GetLoggedInUsers().size() != 1) |
| 314 return false; | 314 return false; |
| 315 | 315 |
| 316 const PrefService* prefs = profile->GetPrefs(); | 316 const PrefService* prefs = profile->GetPrefs(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 351 |
| 352 // Here we don't enable keyboard layouts for normal users. Input methods | 352 // Here we don't enable keyboard layouts for normal users. Input methods |
| 353 // are set up when the user first logs in. Then the user may customize the | 353 // are set up when the user first logs in. Then the user may customize the |
| 354 // input methods. Hence changing input methods here, just because the user's | 354 // input methods. Hence changing input methods here, just because the user's |
| 355 // UI language is different from the login screen UI language, is not | 355 // UI language is different from the login screen UI language, is not |
| 356 // desirable. Note that input method preferences are synced, so users can use | 356 // desirable. Note that input method preferences are synced, so users can use |
| 357 // their farovite input methods as soon as the preferences are synced. | 357 // their farovite input methods as soon as the preferences are synced. |
| 358 // | 358 // |
| 359 // For Guest mode, user locale preferences will never get initialized. | 359 // For Guest mode, user locale preferences will never get initialized. |
| 360 // So input methods should be enabled somewhere. | 360 // So input methods should be enabled somewhere. |
| 361 const bool enable_layouts = UserManager::Get()->IsLoggedInAsGuest(); | 361 const bool enable_layouts = GetUserManager()->IsLoggedInAsGuest(); |
| 362 locale_util::SwitchLanguage(pref_locale, | 362 locale_util::SwitchLanguage(pref_locale, |
| 363 enable_layouts, | 363 enable_layouts, |
| 364 false /* login_layouts_only */, | 364 false /* login_layouts_only */, |
| 365 callback.Pass()); | 365 callback.Pass()); |
| 366 | 366 |
| 367 return true; | 367 return true; |
| 368 } | 368 } |
| 369 | 369 |
| 370 void UserSessionManager::OnSessionRestoreStateChanged( | 370 void UserSessionManager::OnSessionRestoreStateChanged( |
| 371 Profile* user_profile, | 371 Profile* user_profile, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 388 case OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED: | 388 case OAuth2LoginManager::SESSION_RESTORE_NOT_STARTED: |
| 389 case OAuth2LoginManager::SESSION_RESTORE_PREPARING: | 389 case OAuth2LoginManager::SESSION_RESTORE_PREPARING: |
| 390 case OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: | 390 case OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS: |
| 391 return; | 391 return; |
| 392 } | 392 } |
| 393 | 393 |
| 394 // We should not be clearing existing token state if that was a connection | 394 // We should not be clearing existing token state if that was a connection |
| 395 // error. http://crbug.com/295245 | 395 // error. http://crbug.com/295245 |
| 396 if (!connection_error) { | 396 if (!connection_error) { |
| 397 // We are in one of "done" states here. | 397 // We are in one of "done" states here. |
| 398 UserManager::Get()->SaveUserOAuthStatus( | 398 GetUserManager()->SaveUserOAuthStatus( |
| 399 UserManager::Get()->GetLoggedInUser()->email(), | 399 GetUserManager()->GetLoggedInUser()->email(), user_status); |
| 400 user_status); | |
| 401 } | 400 } |
| 402 | 401 |
| 403 login_manager->RemoveObserver(this); | 402 login_manager->RemoveObserver(this); |
| 404 } | 403 } |
| 405 | 404 |
| 406 void UserSessionManager::OnNewRefreshTokenAvaiable(Profile* user_profile) { | 405 void UserSessionManager::OnNewRefreshTokenAvaiable(Profile* user_profile) { |
| 407 // Check if we were waiting to restart chrome. | 406 // Check if we were waiting to restart chrome. |
| 408 if (!exit_after_session_restore_) | 407 if (!exit_after_session_restore_) |
| 409 return; | 408 return; |
| 410 | 409 |
| 411 OAuth2LoginManager* login_manager = | 410 OAuth2LoginManager* login_manager = |
| 412 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); | 411 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile); |
| 413 login_manager->RemoveObserver(this); | 412 login_manager->RemoveObserver(this); |
| 414 | 413 |
| 415 // Mark user auth token status as valid. | 414 // Mark user auth token status as valid. |
| 416 UserManager::Get()->SaveUserOAuthStatus( | 415 GetUserManager()->SaveUserOAuthStatus( |
| 417 UserManager::Get()->GetLoggedInUser()->email(), | 416 GetUserManager()->GetLoggedInUser()->email(), |
| 418 User::OAUTH2_TOKEN_STATUS_VALID); | 417 User::OAUTH2_TOKEN_STATUS_VALID); |
| 419 | 418 |
| 420 LOG(WARNING) << "Exiting after new refresh token fetched"; | 419 LOG(WARNING) << "Exiting after new refresh token fetched"; |
| 421 | 420 |
| 422 // We need to restart cleanly in this case to make sure OAuth2 RT is actually | 421 // We need to restart cleanly in this case to make sure OAuth2 RT is actually |
| 423 // saved. | 422 // saved. |
| 424 chrome::AttemptRestart(); | 423 chrome::AttemptRestart(); |
| 425 } | 424 } |
| 426 | 425 |
| 427 void UserSessionManager::OnConnectionTypeChanged( | 426 void UserSessionManager::OnConnectionTypeChanged( |
| 428 net::NetworkChangeNotifier::ConnectionType type) { | 427 net::NetworkChangeNotifier::ConnectionType type) { |
| 429 UserManager* user_manager = UserManager::Get(); | 428 UserManager* user_manager = GetUserManager(); |
| 430 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || | 429 if (type == net::NetworkChangeNotifier::CONNECTION_NONE || |
| 431 !user_manager->IsUserLoggedIn() || | 430 !user_manager->IsUserLoggedIn() || |
| 432 !user_manager->IsLoggedInAsRegularUser() || | 431 !user_manager->IsLoggedInAsRegularUser() || |
| 433 user_manager->IsLoggedInAsStub()) { | 432 user_manager->IsLoggedInAsStub()) { |
| 434 return; | 433 return; |
| 435 } | 434 } |
| 436 | 435 |
| 437 // Need to iterate over all users and their OAuth2 session state. | 436 // Need to iterate over all users and their OAuth2 session state. |
| 438 const UserList& users = user_manager->GetLoggedInUsers(); | 437 const UserList& users = user_manager->GetLoggedInUsers(); |
| 439 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { | 438 for (UserList::const_iterator it = users.begin(); it != users.end(); ++it) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 BootTimesLoader* btl = BootTimesLoader::Get(); | 474 BootTimesLoader* btl = BootTimesLoader::Get(); |
| 476 btl->AddLoginTimeMarker("StartSession-Start", false); | 475 btl->AddLoginTimeMarker("StartSession-Start", false); |
| 477 DBusThreadManager::Get()->GetSessionManagerClient()-> | 476 DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 478 StartSession(user_context_.GetUserID()); | 477 StartSession(user_context_.GetUserID()); |
| 479 btl->AddLoginTimeMarker("StartSession-End", false); | 478 btl->AddLoginTimeMarker("StartSession-End", false); |
| 480 } | 479 } |
| 481 | 480 |
| 482 void UserSessionManager::NotifyUserLoggedIn() { | 481 void UserSessionManager::NotifyUserLoggedIn() { |
| 483 BootTimesLoader* btl = BootTimesLoader::Get(); | 482 BootTimesLoader* btl = BootTimesLoader::Get(); |
| 484 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 483 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
| 485 UserManager* user_manager = UserManager::Get(); | 484 UserManager* user_manager = GetUserManager(); |
| 486 user_manager->UserLoggedIn(user_context_.GetUserID(), | 485 user_manager->UserLoggedIn(user_context_.GetUserID(), |
| 487 user_context_.GetUserIDHash(), | 486 user_context_.GetUserIDHash(), |
| 488 false); | 487 false); |
| 489 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 488 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
| 490 } | 489 } |
| 491 | 490 |
| 492 void UserSessionManager::PrepareProfile() { | 491 void UserSessionManager::PrepareProfile() { |
| 493 bool is_demo_session = | 492 bool is_demo_session = |
| 494 DemoAppLauncher::IsDemoAppSession(user_context_.GetUserID()); | 493 DemoAppLauncher::IsDemoAppSession(user_context_.GetUserID()); |
| 495 | 494 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 case Profile::CREATE_STATUS_REMOTE_FAIL: | 526 case Profile::CREATE_STATUS_REMOTE_FAIL: |
| 528 case Profile::CREATE_STATUS_CANCELED: | 527 case Profile::CREATE_STATUS_CANCELED: |
| 529 case Profile::MAX_CREATE_STATUS: | 528 case Profile::MAX_CREATE_STATUS: |
| 530 NOTREACHED(); | 529 NOTREACHED(); |
| 531 break; | 530 break; |
| 532 } | 531 } |
| 533 } | 532 } |
| 534 | 533 |
| 535 void UserSessionManager::InitProfilePreferences(Profile* profile, | 534 void UserSessionManager::InitProfilePreferences(Profile* profile, |
| 536 const std::string& user_id) { | 535 const std::string& user_id) { |
| 537 if (UserManager::Get()->IsCurrentUserNew()) | 536 if (GetUserManager()->IsCurrentUserNew()) |
| 538 SetFirstLoginPrefs(profile->GetPrefs()); | 537 SetFirstLoginPrefs(profile->GetPrefs()); |
| 539 | 538 |
| 540 if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) { | 539 if (GetUserManager()->IsLoggedInAsLocallyManagedUser()) { |
| 541 User* active_user = UserManager::Get()->GetActiveUser(); | 540 User* active_user = GetUserManager()->GetActiveUser(); |
| 542 std::string managed_user_sync_id = | 541 std::string managed_user_sync_id = |
| 543 UserManager::Get()->GetSupervisedUserManager()-> | 542 GetUserManager()->GetSupervisedUserManager()->GetUserSyncId( |
| 544 GetUserSyncId(active_user->email()); | 543 active_user->email()); |
| 545 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, | 544 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
| 546 managed_user_sync_id); | 545 managed_user_sync_id); |
| 547 } else if (UserManager::Get()->IsLoggedInAsRegularUser()) { | 546 } else if (GetUserManager()->IsLoggedInAsRegularUser()) { |
| 548 // Make sure that the google service username is properly set (we do this | 547 // Make sure that the google service username is properly set (we do this |
| 549 // on every sign in, not just the first login, to deal with existing | 548 // on every sign in, not just the first login, to deal with existing |
| 550 // profiles that might not have it set yet). | 549 // profiles that might not have it set yet). |
| 551 SigninManagerBase* signin_manager = | 550 SigninManagerBase* signin_manager = |
| 552 SigninManagerFactory::GetForProfile(profile); | 551 SigninManagerFactory::GetForProfile(profile); |
| 553 signin_manager->SetAuthenticatedUsername(user_id); | 552 signin_manager->SetAuthenticatedUsername(user_id); |
| 554 } | 553 } |
| 555 } | 554 } |
| 556 | 555 |
| 557 void UserSessionManager::UserProfileInitialized(Profile* profile, | 556 void UserSessionManager::UserProfileInitialized(Profile* profile, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 btl->AddLoginTimeMarker("TPMOwn-Start", false); | 608 btl->AddLoginTimeMarker("TPMOwn-Start", false); |
| 610 if (cryptohome_util::TpmIsEnabled() && !cryptohome_util::TpmIsBeingOwned()) { | 609 if (cryptohome_util::TpmIsEnabled() && !cryptohome_util::TpmIsBeingOwned()) { |
| 611 if (cryptohome_util::TpmIsOwned()) { | 610 if (cryptohome_util::TpmIsOwned()) { |
| 612 client->CallTpmClearStoredPasswordAndBlock(); | 611 client->CallTpmClearStoredPasswordAndBlock(); |
| 613 } else { | 612 } else { |
| 614 client->TpmCanAttemptOwnership(EmptyVoidDBusMethodCallback()); | 613 client->TpmCanAttemptOwnership(EmptyVoidDBusMethodCallback()); |
| 615 } | 614 } |
| 616 } | 615 } |
| 617 btl->AddLoginTimeMarker("TPMOwn-End", false); | 616 btl->AddLoginTimeMarker("TPMOwn-End", false); |
| 618 | 617 |
| 619 UserManager* user_manager = UserManager::Get(); | 618 UserManager* user_manager = GetUserManager(); |
| 620 if (user_manager->IsLoggedInAsRegularUser()) { | 619 if (user_manager->IsLoggedInAsRegularUser()) { |
| 621 SAMLOfflineSigninLimiter* saml_offline_signin_limiter = | 620 SAMLOfflineSigninLimiter* saml_offline_signin_limiter = |
| 622 SAMLOfflineSigninLimiterFactory::GetForProfile(profile); | 621 SAMLOfflineSigninLimiterFactory::GetForProfile(profile); |
| 623 if (saml_offline_signin_limiter) | 622 if (saml_offline_signin_limiter) |
| 624 saml_offline_signin_limiter->SignedIn(user_context_.GetAuthFlow()); | 623 saml_offline_signin_limiter->SignedIn(user_context_.GetAuthFlow()); |
| 625 } | 624 } |
| 626 | 625 |
| 627 profile->OnLogin(); | 626 profile->OnLogin(); |
| 628 | 627 |
| 629 // Send the notification before creating the browser so additional objects | 628 // Send the notification before creating the browser so additional objects |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 // When switching to RLZ enabled/disabled state, clear all recorded events. | 727 // When switching to RLZ enabled/disabled state, clear all recorded events. |
| 729 RLZTracker::ClearRlzState(); | 728 RLZTracker::ClearRlzState(); |
| 730 local_state->SetBoolean(prefs::kRLZDisabled, disabled); | 729 local_state->SetBoolean(prefs::kRLZDisabled, disabled); |
| 731 } | 730 } |
| 732 // Init the RLZ library. | 731 // Init the RLZ library. |
| 733 int ping_delay = profile->GetPrefs()->GetInteger( | 732 int ping_delay = profile->GetPrefs()->GetInteger( |
| 734 first_run::GetPingDelayPrefName().c_str()); | 733 first_run::GetPingDelayPrefName().c_str()); |
| 735 // Negative ping delay means to send ping immediately after a first search is | 734 // Negative ping delay means to send ping immediately after a first search is |
| 736 // recorded. | 735 // recorded. |
| 737 RLZTracker::InitRlzFromProfileDelayed( | 736 RLZTracker::InitRlzFromProfileDelayed( |
| 738 profile, UserManager::Get()->IsCurrentUserNew(), | 737 profile, |
| 739 ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay))); | 738 GetUserManager()->IsCurrentUserNew(), |
| 739 ping_delay < 0, |
| 740 base::TimeDelta::FromMilliseconds(abs(ping_delay))); |
| 740 if (delegate_) | 741 if (delegate_) |
| 741 delegate_->OnRlzInitialized(); | 742 delegate_->OnRlzInitialized(); |
| 742 #endif | 743 #endif |
| 743 } | 744 } |
| 744 | 745 |
| 745 void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) { | 746 void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) { |
| 746 // Now that the user profile has been initialized | 747 // Now that the user profile has been initialized |
| 747 // |GetNSSCertDatabaseForProfile| is safe to be used. | 748 // |GetNSSCertDatabaseForProfile| is safe to be used. |
| 748 UserManager* user_manager = UserManager::Get(); | 749 UserManager* user_manager = GetUserManager(); |
| 749 const User* primary_user = user_manager->GetPrimaryUser(); | 750 const User* primary_user = user_manager->GetPrimaryUser(); |
| 750 if (user_manager->IsUserLoggedIn() && | 751 if (user_manager->IsUserLoggedIn() && |
| 751 primary_user && | 752 primary_user && |
| 752 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && | 753 profile == ProfileHelper::Get()->GetProfileByUser(primary_user) && |
| 753 CertLoader::IsInitialized() && | 754 CertLoader::IsInitialized() && |
| 754 base::SysInfo::IsRunningOnChromeOS()) { | 755 base::SysInfo::IsRunningOnChromeOS()) { |
| 755 GetNSSCertDatabaseForProfile(profile, | 756 GetNSSCertDatabaseForProfile(profile, |
| 756 base::Bind(&OnGetNSSCertDatabaseForUser)); | 757 base::Bind(&OnGetNSSCertDatabaseForUser)); |
| 757 } | 758 } |
| 758 } | 759 } |
| 759 | 760 |
| 760 } // namespace chromeos | 761 } // namespace chromeos |
| OLD | NEW |