| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
| 6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/public/interfaces/session_controller.mojom.h" | 10 #include "ash/public/interfaces/session_controller.mojom.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 static void DoSwitchActiveUser(const AccountId& account_id); | 94 static void DoSwitchActiveUser(const AccountId& account_id); |
| 95 static void DoCycleActiveUser(ash::CycleUserDirection direction); | 95 static void DoCycleActiveUser(ash::CycleUserDirection direction); |
| 96 | 96 |
| 97 // Flushes the mojo pipe to ash. | 97 // Flushes the mojo pipe to ash. |
| 98 static void FlushForTesting(); | 98 static void FlushForTesting(); |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SendUserSession); | 101 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SendUserSession); |
| 102 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); | 102 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); |
| 103 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, UserPrefsChange); | 103 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, UserPrefsChange); |
| 104 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SessionLengthLimit); |
| 104 | 105 |
| 105 // Called when the login profile is ready. | 106 // Called when the login profile is ready. |
| 106 void OnLoginUserProfilePrepared(Profile* profile); | 107 void OnLoginUserProfilePrepared(Profile* profile); |
| 107 | 108 |
| 108 // Sends the user session info for a given profile. | 109 // Sends the user session info for a given profile. |
| 109 void SendUserSessionForProfile(Profile* profile); | 110 void SendUserSessionForProfile(Profile* profile); |
| 110 | 111 |
| 111 // Connects to the |session_controller_| interface. | 112 // Connects to the |session_controller_| interface. |
| 112 void ConnectToSessionController(); | 113 void ConnectToSessionController(); |
| 113 | 114 |
| 114 // Sends session info to ash. | 115 // Sends session info to ash. |
| 115 void SendSessionInfoIfChanged(); | 116 void SendSessionInfoIfChanged(); |
| 116 | 117 |
| 117 // Sends the user session info. | 118 // Sends the user session info. |
| 118 void SendUserSession(const user_manager::User& user); | 119 void SendUserSession(const user_manager::User& user); |
| 119 | 120 |
| 120 // Sends the order of user sessions to ash. | 121 // Sends the order of user sessions to ash. |
| 121 void SendUserSessionOrder(); | 122 void SendUserSessionOrder(); |
| 122 | 123 |
| 124 // Sends the session length time limit to ash. |
| 125 void SendSessionLengthLimit(); |
| 126 |
| 123 // Binds to the client interface. | 127 // Binds to the client interface. |
| 124 mojo::Binding<ash::mojom::SessionControllerClient> binding_; | 128 mojo::Binding<ash::mojom::SessionControllerClient> binding_; |
| 125 | 129 |
| 126 // SessionController interface in ash. | 130 // SessionController interface in ash. |
| 127 ash::mojom::SessionControllerPtr session_controller_; | 131 ash::mojom::SessionControllerPtr session_controller_; |
| 128 | 132 |
| 129 // Whether the primary user session info is sent to ash. | 133 // Whether the primary user session info is sent to ash. |
| 130 bool primary_user_session_sent_ = false; | 134 bool primary_user_session_sent_ = false; |
| 131 | 135 |
| 132 // If the session is for a supervised user, the profile of that user. | 136 // If the session is for a supervised user, the profile of that user. |
| 133 // Chrome OS only supports a single supervised user in a session. | 137 // Chrome OS only supports a single supervised user in a session. |
| 134 Profile* supervised_user_profile_ = nullptr; | 138 Profile* supervised_user_profile_ = nullptr; |
| 135 | 139 |
| 136 content::NotificationRegistrar registrar_; | 140 content::NotificationRegistrar registrar_; |
| 137 | 141 |
| 138 // Pref change observers to update session info when a relevant user pref | 142 // Pref change observers to update session info when a relevant user pref |
| 139 // changes. There is one observer per user and they have no particular order, | 143 // changes. There is one observer per user and they have no particular order, |
| 140 // i.e. they don't much the user session order. | 144 // i.e. they don't much the user session order. |
| 141 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_change_registrars_; | 145 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_change_registrars_; |
| 142 | 146 |
| 147 // Observes changes to Local State prefs. |
| 148 std::unique_ptr<PrefChangeRegistrar> local_state_registrar_; |
| 149 |
| 143 // Used to suppress duplicate IPCs to ash. | 150 // Used to suppress duplicate IPCs to ash. |
| 144 ash::mojom::SessionInfoPtr last_sent_session_info_; | 151 ash::mojom::SessionInfoPtr last_sent_session_info_; |
| 145 ash::mojom::UserSessionPtr last_sent_user_session_; | 152 ash::mojom::UserSessionPtr last_sent_user_session_; |
| 146 | 153 |
| 147 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; | 154 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; |
| 148 | 155 |
| 149 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); | 156 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
| 150 }; | 157 }; |
| 151 | 158 |
| 152 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 159 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
| OLD | NEW |