Index: chrome/browser/ui/ash/session_controller_client.cc |
diff --git a/chrome/browser/ui/ash/session_controller_client.cc b/chrome/browser/ui/ash/session_controller_client.cc |
index b171cf2fb7707f3345cb3223abd6af7582f7aaee..fad60d44bd2d2948fd93239636db007fd33bbb8a 100644 |
--- a/chrome/browser/ui/ash/session_controller_client.cc |
+++ b/chrome/browser/ui/ash/session_controller_client.cc |
@@ -34,6 +34,8 @@ using user_manager::UserList; |
namespace { |
+SessionControllerClient* g_instance = nullptr; |
+ |
uint32_t GetSessionId(const User* user) { |
const UserList logged_in_users = UserManager::Get()->GetLoggedInUsers(); |
// TODO(xiyuan): Update with real session id when user session tracking |
@@ -83,9 +85,15 @@ SessionControllerClient::SessionControllerClient() : binding_(this) { |
SendSessionInfoIfChanged(); |
// User sessions and their order will be sent via UserSessionStateObserver |
// even for crash-n-restart. |
+ |
+ DCHECK(!g_instance); |
+ g_instance = this; |
} |
SessionControllerClient::~SessionControllerClient() { |
+ DCHECK_EQ(this, g_instance); |
+ g_instance = nullptr; |
+ |
SessionManager::Get()->RemoveObserver(this); |
UserManager::Get()->RemoveSessionStateObserver(this); |
} |
@@ -225,6 +233,11 @@ void SessionControllerClient::DoCycleActiveUser(bool next_user) { |
DoSwitchActiveUser(account_id); |
} |
+// static |
+void SessionControllerClient::FlushForTesting() { |
+ g_instance->session_controller_.FlushForTesting(); |
+} |
+ |
void SessionControllerClient::OnSessionStateChanged() { |
SendSessionInfoIfChanged(); |
} |