Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1035)

Unified Diff: chrome/browser/chromeos/login/session/user_session_manager.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/session/user_session_manager.cc
diff --git a/chrome/browser/chromeos/login/session/user_session_manager.cc b/chrome/browser/chromeos/login/session/user_session_manager.cc
index 87facdebe158be5744c386e0b306287a3e1bb543..4435d1c02fa05832114b97d2c8199ba72a14f49b 100644
--- a/chrome/browser/chromeos/login/session/user_session_manager.cc
+++ b/chrome/browser/chromeos/login/session/user_session_manager.cc
@@ -140,7 +140,7 @@ void UserSessionManager::OverrideHomedir() {
// Override user homedir, check for ProfileManager being initialized as
// it may not exist in unit tests.
if (g_browser_process->profile_manager()) {
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if (user_manager->GetLoggedInUsers().size() == 1) {
base::FilePath homedir = ProfileHelper::GetProfilePathByUserIdHash(
user_manager->GetPrimaryUser()->username_hash());
@@ -196,7 +196,7 @@ void UserSessionManager::StartSession(const UserContext& user_context,
}
void UserSessionManager::PerformPostUserLoggedInActions() {
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if (user_manager->GetLoggedInUsers().size() == 1) {
// Owner must be first user in session. DeviceSettingsService can't deal
// with multiple user and will mix up ownership, crbug.com/230018.
@@ -211,7 +211,7 @@ void UserSessionManager::PerformPostUserLoggedInActions() {
}
void UserSessionManager::RestoreAuthenticationSession(Profile* user_profile) {
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
// We need to restore session only for logged in regular (GAIA) users.
// Note: stub user is a special case that is used for tests, running
// linux_chromeos build on dev workstations w/o user_id parameters.
@@ -303,7 +303,7 @@ bool UserSessionManager::RespectLocalePreference(
if (g_browser_process == NULL)
return false;
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if ((user == NULL) || (user != user_manager->GetPrimaryUser()) ||
(!user->is_profile_created()))
return false;
@@ -358,7 +358,7 @@ bool UserSessionManager::RespectLocalePreference(
//
// For Guest mode, user locale preferences will never get initialized.
// So input methods should be enabled somewhere.
- const bool enable_layouts = UserManager::Get()->IsLoggedInAsGuest();
+ const bool enable_layouts = GetUserManager()->IsLoggedInAsGuest();
locale_util::SwitchLanguage(pref_locale,
enable_layouts,
false /* login_layouts_only */,
@@ -395,9 +395,8 @@ void UserSessionManager::OnSessionRestoreStateChanged(
// error. http://crbug.com/295245
if (!connection_error) {
// We are in one of "done" states here.
- UserManager::Get()->SaveUserOAuthStatus(
- UserManager::Get()->GetLoggedInUser()->email(),
- user_status);
+ GetUserManager()->SaveUserOAuthStatus(
+ GetUserManager()->GetLoggedInUser()->email(), user_status);
}
login_manager->RemoveObserver(this);
@@ -413,8 +412,8 @@ void UserSessionManager::OnNewRefreshTokenAvaiable(Profile* user_profile) {
login_manager->RemoveObserver(this);
// Mark user auth token status as valid.
- UserManager::Get()->SaveUserOAuthStatus(
- UserManager::Get()->GetLoggedInUser()->email(),
+ GetUserManager()->SaveUserOAuthStatus(
+ GetUserManager()->GetLoggedInUser()->email(),
User::OAUTH2_TOKEN_STATUS_VALID);
LOG(WARNING) << "Exiting after new refresh token fetched";
@@ -426,7 +425,7 @@ void UserSessionManager::OnNewRefreshTokenAvaiable(Profile* user_profile) {
void UserSessionManager::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if (type == net::NetworkChangeNotifier::CONNECTION_NONE ||
!user_manager->IsUserLoggedIn() ||
!user_manager->IsLoggedInAsRegularUser() ||
@@ -482,7 +481,7 @@ void UserSessionManager::StartCrosSession() {
void UserSessionManager::NotifyUserLoggedIn() {
BootTimesLoader* btl = BootTimesLoader::Get();
btl->AddLoginTimeMarker("UserLoggedIn-Start", false);
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
user_manager->UserLoggedIn(user_context_.GetUserID(),
user_context_.GetUserIDHash(),
false);
@@ -534,17 +533,17 @@ void UserSessionManager::OnProfileCreated(const std::string& user_id,
void UserSessionManager::InitProfilePreferences(Profile* profile,
const std::string& user_id) {
- if (UserManager::Get()->IsCurrentUserNew())
+ if (GetUserManager()->IsCurrentUserNew())
SetFirstLoginPrefs(profile->GetPrefs());
- if (UserManager::Get()->IsLoggedInAsLocallyManagedUser()) {
- User* active_user = UserManager::Get()->GetActiveUser();
+ if (GetUserManager()->IsLoggedInAsLocallyManagedUser()) {
+ User* active_user = GetUserManager()->GetActiveUser();
std::string managed_user_sync_id =
- UserManager::Get()->GetSupervisedUserManager()->
- GetUserSyncId(active_user->email());
+ GetUserManager()->GetSupervisedUserManager()->GetUserSyncId(
+ active_user->email());
profile->GetPrefs()->SetString(prefs::kSupervisedUserId,
managed_user_sync_id);
- } else if (UserManager::Get()->IsLoggedInAsRegularUser()) {
+ } else if (GetUserManager()->IsLoggedInAsRegularUser()) {
// Make sure that the google service username is properly set (we do this
// on every sign in, not just the first login, to deal with existing
// profiles that might not have it set yet).
@@ -616,7 +615,7 @@ void UserSessionManager::FinalizePrepareProfile(Profile* profile) {
}
btl->AddLoginTimeMarker("TPMOwn-End", false);
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if (user_manager->IsLoggedInAsRegularUser()) {
SAMLOfflineSigninLimiter* saml_offline_signin_limiter =
SAMLOfflineSigninLimiterFactory::GetForProfile(profile);
@@ -735,8 +734,10 @@ void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
// Negative ping delay means to send ping immediately after a first search is
// recorded.
RLZTracker::InitRlzFromProfileDelayed(
- profile, UserManager::Get()->IsCurrentUserNew(),
- ping_delay < 0, base::TimeDelta::FromMilliseconds(abs(ping_delay)));
+ profile,
+ GetUserManager()->IsCurrentUserNew(),
+ ping_delay < 0,
+ base::TimeDelta::FromMilliseconds(abs(ping_delay)));
if (delegate_)
delegate_->OnRlzInitialized();
#endif
@@ -745,7 +746,7 @@ void UserSessionManager::InitRlzImpl(Profile* profile, bool disabled) {
void UserSessionManager::InitializeCertsForPrimaryUser(Profile* profile) {
// Now that the user profile has been initialized
// |GetNSSCertDatabaseForProfile| is safe to be used.
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
const User* primary_user = user_manager->GetPrimaryUser();
if (user_manager->IsUserLoggedIn() &&
primary_user &&

Powered by Google App Engine
This is Rietveld 408576698