| 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 484c2c18e06e0bf3a01782f7ded4789a66e5e404..d41a2c85480b031dd0ad97c7b65ed26863ee35bf 100644
|
| --- a/chrome/browser/ui/ash/session_controller_client.h
|
| +++ b/chrome/browser/ui/ash/session_controller_client.h
|
| @@ -5,13 +5,22 @@
|
| #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
|
| #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
|
|
|
| +#include <vector>
|
| +
|
| #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 "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;
|
| +class PrefChangeRegistrar;
|
| +
|
| namespace ash {
|
| enum class AddUserSessionPolicy;
|
| }
|
| @@ -27,11 +36,14 @@ class SessionControllerClient
|
| : public ash::mojom::SessionControllerClient,
|
| public user_manager::UserManager::UserSessionStateObserver,
|
| public user_manager::UserManager::Observer,
|
| - public session_manager::SessionManagerObserver {
|
| + public session_manager::SessionManagerObserver,
|
| + public content::NotificationObserver {
|
| public:
|
| SessionControllerClient();
|
| ~SessionControllerClient() override;
|
|
|
| + void Init();
|
| +
|
| static SessionControllerClient* Get();
|
|
|
| // Calls ash SessionController to run unlock animation.
|
| @@ -54,6 +66,11 @@ class SessionControllerClient
|
| // session_manager::SessionManagerObserver:
|
| void OnSessionStateChanged() override;
|
|
|
| + // content::NotificationObserver:
|
| + void Observe(int type,
|
| + const content::NotificationSource& source,
|
| + const content::NotificationDetails& details) override;
|
| +
|
| // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone.
|
| static bool CanLockScreen();
|
| static bool ShouldLockScreenAutomatically();
|
| @@ -66,9 +83,15 @@ 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, SendUserSession);
|
| + FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser);
|
| + FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, UserPrefsChange);
|
| +
|
| + // 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();
|
| @@ -88,8 +111,18 @@ class SessionControllerClient
|
| // Whether the primary user session info is sent to ash.
|
| bool primary_user_session_sent_ = false;
|
|
|
| + content::NotificationRegistrar registrar_;
|
| +
|
| + // Pref change observers to update session info when a relevant user pref
|
| + // changes. There is one observer per user and they have no particular order,
|
| + // i.e. they don't much the user session order.
|
| + std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_change_registrars_;
|
| +
|
| + // Used to suppress duplicate IPCs to ash.
|
| ash::mojom::SessionInfoPtr last_sent_session_info_;
|
|
|
| + base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(SessionControllerClient);
|
| };
|
|
|
|
|