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

Unified Diff: chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc

Issue 1455263002: Reland of This CL replaces e-mail with AccountId on user selection screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/screens/chrome_user_selection_screen.cc
diff --git a/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc b/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc
index e309e136fa94b39ca6f11a80e3799f066eb9704f..196b81ba4dfad12dde2bab45922163264e41537e 100644
--- a/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc
+++ b/chrome/browser/chromeos/login/screens/chrome_user_selection_screen.cc
@@ -77,19 +77,20 @@
void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange(
policy::DeviceLocalAccountPolicyBroker* broker) {
- const std::string& user_id = broker->user_id();
+ const AccountId& account_id = GetAccountIdOfKnownUser(broker->user_id());
+ DCHECK(account_id.is_valid());
const std::string& display_name = broker->GetDisplayName();
- if (display_name == public_session_display_names_[user_id])
+ if (display_name == public_session_display_names_[account_id])
return;
- public_session_display_names_[user_id] = display_name;
+ public_session_display_names_[account_id] = display_name;
if (!handler_initialized_)
return;
if (!display_name.empty()) {
// If a new display name was set by policy, notify the UI about it.
- view_->SetPublicSessionDisplayName(user_id, display_name);
+ view_->SetPublicSessionDisplayName(account_id, display_name);
return;
}
@@ -101,13 +102,13 @@
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&ChromeUserSelectionScreen::SetPublicSessionDisplayName,
- weak_factory_.GetWeakPtr(),
- user_id));
+ weak_factory_.GetWeakPtr(), account_id));
}
void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange(
policy::DeviceLocalAccountPolicyBroker* broker) {
- const std::string& user_id = broker->user_id();
+ const AccountId& account_id = GetAccountIdOfKnownUser(broker->user_id());
+ DCHECK(account_id.is_valid());
const policy::PolicyMap::Entry* entry =
broker->core()->store()->policy_map().Get(policy::key::kSessionLocales);
@@ -131,30 +132,30 @@
}
std::vector<std::string>& recommended_locales =
- public_session_recommended_locales_[user_id];
+ public_session_recommended_locales_[account_id];
if (new_recommended_locales != recommended_locales)
- SetPublicSessionLocales(user_id, new_recommended_locales);
+ SetPublicSessionLocales(account_id, new_recommended_locales);
if (new_recommended_locales.empty())
- public_session_recommended_locales_.erase(user_id);
+ public_session_recommended_locales_.erase(account_id);
else
recommended_locales = new_recommended_locales;
}
void ChromeUserSelectionScreen::SetPublicSessionDisplayName(
- const std::string& user_id) {
- const user_manager::User* user = user_manager::UserManager::Get()->FindUser(
- AccountId::FromUserEmail(user_id));
+ const AccountId& account_id) {
+ const user_manager::User* user =
+ user_manager::UserManager::Get()->FindUser(account_id);
if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
return;
- view_->SetPublicSessionDisplayName(user_id,
+ view_->SetPublicSessionDisplayName(account_id,
base::UTF16ToUTF8(user->GetDisplayName()));
}
void ChromeUserSelectionScreen::SetPublicSessionLocales(
- const std::string& user_id,
+ const AccountId& account_id,
const std::vector<std::string>& recommended_locales) {
if (!handler_initialized_)
return;
@@ -178,7 +179,7 @@
const bool two_or_more_recommended_locales = recommended_locales.size() >= 2;
// Notify the UI.
- view_->SetPublicSessionLocales(user_id, available_locales.Pass(),
+ view_->SetPublicSessionLocales(account_id, available_locales.Pass(),
default_locale,
two_or_more_recommended_locales);
}

Powered by Google App Engine
This is Rietveld 408576698