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/system/user/user_view.h" | 5 #include "ash/system/user/user_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/multi_profile_uma.h" | 9 #include "ash/multi_profile_uma.h" |
10 #include "ash/popup_message.h" | 10 #include "ash/popup_message.h" |
11 #include "ash/session/session_state_delegate.h" | 11 #include "ash/session_state_delegate.h" |
12 #include "ash/session/user_info.h" | |
13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
14 #include "ash/shell_delegate.h" | 13 #include "ash/shell_delegate.h" |
15 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
16 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
17 #include "ash/system/tray/tray_popup_label_button.h" | 16 #include "ash/system/tray/tray_popup_label_button.h" |
18 #include "ash/system/tray/tray_popup_label_button_border.h" | 17 #include "ash/system/tray/tray_popup_label_button_border.h" |
19 #include "ash/system/user/button_from_view.h" | 18 #include "ash/system/user/button_from_view.h" |
20 #include "ash/system/user/config.h" | 19 #include "ash/system/user/config.h" |
21 #include "ash/system/user/rounded_image_view.h" | 20 #include "ash/system/user/rounded_image_view.h" |
22 #include "ash/system/user/user_card_view.h" | 21 #include "ash/system/user/user_card_view.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 if (ash::Shell::GetInstance() | 69 if (ash::Shell::GetInstance() |
71 ->session_state_delegate() | 70 ->session_state_delegate() |
72 ->IsUserSessionBlocked()) | 71 ->IsUserSessionBlocked()) |
73 return; | 72 return; |
74 | 73 |
75 DCHECK(user_index > 0); | 74 DCHECK(user_index > 0); |
76 ash::SessionStateDelegate* delegate = | 75 ash::SessionStateDelegate* delegate = |
77 ash::Shell::GetInstance()->session_state_delegate(); | 76 ash::Shell::GetInstance()->session_state_delegate(); |
78 ash::MultiProfileUMA::RecordSwitchActiveUser( | 77 ash::MultiProfileUMA::RecordSwitchActiveUser( |
79 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); | 78 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); |
80 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetUserID()); | 79 delegate->SwitchActiveUser(delegate->GetUserID(user_index)); |
81 } | 80 } |
82 | 81 |
83 class LogoutButton : public TrayPopupLabelButton { | 82 class LogoutButton : public TrayPopupLabelButton { |
84 public: | 83 public: |
85 // If |placeholder| is true, button is used as placeholder. That means that | 84 // If |placeholder| is true, button is used as placeholder. That means that |
86 // button is inactive and is not painted, but consume the same ammount of | 85 // button is inactive and is not painted, but consume the same ammount of |
87 // space, as if it was painted. | 86 // space, as if it was painted. |
88 LogoutButton(views::ButtonListener* listener, | 87 LogoutButton(views::ButtonListener* listener, |
89 const base::string16& text, | 88 const base::string16& text, |
90 bool placeholder) | 89 bool placeholder) |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 // watcher which will close the "menu". | 481 // watcher which will close the "menu". |
483 gfx::Rect area = user_card_view_->GetBoundsInScreen(); | 482 gfx::Rect area = user_card_view_->GetBoundsInScreen(); |
484 area.set_height(2 * area.height()); | 483 area.set_height(2 * area.height()); |
485 mouse_watcher_.reset( | 484 mouse_watcher_.reset( |
486 new views::MouseWatcher(new UserViewMouseWatcherHost(area), this)); | 485 new views::MouseWatcher(new UserViewMouseWatcherHost(area), this)); |
487 mouse_watcher_->Start(); | 486 mouse_watcher_->Start(); |
488 } | 487 } |
489 | 488 |
490 } // namespace tray | 489 } // namespace tray |
491 } // namespace ash | 490 } // namespace ash |
OLD | NEW |