OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | |
6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | |
7 | |
8 #include "ash/public/interfaces/session_controller.mojom.h" | |
9 #include "base/macros.h" | |
10 #include "components/session_manager/core/session_manager_observer.h" | |
11 #include "components/user_manager/user_manager.h" | |
12 #include "mojo/public/cpp/bindings/binding.h" | |
13 | |
14 namespace ash { | |
15 enum class AddUserSessionPolicy; | |
16 } | |
17 | |
18 // Updates session state etc to ash via SessionControoler interface and handles | |
James Cook
2016/12/01 23:01:44
nit: SessionController
xiyuan
2016/12/06 00:46:34
Done.
| |
19 // session related calls from ash. | |
20 // TODO(xiyuan): Update when UserSessionStateObserver is gone. | |
21 class SessionControllerClient | |
22 : public ash::mojom::SessionControllerClient, | |
23 public user_manager::UserManager::UserSessionStateObserver, | |
24 public session_manager::SessionManagerObserver { | |
25 public: | |
26 SessionControllerClient(); | |
27 ~SessionControllerClient() override; | |
28 | |
29 static SessionControllerClient* Get(); | |
James Cook
2016/12/01 23:01:44
Is this used?
xiyuan
2016/12/06 00:46:34
Right. No longer needed and removed.
| |
30 | |
31 // ash::mojom::SessionControllerClient: | |
32 void RequestLockScreen() override; | |
33 void SwitchActiveUser(const std::string& serialized_account_id) override; | |
34 void CycleActiveUser(bool next_user) override; | |
35 | |
36 // user_manager::UserManager::UserSessionStateObserver: | |
37 void ActiveUserChanged(const user_manager::User* active_user) override; | |
38 void UserAddedToSession(const user_manager::User* added_user) override; | |
39 | |
40 // session_manager::SessionManagerObserver: | |
41 void OnSessionStateChanged() override; | |
42 | |
43 // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone. | |
44 static bool CanLockScreen(); | |
45 static bool ShouldLockScreenAutomatically(); | |
46 static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); | |
47 static void DoLockScreen(); | |
48 static void DoSwitchActiveUser(const AccountId& account_id); | |
49 static void DoCycleActiveUser(bool next_user); | |
50 | |
51 private: | |
52 // Connects or reconnects to the |session_controller_| interface and set | |
53 // this object as its client. | |
54 void ConnectToSessionControllerAndSetClient(); | |
55 | |
56 // Handles errors on |session_controller_| interface. | |
57 void OnClientConnectionError(); | |
58 | |
59 // Sends session info to ash. | |
60 void SendSessionInfo(); | |
61 | |
62 // Binds to the client interface. | |
63 mojo::Binding<ash::mojom::SessionControllerClient> binding_; | |
64 | |
65 // SessionController interface in ash. | |
66 ash::mojom::SessionControllerPtr session_controller_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); | |
69 }; | |
70 | |
71 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ | |
OLD | NEW |