Index: chrome/browser/chromeos/login/screens/user_selection_screen.cc |
diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.cc b/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
index 645f1002a007cac370811e24c277328bdb80194e..37bb77bf9cd5c5e1fd7236b4b4e9b7a4c8c43178 100644 |
--- a/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
+++ b/chrome/browser/chromeos/login/screens/user_selection_screen.cc |
@@ -148,7 +148,7 @@ |
user->GetType() == user_manager::USER_TYPE_SUPERVISED; |
const bool is_child_user = user->GetType() == user_manager::USER_TYPE_CHILD; |
- user_dict->SetString(kKeyUsername, user->GetAccountId().Serialize()); |
+ user_dict->SetString(kKeyUsername, user->GetAccountId().GetUserEmail()); |
user_dict->SetString(kKeyEmailAddress, user->display_email()); |
user_dict->SetString(kKeyDisplayName, user->GetDisplayName()); |
user_dict->SetBoolean(kKeyPublicAccount, is_public_session); |
@@ -246,26 +246,6 @@ |
(token_status == user_manager::User::OAUTH_TOKEN_STATUS_UNKNOWN); |
} |
-// static |
-AccountId UserSelectionScreen::GetAccountIdOfKnownUser( |
- const std::string& user_id) { |
- if (user_id.empty()) |
- return EmptyAccountId(); |
- |
- const AccountId initial_account_id = AccountId::FromUserEmail(user_id); |
- |
- user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
- if (!user_manager) |
- return initial_account_id; |
- |
- AccountId known_account_id(EmptyAccountId()); |
- if (user_manager->GetKnownUserAccountId(initial_account_id, |
- &known_account_id)) |
- return known_account_id; |
- |
- return initial_account_id; |
-} |
- |
void UserSelectionScreen::SetHandler(LoginDisplayWebUIHandler* handler) { |
handler_ = handler; |
} |
@@ -326,17 +306,18 @@ |
// static |
const user_manager::UserList UserSelectionScreen::PrepareUserListForSending( |
const user_manager::UserList& users, |
- const AccountId& owner, |
+ std::string owner, |
bool is_signin_to_add) { |
user_manager::UserList users_to_send; |
- bool has_owner = owner.is_valid(); |
+ bool has_owner = owner.size() > 0; |
size_t max_non_owner_users = has_owner ? kMaxUsers - 1 : kMaxUsers; |
size_t non_owner_count = 0; |
for (user_manager::UserList::const_iterator it = users.begin(); |
it != users.end(); |
++it) { |
- bool is_owner = ((*it)->GetAccountId() == owner); |
+ const std::string& user_id = (*it)->email(); |
+ bool is_owner = (user_id == owner); |
bool is_public_account = |
((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); |
@@ -366,10 +347,8 @@ |
bool single_user = users_.size() == 1; |
bool is_signin_to_add = LoginDisplayHostImpl::default_host() && |
user_manager::UserManager::Get()->IsUserLoggedIn(); |
- std::string owner_email; |
- chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, |
- &owner_email); |
- const AccountId owner(GetAccountIdOfKnownUser(owner_email)); |
+ std::string owner; |
+ chromeos::CrosSettings::Get()->GetString(chromeos::kDeviceOwner, &owner); |
policy::BrowserPolicyConnectorChromeOS* connector = |
g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
@@ -384,22 +363,22 @@ |
for (user_manager::UserList::const_iterator it = users_to_send.begin(); |
it != users_to_send.end(); |
++it) { |
- const AccountId& account_id = (*it)->GetAccountId(); |
- bool is_owner = (account_id == owner); |
+ const std::string& user_id = (*it)->email(); |
+ bool is_owner = (user_id == owner); |
const bool is_public_account = |
((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); |
const AuthType initial_auth_type = |
is_public_account ? EXPAND_THEN_USER_CLICK |
: (ShouldForceOnlineSignIn(*it) ? ONLINE_SIGN_IN |
: OFFLINE_PASSWORD); |
- user_auth_type_map_[account_id] = initial_auth_type; |
+ user_auth_type_map_[user_id] = initial_auth_type; |
base::DictionaryValue* user_dict = new base::DictionaryValue(); |
const std::vector<std::string>* public_session_recommended_locales = |
- public_session_recommended_locales_.find(account_id) == |
- public_session_recommended_locales_.end() |
- ? &kEmptyRecommendedLocales |
- : &public_session_recommended_locales_[account_id]; |
+ public_session_recommended_locales_.find(user_id) == |
+ public_session_recommended_locales_.end() ? |
+ &kEmptyRecommendedLocales : |
+ &public_session_recommended_locales_[user_id]; |
FillUserDictionary(*it, |
is_owner, |
is_signin_to_add, |
@@ -412,7 +391,7 @@ |
// available when running into login screen on first boot. |
// See http://crosbug.com/12723 |
bool can_remove_user = |
- ((!single_user || is_enterprise_managed) && account_id.is_valid() && |
+ ((!single_user || is_enterprise_managed) && !user_id.empty() && |
!is_owner && !is_public_account && !signed_in && !is_signin_to_add); |
user_dict->SetBoolean(kKeyCanRemove, can_remove_user); |
users_list.Append(user_dict); |
@@ -425,7 +404,7 @@ |
SendUserList(); |
} |
-void UserSelectionScreen::CheckUserStatus(const AccountId& account_id) { |
+void UserSelectionScreen::CheckUserStatus(const std::string& user_email) { |
// No checks on lock screen. |
if (ScreenLocker::default_screen_locker()) |
return; |
@@ -435,6 +414,7 @@ |
new TokenHandleUtil(user_manager::UserManager::Get())); |
} |
+ const AccountId account_id = AccountId::FromUserEmail(user_email); |
if (token_handle_util_->HasToken(account_id)) { |
token_handle_util_->CheckToken( |
account_id, base::Bind(&UserSelectionScreen::OnUserStatusChecked, |
@@ -457,21 +437,19 @@ |
void UserSelectionScreen::SetAuthType(const std::string& user_id, |
AuthType auth_type, |
const base::string16& initial_value) { |
- const AccountId& account_id = GetAccountIdOfKnownUser(user_id); |
- if (GetAuthType(account_id.GetUserEmail()) == FORCE_OFFLINE_PASSWORD) |
- return; |
- DCHECK(GetAuthType(account_id.GetUserEmail()) != FORCE_OFFLINE_PASSWORD || |
+ if (GetAuthType(user_id) == FORCE_OFFLINE_PASSWORD) |
+ return; |
+ DCHECK(GetAuthType(user_id) != FORCE_OFFLINE_PASSWORD || |
auth_type == FORCE_OFFLINE_PASSWORD); |
- user_auth_type_map_[account_id] = auth_type; |
- view_->SetAuthType(account_id, auth_type, initial_value); |
+ user_auth_type_map_[user_id] = auth_type; |
+ view_->SetAuthType(user_id, auth_type, initial_value); |
} |
proximity_auth::ScreenlockBridge::LockHandler::AuthType |
UserSelectionScreen::GetAuthType(const std::string& username) const { |
- const AccountId& account_id = GetAccountIdOfKnownUser(username); |
- if (user_auth_type_map_.find(account_id) == user_auth_type_map_.end()) |
+ if (user_auth_type_map_.find(username) == user_auth_type_map_.end()) |
return OFFLINE_PASSWORD; |
- return user_auth_type_map_.find(account_id)->second; |
+ return user_auth_type_map_.find(username)->second; |
} |
proximity_auth::ScreenlockBridge::LockHandler::ScreenType |
@@ -496,13 +474,11 @@ |
scoped_ptr<base::DictionaryValue> icon = icon_options.ToDictionaryValue(); |
if (!icon || icon->empty()) |
return; |
- const AccountId account_id = GetAccountIdOfKnownUser(user_id); |
- view_->ShowUserPodCustomIcon(account_id, *icon); |
+ view_->ShowUserPodCustomIcon(user_id, *icon); |
} |
void UserSelectionScreen::HideUserPodCustomIcon(const std::string& user_id) { |
- const AccountId account_id = GetAccountIdOfKnownUser(user_id); |
- view_->HideUserPodCustomIcon(account_id); |
+ view_->HideUserPodCustomIcon(user_id); |
} |
void UserSelectionScreen::EnableInput() { |
@@ -523,7 +499,7 @@ |
const std::string& key_label) { |
DCHECK_EQ(GetScreenType(), SIGNIN_SCREEN); |
- UserContext user_context(GetAccountIdOfKnownUser(user_id)); |
+ UserContext user_context(AccountId::FromUserEmail(user_id)); |
user_context.SetAuthFlow(UserContext::AUTH_FLOW_EASY_UNLOCK); |
user_context.SetKey(Key(secret)); |
user_context.GetKey()->SetLabel(key_label); |
@@ -531,36 +507,36 @@ |
login_display_delegate_->Login(user_context, SigninSpecifics()); |
} |
-void UserSelectionScreen::HardLockPod(const AccountId& account_id) { |
- view_->SetAuthType(account_id, OFFLINE_PASSWORD, base::string16()); |
- EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); |
+void UserSelectionScreen::HardLockPod(const std::string& user_id) { |
+ view_->SetAuthType(user_id, OFFLINE_PASSWORD, base::string16()); |
+ EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
if (!service) |
return; |
service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); |
} |
-void UserSelectionScreen::AttemptEasyUnlock(const AccountId& account_id) { |
- EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); |
+void UserSelectionScreen::AttemptEasyUnlock(const std::string& user_id) { |
+ EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
if (!service) |
return; |
- service->AttemptAuth(account_id.GetUserEmail()); |
-} |
- |
-void UserSelectionScreen::RecordClickOnLockIcon(const AccountId& account_id) { |
- EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); |
+ service->AttemptAuth(user_id); |
+} |
+ |
+void UserSelectionScreen::RecordClickOnLockIcon(const std::string& user_id) { |
+ EasyUnlockService* service = GetEasyUnlockServiceForUser(user_id); |
if (!service) |
return; |
service->RecordClickOnLockIcon(); |
} |
EasyUnlockService* UserSelectionScreen::GetEasyUnlockServiceForUser( |
- const AccountId& account_id) const { |
+ const std::string& user_id) const { |
if (GetScreenType() == OTHER_SCREEN) |
return nullptr; |
const user_manager::User* unlock_user = nullptr; |
for (const user_manager::User* user : users_) { |
- if (user->GetAccountId() == account_id) { |
+ if (user->email() == user_id) { |
unlock_user = user; |
break; |
} |