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/macros.h" | 9 #include "base/macros.h" |
10 #include "components/session_manager/core/session_manager_observer.h" | 10 #include "components/session_manager/core/session_manager_observer.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 void OnSessionStateChanged() override; | 43 void OnSessionStateChanged() override; |
44 | 44 |
45 // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone. | 45 // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone. |
46 static bool CanLockScreen(); | 46 static bool CanLockScreen(); |
47 static bool ShouldLockScreenAutomatically(); | 47 static bool ShouldLockScreenAutomatically(); |
48 static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); | 48 static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); |
49 static void DoLockScreen(); | 49 static void DoLockScreen(); |
50 static void DoSwitchActiveUser(const AccountId& account_id); | 50 static void DoSwitchActiveUser(const AccountId& account_id); |
51 static void DoCycleActiveUser(bool next_user); | 51 static void DoCycleActiveUser(bool next_user); |
52 | 52 |
| 53 // Flushes the mojo pipe to ash. |
| 54 static void FlushForTesting(); |
| 55 |
53 private: | 56 private: |
54 // Connects or reconnects to the |session_controller_| interface and set | 57 // Connects or reconnects to the |session_controller_| interface and set |
55 // this object as its client. | 58 // this object as its client. |
56 void ConnectToSessionControllerAndSetClient(); | 59 void ConnectToSessionControllerAndSetClient(); |
57 | 60 |
58 // Sends session info to ash. | 61 // Sends session info to ash. |
59 void SendSessionInfoIfChanged(); | 62 void SendSessionInfoIfChanged(); |
60 | 63 |
61 // Sends the user session info. | 64 // Sends the user session info. |
62 void SendUserSession(const user_manager::User& user); | 65 void SendUserSession(const user_manager::User& user); |
63 | 66 |
64 // Sends the order of user sessions to ash. | 67 // Sends the order of user sessions to ash. |
65 void SendUserSessionOrder(); | 68 void SendUserSessionOrder(); |
66 | 69 |
67 // Binds to the client interface. | 70 // Binds to the client interface. |
68 mojo::Binding<ash::mojom::SessionControllerClient> binding_; | 71 mojo::Binding<ash::mojom::SessionControllerClient> binding_; |
69 | 72 |
70 // SessionController interface in ash. | 73 // SessionController interface in ash. |
71 ash::mojom::SessionControllerPtr session_controller_; | 74 ash::mojom::SessionControllerPtr session_controller_; |
72 | 75 |
73 // Whether the primary user session info is sent to ash. | 76 // Whether the primary user session info is sent to ash. |
74 bool primary_user_session_sent_ = false; | 77 bool primary_user_session_sent_ = false; |
75 | 78 |
76 ash::mojom::SessionInfoPtr last_sent_session_info_; | 79 ash::mojom::SessionInfoPtr last_sent_session_info_; |
77 | 80 |
78 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); | 81 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
79 }; | 82 }; |
80 | 83 |
81 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 84 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
OLD | NEW |