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

Unified Diff: ash/system/user/tray_user.cc

Issue 15738017: Vertically centering the user name for guest mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed merge problem Created 7 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/user/tray_user.cc
diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc
index 3baba0a554027376bc4fede0d2cd5c1e0e36b980..e3c0697a9c4321d3f3b116f9831efed0de9c008f 100644
--- a/ash/system/user/tray_user.cc
+++ b/ash/system/user/tray_user.cc
@@ -799,18 +799,14 @@ void UserView::AddUserCard(SystemTrayItem* owner,
}
ash::SessionStateDelegate* delegate =
ash::Shell::GetInstance()->session_state_delegate();
- views::View* details = new views::View;
- details->SetLayoutManager(new views::BoxLayout(
- views::BoxLayout::kVertical, 0, kUserDetailsVerticalPadding, 0));
views::Label* username = NULL;
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
if (!multiprofile_index_) {
- views::Label* username = new views::Label(
+ username = new views::Label(
login == ash::user::LOGGED_IN_GUEST ?
bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_GUEST_LABEL) :
delegate->GetUserDisplayName(multiprofile_index_));
username->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- details->AddChildView(username);
}
views::Label* additional = NULL;
@@ -822,7 +818,6 @@ void UserView::AddUserCard(SystemTrayItem* owner,
additional->SetFont(bundle.GetFont(ui::ResourceBundle::SmallFont));
additional->SetHorizontalAlignment(gfx::ALIGN_LEFT);
- details->AddChildView(additional);
}
// Adjust text properties dependent on if it is an active or inactive user.
@@ -836,11 +831,19 @@ void UserView::AddUserCard(SystemTrayItem* owner,
username->SetDisabledColor(text_color);
}
- // Use a small font for email address if username exists as well.
- if (username)
- additional->SetFont(bundle.GetFont(ui::ResourceBundle::SmallFont));
-
- user_card_view_->AddChildView(details);
+ if (additional && username) {
+ views::View* details = new views::View;
+ details->SetLayoutManager(new views::BoxLayout(
+ views::BoxLayout::kVertical, 0, kUserDetailsVerticalPadding, 0));
+ details->AddChildView(username);
+ details->AddChildView(additional);
+ user_card_view_->AddChildView(details);
+ } else {
+ if (username)
+ user_card_view_->AddChildView(username);
+ if (additional)
+ user_card_view_->AddChildView(additional);
+ }
}
views::View* UserView::CreateIconForUserCard(ash::user::LoginStatus login) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698