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

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

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase 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/user_view.cc
diff --git a/ash/common/system/user/user_view.cc b/ash/common/system/user/user_view.cc
index a21dff09c2eef865eb59bd8f5243ec9ee1f2f9c4..b4e10ead3a3e1d046645fd6460eb022942967d2b 100644
--- a/ash/common/system/user/user_view.cc
+++ b/ash/common/system/user/user_view.cc
@@ -8,7 +8,7 @@
#include <utility>
#include "ash/common/multi_profile_uma.h"
-#include "ash/common/session/session_state_delegate.h"
+#include "ash/common/session/session_controller.h"
#include "ash/common/shell_delegate.h"
#include "ash/common/system/tray/system_tray.h"
#include "ash/common/system/tray/system_tray_controller.h"
@@ -50,19 +50,20 @@ namespace {
// Switch to a user with the given |user_index|.
void SwitchUser(UserIndex user_index) {
// Do not switch users when the log screen is presented.
- SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate();
- if (delegate->IsUserSessionBlocked())
+ SessionController* controller = WmShell::Get()->session_controller();
+ if (controller->IsUserSessionBlocked())
return;
DCHECK(user_index > 0);
James Cook 2017/03/17 17:14:35 nit: Also DCHECK less than session count
xiyuan 2017/03/17 22:52:02 Done. And added comment of why 0 is excluded.
MultiProfileUMA::RecordSwitchActiveUser(
MultiProfileUMA::SWITCH_ACTIVE_USER_BY_TRAY);
- delegate->SwitchActiveUser(delegate->GetUserInfo(user_index)->GetAccountId());
+ controller->SwitchActiveUser(
+ controller->GetUserSessions()[user_index]->account_id);
}
bool IsMultiProfileSupportedAndUserActive() {
return Shell::Get()->shell_delegate()->IsMultiProfilesEnabled() &&
- !WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked();
+ !WmShell::Get()->session_controller()->IsUserSessionBlocked();
}
// Creates the view shown in the user switcher popup ("AddUserMenuOption").
@@ -345,10 +346,8 @@ void UserView::ToggleAddUserMenuOption() {
&params);
add_menu_option_->Init(params);
- const SessionStateDelegate* delegate =
- WmShell::Get()->GetSessionStateDelegate();
const AddUserSessionPolicy add_user_policy =
- delegate->GetAddUserSessionPolicy();
+ WmShell::Get()->session_controller()->GetAddUserPolicy();
add_user_enabled_ = add_user_policy == AddUserSessionPolicy::ALLOWED;
// Position the widget on top of the user card view (which is still in the

Powered by Google App Engine
This is Rietveld 408576698