Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(743)

Unified Diff: ash/common/system/user/tray_user.cc

Issue 2780963002: ash: Fix system tray avatar not updated regression (Closed)
Patch Set: resized_ -> resized_image_ Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/user/tray_user.h ('k') | ash/common/system/user/tray_user_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..bf045b9a708cde237bbc32392bede7d85c1f1b27 100644
--- a/ash/common/system/user/tray_user.cc
+++ b/ash/common/system/user/tray_user.cc
@@ -8,7 +8,6 @@
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/system/tray/system_tray.h"
#include "ash/common/system/tray/system_tray_delegate.h"
-#include "ash/common/system/tray/system_tray_notifier.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_item_view.h"
#include "ash/common/system/tray/tray_utils.h"
@@ -39,17 +38,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 +210,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.
@@ -233,7 +225,11 @@ void TrayUser::OnUserAddedToSession() {
UpdateLayoutOfItem();
// Update the user item.
- UpdateAvatarImage(Shell::Get()->system_tray_delegate()->GetUserLoginStatus());
+ UpdateAvatarImage(Shell::Get()->session_controller()->GetLoginStatus());
+}
+
+void TrayUser::UserSessionUpdated(const AccountId& account_id) {
+ UpdateAvatarImage(Shell::Get()->session_controller()->GetLoginStatus());
}
void TrayUser::UpdateAvatarImage(LoginStatus status) {
« no previous file with comments | « ash/common/system/user/tray_user.h ('k') | ash/common/system/user/tray_user_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698