| 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/session_state_delegate.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "ash/shell_delegate.h" | 13 #include "ash/shell_delegate.h" |
| 14 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
| 15 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
| 16 #include "ash/system/tray/tray_popup_label_button.h" | 16 #include "ash/system/tray/tray_popup_label_button.h" |
| 17 #include "ash/system/tray/tray_popup_label_button_border.h" | 17 #include "ash/system/tray/tray_popup_label_button_border.h" |
| 18 #include "ash/system/user/button_from_view.h" | 18 #include "ash/system/user/button_from_view.h" |
| 19 #include "ash/system/user/config.h" | 19 #include "ash/system/user/config.h" |
| 20 #include "ash/system/user/rounded_image_view.h" | 20 #include "ash/system/user/rounded_image_view.h" |
| 21 #include "ash/system/user/user_card_view.h" | 21 #include "ash/system/user/user_card_view.h" |
| 22 #include "components/signin/core/account_id/account_id.h" | |
| 23 #include "components/user_manager/user_info.h" | 22 #include "components/user_manager/user_info.h" |
| 24 #include "grit/ash_resources.h" | 23 #include "grit/ash_resources.h" |
| 25 #include "grit/ash_strings.h" | 24 #include "grit/ash_strings.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 26 #include "ui/base/resource/resource_bundle.h" |
| 28 #include "ui/views/layout/fill_layout.h" | 27 #include "ui/views/layout/fill_layout.h" |
| 29 #include "ui/views/painter.h" | 28 #include "ui/views/painter.h" |
| 30 #include "ui/wm/core/shadow_types.h" | 29 #include "ui/wm/core/shadow_types.h" |
| 31 | 30 |
| 32 namespace ash { | 31 namespace ash { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (ash::Shell::GetInstance() | 70 if (ash::Shell::GetInstance() |
| 72 ->session_state_delegate() | 71 ->session_state_delegate() |
| 73 ->IsUserSessionBlocked()) | 72 ->IsUserSessionBlocked()) |
| 74 return; | 73 return; |
| 75 | 74 |
| 76 DCHECK(user_index > 0); | 75 DCHECK(user_index > 0); |
| 77 ash::SessionStateDelegate* delegate = | 76 ash::SessionStateDelegate* delegate = |
| 78 ash::Shell::GetInstance()->session_state_delegate(); | 77 ash::Shell::GetInstance()->session_state_delegate(); |
| 79 ash::MultiProfileUMA::RecordSwitchActiveUser( | 78 ash::MultiProfileUMA::RecordSwitchActiveUser( |
| 80 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); | 79 ash::MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY); |
| 81 delegate->SwitchActiveUser( | 80 delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetUserID()); |
| 82 delegate->GetUserInfo(user_index)->GetAccountId().GetUserEmail()); | |
| 83 } | 81 } |
| 84 | 82 |
| 85 class LogoutButton : public TrayPopupLabelButton { | 83 class LogoutButton : public TrayPopupLabelButton { |
| 86 public: | 84 public: |
| 87 // 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 |
| 88 // 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 |
| 89 // space, as if it was painted. | 87 // space, as if it was painted. |
| 90 LogoutButton(views::ButtonListener* listener, | 88 LogoutButton(views::ButtonListener* listener, |
| 91 const base::string16& text, | 89 const base::string16& text, |
| 92 bool placeholder) | 90 bool placeholder) |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 focus_manager_ = NULL; | 549 focus_manager_ = NULL; |
| 552 if (user_card_view_->GetFocusManager()) | 550 if (user_card_view_->GetFocusManager()) |
| 553 user_card_view_->GetFocusManager()->ClearFocus(); | 551 user_card_view_->GetFocusManager()->ClearFocus(); |
| 554 popup_message_.reset(); | 552 popup_message_.reset(); |
| 555 mouse_watcher_.reset(); | 553 mouse_watcher_.reset(); |
| 556 add_menu_option_.reset(); | 554 add_menu_option_.reset(); |
| 557 } | 555 } |
| 558 | 556 |
| 559 } // namespace tray | 557 } // namespace tray |
| 560 } // namespace ash | 558 } // namespace ash |
| OLD | NEW |