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 | |
56 private: | 53 private: |
57 // Connects or reconnects to the |session_controller_| interface and set | 54 // Connects or reconnects to the |session_controller_| interface and set |
58 // this object as its client. | 55 // this object as its client. |
59 void ConnectToSessionControllerAndSetClient(); | 56 void ConnectToSessionControllerAndSetClient(); |
60 | 57 |
61 // Sends session info to ash. | 58 // Sends session info to ash. |
62 void SendSessionInfoIfChanged(); | 59 void SendSessionInfoIfChanged(); |
63 | 60 |
64 // Sends the user session info. | 61 // Sends the user session info. |
65 void SendUserSession(const user_manager::User& user); | 62 void SendUserSession(const user_manager::User& user); |
66 | 63 |
67 // Sends the order of user sessions to ash. | 64 // Sends the order of user sessions to ash. |
68 void SendUserSessionOrder(); | 65 void SendUserSessionOrder(); |
69 | 66 |
70 // Binds to the client interface. | 67 // Binds to the client interface. |
71 mojo::Binding<ash::mojom::SessionControllerClient> binding_; | 68 mojo::Binding<ash::mojom::SessionControllerClient> binding_; |
72 | 69 |
73 // SessionController interface in ash. | 70 // SessionController interface in ash. |
74 ash::mojom::SessionControllerPtr session_controller_; | 71 ash::mojom::SessionControllerPtr session_controller_; |
75 | 72 |
76 // Whether the primary user session info is sent to ash. | 73 // Whether the primary user session info is sent to ash. |
77 bool primary_user_session_sent_ = false; | 74 bool primary_user_session_sent_ = false; |
78 | 75 |
79 ash::mojom::SessionInfoPtr last_sent_session_info_; | 76 ash::mojom::SessionInfoPtr last_sent_session_info_; |
80 | 77 |
81 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); | 78 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
82 }; | 79 }; |
83 | 80 |
84 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | 81 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
OLD | NEW |