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

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

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase to get WorkspaceLayoutManagerSoloTest change 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/login_status.cc ('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 65379215aa98c15b956c319576d3be1e62ab305c..0bc7efea6ac44467f97cd89fcbfa77f742198eeb 100644
--- a/ash/common/system/user/tray_user.cc
+++ b/ash/common/system/user/tray_user.cc
@@ -4,7 +4,7 @@
#include "ash/common/system/user/tray_user.h"
-#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/session/session_controller.h"
#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"
@@ -80,18 +80,18 @@ views::View* TrayUser::CreateTrayView(LoginStatus status) {
views::View* TrayUser::CreateDefaultView(LoginStatus status) {
if (status == LoginStatus::NOT_LOGGED_IN)
return nullptr;
- const SessionStateDelegate* session_state_delegate =
- WmShell::Get()->GetSessionStateDelegate();
+ const SessionController* const session_controller =
+ WmShell::Get()->session_controller();
// If the screen is locked or a system modal dialog box is shown, show only
// the currently active user.
- if (user_index_ && (session_state_delegate->IsUserSessionBlocked() ||
+ if (user_index_ && (session_controller->IsUserSessionBlocked() ||
WmShell::Get()->IsSystemModalWindowOpen()))
return nullptr;
CHECK(user_ == nullptr);
- int logged_in_users = session_state_delegate->NumberOfLoggedInUsers();
+ int logged_in_users = session_controller->NumberOfLoggedInUsers();
// Do not show more UserView's then there are logged in users.
if (user_index_ >= logged_in_users)
@@ -223,10 +223,10 @@ void TrayUser::OnUserUpdate() {
}
void TrayUser::OnUserAddedToSession() {
- SessionStateDelegate* session_state_delegate =
- WmShell::Get()->GetSessionStateDelegate();
+ const SessionController* const session_controller =
+ WmShell::Get()->session_controller();
// Only create views for user items which are logged in.
- if (user_index_ >= session_state_delegate->NumberOfLoggedInUsers())
+ if (user_index_ >= session_controller->NumberOfLoggedInUsers())
return;
// Enforce a layout change that newly added items become visible.
@@ -238,16 +238,16 @@ void TrayUser::OnUserAddedToSession() {
}
void TrayUser::UpdateAvatarImage(LoginStatus status) {
- SessionStateDelegate* session_state_delegate =
- WmShell::Get()->GetSessionStateDelegate();
- if (!avatar_ ||
- user_index_ >= session_state_delegate->NumberOfLoggedInUsers())
+ const SessionController* const session_controller =
+ WmShell::Get()->session_controller();
+ if (!avatar_ || user_index_ >= session_controller->NumberOfLoggedInUsers())
return;
- const user_manager::UserInfo* user_info =
- session_state_delegate->GetUserInfo(user_index_);
- CHECK(user_info);
- avatar_->SetImage(user_info->GetImage(),
+ const mojom::UserSession* const user_session =
+ session_controller->GetUserSession(user_index_);
+ CHECK(user_session);
+ // TODO(xiyuan); HiDpi avatar support. http://crbug.com/702689
+ avatar_->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(user_session->avatar),
gfx::Size(kTrayItemSize, kTrayItemSize));
// Unit tests might come here with no images for some users.
« no previous file with comments | « ash/common/system/user/login_status.cc ('k') | ash/common/system/user/tray_user_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698