Chromium Code Reviews| Index: chrome/browser/ui/ash/session_controller_client.h |
| diff --git a/chrome/browser/ui/ash/session_controller_client.h b/chrome/browser/ui/ash/session_controller_client.h |
| index bad771a1b650b9366464487bfbd1f83e7d4bd08c..d4eef50739e2d34c7dcdf3284763c823e2e29a1c 100644 |
| --- a/chrome/browser/ui/ash/session_controller_client.h |
| +++ b/chrome/browser/ui/ash/session_controller_client.h |
| @@ -7,13 +7,17 @@ |
| #include "ash/public/interfaces/session_controller.mojom.h" |
| #include "base/callback_forward.h" |
| +#include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| +#include "chrome/browser/supervised_user/supervised_user_service_observer.h" |
| #include "components/session_manager/core/session_manager_observer.h" |
| #include "components/user_manager/user_manager.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| #include "mojo/public/cpp/bindings/binding.h" |
| +class Profile; |
| + |
| namespace ash { |
| enum class AddUserSessionPolicy; |
| } |
| @@ -30,11 +34,14 @@ class SessionControllerClient |
| public user_manager::UserManager::UserSessionStateObserver, |
| public user_manager::UserManager::Observer, |
| public session_manager::SessionManagerObserver, |
| + public SupervisedUserServiceObserver, |
| public content::NotificationObserver { |
| public: |
| SessionControllerClient(); |
| ~SessionControllerClient() override; |
| + void Init(); |
| + |
| static SessionControllerClient* Get(); |
| // Calls SessionController to start locking ash. |callback| will be invoked |
| @@ -64,6 +71,9 @@ class SessionControllerClient |
| // session_manager::SessionManagerObserver: |
| void OnSessionStateChanged() override; |
| + // SupervisedUserServiceObserver: |
| + void OnCustodianInfoChanged() override; |
| + |
| // content::NotificationObserver: |
| void Observe(int type, |
| const content::NotificationSource& source, |
| @@ -81,9 +91,13 @@ class SessionControllerClient |
| static void FlushForTesting(); |
| private: |
| - // Connects or reconnects to the |session_controller_| interface and set |
| - // this object as its client. |
| - void ConnectToSessionControllerAndSetClient(); |
| + FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); |
| + |
| + // Called when the login profile is ready. |
| + void OnLoginUserProfilePrepared(Profile* profile); |
| + |
| + // Connects to the |session_controller_| interface. |
| + void ConnectToSessionController(); |
| // Sends session info to ash. |
| void SendSessionInfoIfChanged(); |
| @@ -91,6 +105,9 @@ class SessionControllerClient |
| // Sends the user session info. |
| void SendUserSession(const user_manager::User& user); |
| + // Sends an update for the active user session. |
| + void SendActiveUserSession(); |
| + |
| // Sends the order of user sessions to ash. |
| void SendUserSessionOrder(); |
| @@ -103,7 +120,9 @@ class SessionControllerClient |
| // Whether the primary user session info is sent to ash. |
| bool primary_user_session_sent_ = false; |
| - // For observing NOTIFICATION_APP_TERMINATING. |
| + // Profile for the logged-in user. |
| + Profile* login_profile_ = nullptr; |
|
xiyuan
2017/04/21 23:14:35
login_profile_ -> user_profile_ to match other pla
xiyuan
2017/04/21 23:14:35
How would this work with multi-profile? We might n
James Cook
2017/04/24 17:47:26
How does this look?
Alternately, I could create a
xiyuan
2017/04/24 18:10:09
Having a single |supervised_user_profile_| is okay
|
| + |
| content::NotificationRegistrar registrar_; |
| ash::mojom::SessionInfoPtr last_sent_session_info_; |