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

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view.cc

Issue 471333003: Make sure avatar menu does not use account_id for display purposes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 4 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/ui/views/profiles/profile_chooser_view.cc
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view.cc b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
index c93cbbf4cb0f50df53a1bb9a33e8db3ca62299d3..b86a6c8f0271ebee4d63b9d7c678d728f16ca7cd 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view.cc
@@ -744,7 +744,7 @@ void ProfileChooserView::ButtonPressed(views::Button* sender,
} else if (sender == gaia_signin_cancel_button_) {
std::string primary_account =
SigninManagerFactory::GetForProfile(browser_->profile())->
- GetAuthenticatedUsername();
+ GetAuthenticatedAccountId();
// The account management view is only available with the
// --enable-account-consistency flag.
bool account_management_available = !primary_account.empty() &&
@@ -1314,7 +1314,7 @@ views::View* ProfileChooserView::CreateCurrentProfileAccountsView(
Profile* profile = browser_->profile();
std::string primary_account =
- SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedUsername();
+ SigninManagerFactory::GetForProfile(profile)->GetAuthenticatedAccountId();
DCHECK(!primary_account.empty());
std::vector<std::string>accounts =
profiles::GetSecondaryAccountsForProfile(profile, primary_account);
@@ -1348,10 +1348,12 @@ views::View* ProfileChooserView::CreateCurrentProfileAccountsView(
}
void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
- const std::string& account,
+ const std::string& account_id,
bool is_primary_account,
bool reauth_required,
int width) {
+ std::string email = signin_ui_util::GetDisplayEmail(browser_->profile(),
+ account_id);
ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
const gfx::ImageSkia* delete_default_image =
rb->GetImageNamed(IDR_CLOSE_1).ToImageSkia();
@@ -1365,7 +1367,7 @@ void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
- kDeleteButtonWidth - kWarningButtonWidth;
views::LabelButton* email_button = new BackgroundColorHoverButton(
reauth_required ? this : NULL,
- base::UTF8ToUTF16(account),
+ base::UTF8ToUTF16(email),
warning_default_image);
email_button->SetElideBehavior(gfx::ELIDE_EMAIL);
email_button->SetMinSize(gfx::Size(0, kButtonHeight));
@@ -1374,7 +1376,7 @@ void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
layout->AddView(email_button);
if (reauth_required)
- reauth_account_button_map_[email_button] = account;
+ reauth_account_button_map_[email_button] = account_id;
// Delete button.
if (!browser_->profile()->IsSupervised()) {
@@ -1395,7 +1397,7 @@ void ProfileChooserView::CreateAccountButton(views::GridLayout* layout,
email_button->AddChildView(delete_button);
// Save the original email address, as the button text could be elided.
- delete_account_button_map_[delete_button] = account;
+ delete_account_button_map_[delete_button] = account_id;
}
}
@@ -1452,7 +1454,7 @@ views::View* ProfileChooserView::CreateAccountRemovalView() {
views::kButtonHEdgeMarginNew);
const std::string& primary_account = SigninManagerFactory::GetForProfile(
- browser_->profile())->GetAuthenticatedUsername();
+ browser_->profile())->GetAuthenticatedAccountId();
bool is_primary_account = primary_account == account_id_to_remove_;
// Adds main text.
@@ -1462,12 +1464,14 @@ views::View* ProfileChooserView::CreateAccountRemovalView() {
rb->GetFontList(ui::ResourceBundle::SmallFont);
if (is_primary_account) {
+ std::string email = signin_ui_util::GetDisplayEmail(browser_->profile(),
+ account_id_to_remove_);
std::vector<size_t> offsets;
const base::string16 settings_text =
l10n_util::GetStringUTF16(IDS_PROFILES_SETTINGS_LINK);
const base::string16 primary_account_removal_text =
l10n_util::GetStringFUTF16(IDS_PROFILES_PRIMARY_ACCOUNT_REMOVAL_TEXT,
- base::UTF8ToUTF16(account_id_to_remove_), settings_text, &offsets);
+ base::UTF8ToUTF16(email), settings_text, &offsets);
views::StyledLabel* primary_account_removal_label =
new views::StyledLabel(primary_account_removal_text, this);
primary_account_removal_label->AddStyleRange(

Powered by Google App Engine
This is Rietveld 408576698