Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system/user/tray_user.h" | 5 #include "ash/system/user/tray_user.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <climits> | 8 #include <climits> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 | 546 |
| 547 ash::SystemTrayDelegate* delegate = | 547 ash::SystemTrayDelegate* delegate = |
| 548 ash::Shell::GetInstance()->system_tray_delegate(); | 548 ash::Shell::GetInstance()->system_tray_delegate(); |
| 549 views::View* details = new views::View; | 549 views::View* details = new views::View; |
| 550 details->SetLayoutManager(new views::BoxLayout( | 550 details->SetLayoutManager(new views::BoxLayout( |
| 551 views::BoxLayout::kVertical, 0, kUserDetailsVerticalPadding, 0)); | 551 views::BoxLayout::kVertical, 0, kUserDetailsVerticalPadding, 0)); |
| 552 views::Label* username = new views::Label(delegate->GetUserDisplayName()); | 552 views::Label* username = new views::Label(delegate->GetUserDisplayName()); |
| 553 username->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 553 username->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 554 details->AddChildView(username); | 554 details->AddChildView(username); |
| 555 | 555 |
| 556 views::Label* email = new views::Label(UTF8ToUTF16(delegate->GetUserEmail())); | |
| 557 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 556 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 558 email->SetFont(bundle.GetFont(ui::ResourceBundle::SmallFont)); | 557 |
| 559 email->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 558 views::Label* additional = new views::Label(); |
| 560 email->SetEnabled(false); | 559 |
| 561 details->AddChildView(email); | 560 if (login == ash::user::LOGGED_IN_LOCALLY_MANAGED) { |
| 561 additional->SetText( | |
| 562 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_LOCALLY_MANAGED_LABEL)); | |
| 563 } else { | |
| 564 additional->SetText(UTF8ToUTF16(delegate->GetUserEmail())); | |
| 565 } | |
|
Daniel Erat
2013/04/29 13:32:57
nit: you can maybe make this a bit shorter by rewr
Denis Kuznetsov (DE-MUC)
2013/04/29 14:14:58
Done.
| |
| 566 | |
| 567 additional->SetFont(bundle.GetFont(ui::ResourceBundle::SmallFont)); | |
| 568 additional->SetHorizontalAlignment(gfx::ALIGN_LEFT); | |
| 569 additional->SetEnabled(false); | |
| 570 details->AddChildView(additional); | |
| 562 user_card_->AddChildView(details); | 571 user_card_->AddChildView(details); |
| 563 } | 572 } |
| 564 | 573 |
| 565 } // namespace tray | 574 } // namespace tray |
| 566 | 575 |
| 567 TrayUser::TrayUser(SystemTray* system_tray) | 576 TrayUser::TrayUser(SystemTray* system_tray) |
| 568 : SystemTrayItem(system_tray), | 577 : SystemTrayItem(system_tray), |
| 569 user_(NULL), | 578 user_(NULL), |
| 570 avatar_(NULL), | 579 avatar_(NULL), |
| 571 label_(NULL) { | 580 label_(NULL) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 // Check for null to avoid crbug.com/150944. | 681 // Check for null to avoid crbug.com/150944. |
| 673 if (avatar_) { | 682 if (avatar_) { |
| 674 avatar_->SetImage( | 683 avatar_->SetImage( |
| 675 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), | 684 ash::Shell::GetInstance()->system_tray_delegate()->GetUserImage(), |
| 676 gfx::Size(kUserIconSize, kUserIconSize)); | 685 gfx::Size(kUserIconSize, kUserIconSize)); |
| 677 } | 686 } |
| 678 } | 687 } |
| 679 | 688 |
| 680 } // namespace internal | 689 } // namespace internal |
| 681 } // namespace ash | 690 } // namespace ash |
| OLD | NEW |