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 |
11 #include "ash/ash_switches.h" | 11 #include "ash/ash_switches.h" |
| 12 #include "ash/multi_profile_uma.h" |
12 #include "ash/popup_message.h" | 13 #include "ash/popup_message.h" |
13 #include "ash/root_window_controller.h" | 14 #include "ash/root_window_controller.h" |
14 #include "ash/session_state_delegate.h" | 15 #include "ash/session_state_delegate.h" |
15 #include "ash/shelf/shelf_layout_manager.h" | 16 #include "ash/shelf/shelf_layout_manager.h" |
16 #include "ash/shell.h" | 17 #include "ash/shell.h" |
17 #include "ash/shell_delegate.h" | 18 #include "ash/shell_delegate.h" |
18 #include "ash/system/tray/system_tray.h" | 19 #include "ash/system/tray/system_tray.h" |
19 #include "ash/system/tray/system_tray_delegate.h" | 20 #include "ash/system/tray/system_tray_delegate.h" |
20 #include "ash/system/tray/system_tray_notifier.h" | 21 #include "ash/system/tray/system_tray_notifier.h" |
21 #include "ash/system/tray/tray_constants.h" | 22 #include "ash/system/tray/tray_constants.h" |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 744 |
744 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { | 745 void UserView::ButtonPressed(views::Button* sender, const ui::Event& event) { |
745 if (sender == logout_button_) { | 746 if (sender == logout_button_) { |
746 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); | 747 ash::Shell::GetInstance()->system_tray_delegate()->SignOut(); |
747 } else if (sender == user_card_view_ && SupportsMultiProfile()) { | 748 } else if (sender == user_card_view_ && SupportsMultiProfile()) { |
748 if (!multiprofile_index_) { | 749 if (!multiprofile_index_) { |
749 ToggleAddUserMenuOption(); | 750 ToggleAddUserMenuOption(); |
750 } else { | 751 } else { |
751 ash::SessionStateDelegate* delegate = | 752 ash::SessionStateDelegate* delegate = |
752 ash::Shell::GetInstance()->session_state_delegate(); | 753 ash::Shell::GetInstance()->session_state_delegate(); |
| 754 MultiProfileUMA::RecordSwitchUserFromTray(); |
753 delegate->SwitchActiveUser(delegate->GetUserEmail(multiprofile_index_)); | 755 delegate->SwitchActiveUser(delegate->GetUserEmail(multiprofile_index_)); |
754 // Since the user list is about to change the system menu should get | 756 // Since the user list is about to change the system menu should get |
755 // closed. | 757 // closed. |
756 owner_->system_tray()->CloseSystemBubble(); | 758 owner_->system_tray()->CloseSystemBubble(); |
757 } | 759 } |
758 } else if (add_menu_option_.get() && | 760 } else if (add_menu_option_.get() && |
759 sender == add_menu_option_->GetContentsView()) { | 761 sender == add_menu_option_->GetContentsView()) { |
760 // Let the user add another account to the session. | 762 // Let the user add another account to the session. |
| 763 MultiProfileUMA::RecordSigninUserFromTray(); |
761 ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); | 764 ash::Shell::GetInstance()->system_tray_delegate()->ShowUserLogin(); |
762 } else { | 765 } else { |
763 NOTREACHED(); | 766 NOTREACHED(); |
764 } | 767 } |
765 } | 768 } |
766 | 769 |
767 void UserView::AddLogoutButton(ash::user::LoginStatus login) { | 770 void UserView::AddLogoutButton(ash::user::LoginStatus login) { |
768 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( | 771 const base::string16 title = ash::user::GetLocalizedSignOutStringForStatus( |
769 login, true); | 772 login, true); |
770 TrayPopupLabelButton* logout_button = new TrayPopupLabelButton(this, title); | 773 TrayPopupLabelButton* logout_button = new TrayPopupLabelButton(this, title); |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1291 kUserIconLargeSize : kUserIconSize; | 1294 kUserIconLargeSize : kUserIconSize; |
1292 | 1295 |
1293 avatar_->SetImage( | 1296 avatar_->SetImage( |
1294 ash::Shell::GetInstance()->session_state_delegate()->GetUserImage( | 1297 ash::Shell::GetInstance()->session_state_delegate()->GetUserImage( |
1295 multiprofile_index_), | 1298 multiprofile_index_), |
1296 gfx::Size(icon_size, icon_size)); | 1299 gfx::Size(icon_size, icon_size)); |
1297 } | 1300 } |
1298 | 1301 |
1299 } // namespace internal | 1302 } // namespace internal |
1300 } // namespace ash | 1303 } // namespace ash |
OLD | NEW |