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

Unified Diff: chrome/browser/chromeos/login/existing_user_controller.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/existing_user_controller.cc
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 5dc0b19fb4096dfd6b2c479aff0c462be996a0d5..82dd566a5639f5104d3c839b922a37fe66596897 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -199,7 +199,7 @@ void ExistingUserController::UpdateLoginDisplay(const UserList& users) {
// TODO(xiyuan): Clean user profile whose email is not in whitelist.
bool meets_locally_managed_requirements =
(*it)->GetType() != user_manager::USER_TYPE_LOCALLY_MANAGED ||
- UserManager::Get()->AreLocallyManagedUsersAllowed();
+ GetUserManager()->AreLocallyManagedUsersAllowed();
bool meets_whitelist_requirements =
LoginUtils::IsWhitelisted((*it)->email(), NULL) ||
(*it)->GetType() != user_manager::USER_TYPE_REGULAR;
@@ -431,8 +431,7 @@ void ExistingUserController::Login(const UserContext& user_context,
void ExistingUserController::PerformLogin(
const UserContext& user_context,
LoginPerformer::AuthorizationMode auth_mode) {
- UserManager::Get()->GetUserFlow(last_login_attempt_username_)->
- set_host(host_);
+ GetUserManager()->GetUserFlow(last_login_attempt_username_)->set_host(host_);
BootTimesLoader::Get()->RecordLoginAttempted();
@@ -480,7 +479,7 @@ void ExistingUserController::LoginAsRetailModeUser() {
}
void ExistingUserController::LoginAsGuest() {
- if (is_login_in_progress_ || UserManager::Get()->IsUserLoggedIn())
+ if (is_login_in_progress_ || GetUserManager()->IsUserLoggedIn())
return;
// Stop the auto-login timer when attempting login.
@@ -540,7 +539,7 @@ void ExistingUserController::MigrateUserData(const std::string& old_password) {
void ExistingUserController::LoginAsPublicAccount(
const std::string& username) {
- if (is_login_in_progress_ || UserManager::Get()->IsUserLoggedIn())
+ if (is_login_in_progress_ || GetUserManager()->IsUserLoggedIn())
return;
// Stop the auto-login timer when attempting login.
@@ -571,7 +570,7 @@ void ExistingUserController::LoginAsPublicAccount(
// If there is no public account with the given |username|, logging in is not
// possible.
- const User* user = UserManager::Get()->FindUser(username);
+ const User* user = GetUserManager()->FindUser(username);
if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) {
// Re-enable clicking on other windows.
login_display_->SetUIEnabled(true);
@@ -712,8 +711,9 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
guest_mode_url_ = GURL::EmptyGURL();
std::string error = failure.GetErrorString();
- if (UserManager::Get()->GetUserFlow(last_login_attempt_username_)->
- HandleLoginFailure(failure)) {
+ if (GetUserManager()
+ ->GetUserFlow(last_login_attempt_username_)
+ ->HandleLoginFailure(failure)) {
login_display_->SetUIEnabled(true);
return;
}
@@ -734,7 +734,7 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
// Check networking after trying to login in case user is
// cached locally or the local admin account.
bool is_known_user =
- UserManager::Get()->IsKnownUser(last_login_attempt_username_);
+ GetUserManager()->IsKnownUser(last_login_attempt_username_);
if (!network_state_helper_->IsConnected()) {
if (is_known_user)
ShowError(IDS_LOGIN_ERROR_AUTHENTICATING, error);
@@ -761,7 +761,7 @@ void ExistingUserController::OnLoginFailure(const LoginFailure& failure) {
// Reset user flow to default, so that special flow will not affect next
// attempt.
- UserManager::Get()->ResetUserFlow(last_login_attempt_username_);
+ GetUserManager()->ResetUserFlow(last_login_attempt_username_);
if (login_status_consumer_)
login_status_consumer_->OnLoginFailure(failure);
@@ -780,8 +780,8 @@ void ExistingUserController::OnLoginSuccess(const UserContext& user_context) {
password_changed_ = login_performer_->password_changed();
auth_mode_ = login_performer_->auth_mode();
- UserManager::Get()->GetUserFlow(user_context.GetUserID())->
- HandleLoginSuccess(user_context);
+ GetUserManager()->GetUserFlow(user_context.GetUserID())->HandleLoginSuccess(
+ user_context);
StopPublicSessionAutoLoginTimer();
@@ -799,8 +799,8 @@ void ExistingUserController::OnLoginSuccess(const UserContext& user_context) {
// Update user's displayed email.
if (!display_email_.empty()) {
- UserManager::Get()->SaveUserDisplayEmail(user_context.GetUserID(),
- display_email_);
+ GetUserManager()->SaveUserDisplayEmail(user_context.GetUserID(),
+ display_email_);
display_email_.clear();
}
@@ -815,7 +815,7 @@ void ExistingUserController::OnProfilePrepared(Profile* profile) {
// Reenable clicking on other windows and status area.
login_display_->SetUIEnabled(true);
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
if (user_manager->IsCurrentUserNew() &&
user_manager->IsLoggedInAsLocallyManagedUser()) {
// Supervised users should launch into empty desktop on first run.
@@ -878,8 +878,9 @@ void ExistingUserController::OnPasswordChangeDetected() {
return;
}
- if (UserManager::Get()->GetUserFlow(last_login_attempt_username_)->
- HandlePasswordChangeDetected()) {
+ if (GetUserManager()
+ ->GetUserFlow(last_login_attempt_username_)
+ ->HandlePasswordChangeDetected()) {
return;
}
@@ -950,7 +951,7 @@ void ExistingUserController::OnOnlineChecked(const std::string& username,
void ExistingUserController::DeviceSettingsChanged() {
if (host_ != NULL) {
// Signed settings or user list changed. Notify views and update them.
- UpdateLoginDisplay(chromeos::UserManager::Get()->GetUsers());
+ UpdateLoginDisplay(chromeos::GetUserManager()->GetUsers());
ConfigurePublicSessionAutoLogin();
return;
}
@@ -993,7 +994,7 @@ void ExistingUserController::ConfigurePublicSessionAutoLogin() {
}
const User* user =
- UserManager::Get()->FindUser(public_session_auto_login_username_);
+ GetUserManager()->FindUser(public_session_auto_login_username_);
if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
public_session_auto_login_username_.clear();
@@ -1057,7 +1058,7 @@ void ExistingUserController::InitializeStartUrls() const {
std::vector<std::string> start_urls;
const base::ListValue *urls;
- UserManager* user_manager = UserManager::Get();
+ UserManager* user_manager = GetUserManager();
bool can_show_getstarted_guide =
user_manager->GetActiveUser()->GetType() ==
user_manager::USER_TYPE_REGULAR &&
@@ -1132,7 +1133,7 @@ void ExistingUserController::ShowError(int error_id,
if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING) {
if (num_login_attempts_ > 1) {
const User* user =
- UserManager::Get()->FindUser(last_login_attempt_username_);
+ GetUserManager()->FindUser(last_login_attempt_username_);
if (user && (user->GetType() == user_manager::USER_TYPE_LOCALLY_MANAGED))
error_id = IDS_LOGIN_ERROR_AUTHENTICATING_2ND_TIME_SUPERVISED;
}
@@ -1145,9 +1146,8 @@ void ExistingUserController::ShowGaiaPasswordChanged(
const std::string& username) {
// Invalidate OAuth token, since it can't be correct after password is
// changed.
- UserManager::Get()->SaveUserOAuthStatus(
- username,
- User::OAUTH2_TOKEN_STATUS_INVALID);
+ GetUserManager()->SaveUserOAuthStatus(username,
+ User::OAUTH2_TOKEN_STATUS_INVALID);
login_display_->SetUIEnabled(true);
login_display_->ShowGaiaPasswordChanged(username);

Powered by Google App Engine
This is Rietveld 408576698