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

Side by Side Diff: ash/common/system/user/user_card_view.cc

Issue 2564623002: MD CrOS Shelf - fix alignment of guest user name in shelf bubble. (Closed)
Patch Set: Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/common/system/user/user_card_view.h" 5 #include "ash/common/system/user/user_card_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/login_status.h" 10 #include "ash/common/login_status.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 user_name_style.SetupLabel(user_name_); 557 user_name_style.SetupLabel(user_name_);
558 558
559 TrayPopupItemStyle user_email_style(TrayPopupItemStyle::FontStyle::CAPTION); 559 TrayPopupItemStyle user_email_style(TrayPopupItemStyle::FontStyle::CAPTION);
560 // Only the active user's email label is lightened (for the inactive user, the 560 // Only the active user's email label is lightened (for the inactive user, the
561 // label starts as black and the entire row is 54% opacity). 561 // label starts as black and the entire row is 54% opacity).
562 if (is_active_user()) 562 if (is_active_user())
563 user_email_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE); 563 user_email_style.set_color_style(TrayPopupItemStyle::ColorStyle::INACTIVE);
564 auto user_email = new views::Label(); 564 auto user_email = new views::Label();
565 base::string16 user_email_string; 565 base::string16 user_email_string;
566 if (login_status != LoginStatus::GUEST) { 566 if (login_status != LoginStatus::GUEST) {
567 SystemTrayDelegate* tray_delegate = WmShell::Get()->system_tray_delegate();
568 user_email_string = 567 user_email_string =
569 tray_delegate->IsUserSupervised() 568 WmShell::Get()->system_tray_delegate()->IsUserSupervised()
570 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL) 569 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)
571 : base::UTF8ToUTF16( 570 : base::UTF8ToUTF16(
572 delegate->GetUserInfo(user_index_)->GetDisplayEmail()); 571 delegate->GetUserInfo(user_index_)->GetDisplayEmail());
573 } 572 }
574 user_email->SetText(user_email_string); 573 user_email->SetText(user_email_string);
575 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT); 574 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT);
576 user_email_style.SetupLabel(user_email); 575 user_email_style.SetupLabel(user_email);
576 user_email->SetVisible(!user_email_string.empty());
577 user_email->set_collapse_when_hidden(true);
577 578
578 views::View* stack_of_labels = new views::View; 579 views::View* stack_of_labels = new views::View;
579 AddChildView(stack_of_labels); 580 AddChildView(stack_of_labels);
580 layout->SetFlexForView(stack_of_labels, 1); 581 layout->SetFlexForView(stack_of_labels, 1);
581 stack_of_labels->SetLayoutManager( 582 stack_of_labels->SetLayoutManager(
582 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); 583 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0));
583 stack_of_labels->AddChildView(user_name_); 584 stack_of_labels->AddChildView(user_name_);
584 stack_of_labels->AddChildView(user_email); 585 stack_of_labels->AddChildView(user_email);
585 // The name and email have different font sizes. This border is designed 586 // The name and email have different font sizes. This border is designed
586 // to make both views take up equal space so the whitespace between them 587 // to make both views take up equal space so the whitespace between them
(...skipping 25 matching lines...) Expand all
612 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR); 613 media_capture_icon_->set_id(VIEW_ID_USER_VIEW_MEDIA_INDICATOR);
613 #endif 614 #endif
614 AddChildView(media_capture_icon_); 615 AddChildView(media_capture_icon_);
615 616
616 OnMediaCaptureChanged(); 617 OnMediaCaptureChanged();
617 } 618 }
618 } 619 }
619 620
620 } // namespace tray 621 } // namespace tray
621 } // namespace ash 622 } // namespace ash
OLDNEW
« 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