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..7dc91e18d937bd77cd2d968948a623596dd7c1f6 100644 |
--- a/chrome/browser/ui/ash/session_controller_client.h |
+++ b/chrome/browser/ui/ash/session_controller_client.h |
@@ -7,13 +7,18 @@ |
#include "ash/public/interfaces/session_controller.mojom.h" |
#include "base/callback_forward.h" |
+#include "base/gtest_prod_util.h" |
#include "base/macros.h" |
+#include "base/memory/weak_ptr.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 +35,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 +72,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 +92,16 @@ 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); |
+ |
+ // Sends the user session info for a given profile. |
+ void SendUserSessionForProfile(Profile* profile); |
+ |
+ // Connects to the |session_controller_| interface. |
+ void ConnectToSessionController(); |
// Sends session info to ash. |
void SendSessionInfoIfChanged(); |
@@ -103,11 +121,16 @@ class SessionControllerClient |
// Whether the primary user session info is sent to ash. |
bool primary_user_session_sent_ = false; |
- // For observing NOTIFICATION_APP_TERMINATING. |
+ // If the session is for a supervised user, the profile of that user. |
+ // Chrome OS only supports a single supervised user in a session. |
+ Profile* supervised_user_profile_ = nullptr; |
+ |
content::NotificationRegistrar registrar_; |
ash::mojom::SessionInfoPtr last_sent_session_info_; |
+ base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
}; |