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 "ash/public/interfaces/session_controller.mojom.h" | 8 #include "ash/public/interfaces/session_controller.mojom.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 static bool ShouldLockScreenAutomatically(); | 88 static bool ShouldLockScreenAutomatically(); |
89 static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); | 89 static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); |
90 static void DoLockScreen(); | 90 static void DoLockScreen(); |
91 static void DoSwitchActiveUser(const AccountId& account_id); | 91 static void DoSwitchActiveUser(const AccountId& account_id); |
92 static void DoCycleActiveUser(ash::CycleUserDirection direction); | 92 static void DoCycleActiveUser(ash::CycleUserDirection direction); |
93 | 93 |
94 // Flushes the mojo pipe to ash. | 94 // Flushes the mojo pipe to ash. |
95 static void FlushForTesting(); | 95 static void FlushForTesting(); |
96 | 96 |
97 private: | 97 private: |
| 98 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SendUserSession); |
98 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); | 99 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); |
99 | 100 |
100 // Called when the login profile is ready. | 101 // Called when the login profile is ready. |
101 void OnLoginUserProfilePrepared(Profile* profile); | 102 void OnLoginUserProfilePrepared(Profile* profile); |
102 | 103 |
103 // Sends the user session info for a given profile. | 104 // Sends the user session info for a given profile. |
104 void SendUserSessionForProfile(Profile* profile); | 105 void SendUserSessionForProfile(Profile* profile); |
105 | 106 |
106 // Connects to the |session_controller_| interface. | 107 // Connects to the |session_controller_| interface. |
107 void ConnectToSessionController(); | 108 void ConnectToSessionController(); |
(...skipping 15 matching lines...) Expand all Loading... |
123 | 124 |
124 // Whether the primary user session info is sent to ash. | 125 // Whether the primary user session info is sent to ash. |
125 bool primary_user_session_sent_ = false; | 126 bool primary_user_session_sent_ = false; |
126 | 127 |
127 // If the session is for a supervised user, the profile of that user. | 128 // If the session is for a supervised user, the profile of that user. |
128 // Chrome OS only supports a single supervised user in a session. | 129 // Chrome OS only supports a single supervised user in a session. |
129 Profile* supervised_user_profile_ = nullptr; | 130 Profile* supervised_user_profile_ = nullptr; |
130 | 131 |
131 content::NotificationRegistrar registrar_; | 132 content::NotificationRegistrar registrar_; |
132 | 133 |
| 134 // Used to suppress duplicate IPCs to ash. |
133 ash::mojom::SessionInfoPtr last_sent_session_info_; | 135 ash::mojom::SessionInfoPtr last_sent_session_info_; |
| 136 ash::mojom::UserSessionPtr last_sent_user_session_; |
134 | 137 |
135 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; | 138 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; |
136 | 139 |
137 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); | 140 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
138 }; | 141 }; |
139 | 142 |
140 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 143 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
OLD | NEW |