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