Chromium Code Reviews| 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..814eb6e3f2fc1218b3828d0da3b0da3fbb47cce7 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,19 @@ void ChromeUserSelectionScreen::OnDeviceLocalAccountsChanged() { |
| void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange( |
| policy::DeviceLocalAccountPolicyBroker* broker) { |
| - const std::string& user_id = broker->user_id(); |
| + const AccountId& account_id(GetAccountIdOfKnownUser(broker->user_id())); |
|
dzhioev (left Google)
2015/11/13 23:17:37
nit: such syntax seems weird to me.
Why not const
Alexander Alekseev
2015/11/14 00:27:42
Done.
|
| 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 +101,12 @@ void ChromeUserSelectionScreen::CheckForPublicSessionDisplayNameChange( |
| 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())); |
|
dzhioev (left Google)
2015/11/13 23:17:37
Why account_id is not a reference here?
Alexander Alekseev
2015/11/14 00:27:42
Because it is generated and temporary inside GetKn
dzhioev (left Google)
2015/11/14 01:21:15
It is perfectly legal to bind const reference to a
Alexander Alekseev
2015/11/14 07:10:33
Done.
|
| const policy::PolicyMap::Entry* entry = |
| broker->core()->store()->policy_map().Get(policy::key::kSessionLocales); |
| @@ -131,30 +130,30 @@ void ChromeUserSelectionScreen::CheckForPublicSessionLocalePolicyChange( |
| } |
| 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 +177,7 @@ void ChromeUserSelectionScreen::SetPublicSessionLocales( |
| 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); |
| } |