| OLD | NEW |
| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 views::Label* user_name = nullptr; | 496 views::Label* user_name = nullptr; |
| 497 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); | 497 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); |
| 498 if (is_active_user()) { | 498 if (is_active_user()) { |
| 499 base::string16 user_name_string = | 499 base::string16 user_name_string = |
| 500 login_status == LoginStatus::GUEST | 500 login_status == LoginStatus::GUEST |
| 501 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL) | 501 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_GUEST_LABEL) |
| 502 : delegate->GetUserInfo(user_index_)->GetDisplayName(); | 502 : delegate->GetUserInfo(user_index_)->GetDisplayName(); |
| 503 if (!user_name_string.empty()) { | 503 if (!user_name_string.empty()) { |
| 504 user_name = new views::Label(user_name_string); | 504 user_name = new views::Label(user_name_string); |
| 505 user_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 505 user_name->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 506 TrayPopupItemStyle user_name_style(nullptr, | 506 TrayPopupItemStyle user_name_style( |
| 507 TrayPopupItemStyle::FontStyle::TITLE); | 507 TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); |
| 508 user_name_style.SetupLabel(user_name); | 508 user_name_style.SetupLabel(user_name); |
| 509 } | 509 } |
| 510 } | 510 } |
| 511 | 511 |
| 512 views::Label* user_email = NULL; | 512 views::Label* user_email = NULL; |
| 513 if (login_status != LoginStatus::GUEST) { | 513 if (login_status != LoginStatus::GUEST) { |
| 514 SystemTrayDelegate* tray_delegate = WmShell::Get()->system_tray_delegate(); | 514 SystemTrayDelegate* tray_delegate = WmShell::Get()->system_tray_delegate(); |
| 515 base::string16 user_email_string = | 515 base::string16 user_email_string = |
| 516 tray_delegate->IsUserSupervised() | 516 tray_delegate->IsUserSupervised() |
| 517 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL) | 517 ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL) |
| 518 : base::UTF8ToUTF16( | 518 : base::UTF8ToUTF16( |
| 519 delegate->GetUserInfo(user_index_)->GetDisplayEmail()); | 519 delegate->GetUserInfo(user_index_)->GetDisplayEmail()); |
| 520 if (!user_email_string.empty()) { | 520 if (!user_email_string.empty()) { |
| 521 user_email = new views::Label(user_email_string); | 521 user_email = new views::Label(user_email_string); |
| 522 user_email->SetFontList( | |
| 523 ui::ResourceBundle::GetSharedInstance().GetFontList( | |
| 524 ui::ResourceBundle::SmallFont)); | |
| 525 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 522 user_email->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 526 TrayPopupItemStyle user_email_style( | 523 TrayPopupItemStyle user_email_style( |
| 527 nullptr, TrayPopupItemStyle::FontStyle::CAPTION); | 524 nullptr, TrayPopupItemStyle::FontStyle::CAPTION); |
| 528 user_email_style.set_color_style( | 525 user_email_style.set_color_style( |
| 529 TrayPopupItemStyle::ColorStyle::INACTIVE); | 526 TrayPopupItemStyle::ColorStyle::INACTIVE); |
| 530 user_email_style.SetupLabel(user_email); | 527 user_email_style.SetupLabel(user_email); |
| 531 } | 528 } |
| 532 } | 529 } |
| 533 | 530 |
| 534 if (user_email && user_name) { | 531 if (user_email && user_name) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 564 details->AddChildView(media_indicator->GetMessageView()); | 561 details->AddChildView(media_indicator->GetMessageView()); |
| 565 AddChildView(details); | 562 AddChildView(details); |
| 566 #else | 563 #else |
| 567 AddChildView(user_email); | 564 AddChildView(user_email); |
| 568 #endif | 565 #endif |
| 569 } | 566 } |
| 570 } | 567 } |
| 571 | 568 |
| 572 } // namespace tray | 569 } // namespace tray |
| 573 } // namespace ash | 570 } // namespace ash |
| OLD | NEW |