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

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

Issue 2780963002: ash: Fix system tray avatar not updated regression (Closed)
Patch Set: add a test 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
Index: ash/common/system/user/tray_user.h
diff --git a/ash/common/system/user/tray_user.h b/ash/common/system/user/tray_user.h
index 2b3573d7f0c237d8bd7cf830516bc2edb677e3fe..f3a5cdc5552048d6cc31d99f7c44246adad92109 100644
--- a/ash/common/system/user/tray_user.h
+++ b/ash/common/system/user/tray_user.h
@@ -6,8 +6,8 @@
#define ASH_COMMON_SYSTEM_USER_TRAY_USER_H_
#include "ash/ash_export.h"
+#include "ash/common/session/session_state_observer.h"
#include "ash/common/system/tray/system_tray_item.h"
-#include "ash/common/system/user/user_observer.h"
#include "ash/public/cpp/session_types.h"
#include "base/macros.h"
@@ -27,7 +27,7 @@ class RoundedImageView;
class UserView;
}
-class ASH_EXPORT TrayUser : public SystemTrayItem, public UserObserver {
+class ASH_EXPORT TrayUser : public SystemTrayItem, public SessionStateObserver {
public:
// The given |index| is the user index in a multi profile scenario. Index #0
// is the active user, the other indices are other logged in users (if there
@@ -58,6 +58,7 @@ class ASH_EXPORT TrayUser : public SystemTrayItem, public UserObserver {
// Use for access inside of tests.
tray::UserView* user_view_for_test() const { return user_; }
+ tray::RoundedImageView* avatar_view_for_test() const { return avatar_; }
private:
// Overridden from SystemTrayItem.
@@ -68,24 +69,27 @@ class ASH_EXPORT TrayUser : public SystemTrayItem, public UserObserver {
void UpdateAfterLoginStatusChange(LoginStatus status) override;
void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override;
- // Overridden from UserObserver.
- void OnUserUpdate() override;
- void OnUserAddedToSession() override;
+ // Overridden from SessionStateObserver.
+ void ActiveUserChanged(const AccountId& account_id) override;
+ void UserAddedToSession(const AccountId& account_id) override;
+ void UserSessionUpdated(const AccountId& account_id) override;
void UpdateAvatarImage(LoginStatus status);
// Updates the layout of this item.
void UpdateLayoutOfItem();
+ ScopedSessionStateObserver scoped_session_observer_;
+
// The user index to use.
- UserIndex user_index_;
+ const UserIndex user_index_;
- tray::UserView* user_;
+ tray::UserView* user_ = nullptr;
// View that contains label and/or avatar.
- views::View* layout_view_;
- tray::RoundedImageView* avatar_;
- views::Label* label_;
+ views::View* layout_view_ = nullptr;
+ tray::RoundedImageView* avatar_ = nullptr;
+ views::Label* label_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(TrayUser);
};

Powered by Google App Engine
This is Rietveld 408576698