Chromium Code Reviews| Index: ash/common/system/user/tray_user.cc |
| diff --git a/ash/common/system/user/tray_user.cc b/ash/common/system/user/tray_user.cc |
| index bd35a469e065e3d1ccdceab42cabb98773366cef..95edc235009e06cf6c49ed03ff0c81f566f2f0db 100644 |
| --- a/ash/common/system/user/tray_user.cc |
| +++ b/ash/common/system/user/tray_user.cc |
| @@ -39,17 +39,10 @@ namespace ash { |
| TrayUser::TrayUser(SystemTray* system_tray, UserIndex index) |
| : SystemTrayItem(system_tray, UMA_USER), |
| - user_index_(index), |
| - user_(nullptr), |
| - layout_view_(nullptr), |
| - avatar_(nullptr), |
| - label_(nullptr) { |
| - Shell::Get()->system_tray_notifier()->AddUserObserver(this); |
| -} |
| + scoped_session_observer_(this), |
| + user_index_(index) {} |
| -TrayUser::~TrayUser() { |
| - Shell::Get()->system_tray_notifier()->RemoveUserObserver(this); |
| -} |
| +TrayUser::~TrayUser() {} |
| TrayUser::TestState TrayUser::GetStateForTest() const { |
| if (!user_) |
| @@ -218,11 +211,11 @@ void TrayUser::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
| } |
| } |
| -void TrayUser::OnUserUpdate() { |
| - UpdateAvatarImage(Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
| +void TrayUser::ActiveUserChanged(const AccountId& account_id) { |
| + UserSessionUpdated(account_id); |
| } |
| -void TrayUser::OnUserAddedToSession() { |
| +void TrayUser::UserAddedToSession(const AccountId& account_id) { |
| const SessionController* const session_controller = |
| Shell::Get()->session_controller(); |
| // Only create views for user items which are logged in. |
| @@ -236,6 +229,10 @@ void TrayUser::OnUserAddedToSession() { |
| UpdateAvatarImage(Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
| } |
| +void TrayUser::UserSessionUpdated(const AccountId& account_id) { |
| + UpdateAvatarImage(Shell::Get()->system_tray_delegate()->GetUserLoginStatus()); |
|
James Cook
2017/03/29 00:51:23
You have to use SystemTrayDelegate because Session
xiyuan
2017/03/29 20:45:30
Nope. Brain-dead copy. Changed to use SystemContro
|
| +} |
| + |
| void TrayUser::UpdateAvatarImage(LoginStatus status) { |
| const SessionController* const session_controller = |
| Shell::Get()->session_controller(); |