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 ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ | |
6 #define ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ | |
7 | |
8 #include "ash/public/cpp/session_types.h" | |
9 #include "ash/public/interfaces/session_controller.mojom.h" | |
10 #include "base/macros.h" | |
11 #include "base/observer_list.h" | |
12 #include "mojo/public/cpp/bindings/binding_set.h" | |
13 | |
14 class AccountId; | |
15 | |
16 namespace ash { | |
17 | |
18 class SessionStateObserver; | |
19 | |
20 class SessionController : public mojom::SessionController { | |
James Cook
2016/12/01 23:01:43
Class comment please
xiyuan
2016/12/06 00:46:34
Done.
| |
21 public: | |
22 SessionController(); | |
23 ~SessionController() override; | |
24 | |
25 // Binds the mojom::SessionControllerRequest to this object. | |
26 void BindRequest(mojom::SessionControllerRequest request); | |
27 | |
28 // Replacement of SessionStateDelegate interface. | |
James Cook
2016/12/01 23:01:43
Move or duplicate the SessionStateDelegate functio
xiyuan
2016/12/06 00:46:34
Done.
| |
29 int GetMaximumNumberOfLoggedInUsers() const; | |
30 int NumberOfLoggedInUsers() const; | |
31 AddUserSessionPolicy GetAddUserPolicy() const; | |
32 bool IsActiveUserSessionStarted() const; | |
33 bool CanLockScreen() const; | |
34 bool IsScreenLocked() const; | |
35 bool ShouldLockScreenAutomatically() const; | |
36 bool IsUserSessionBlocked() const; | |
37 session_manager::SessionState GetSessionState() const; | |
38 const std::vector<mojom::UserSessionPtr>& GetUserSessions() const; | |
39 | |
40 void LockScreen(); | |
James Cook
2016/12/01 23:01:43
nit: Comment that these mirror or are wrappers aro
xiyuan
2016/12/06 00:46:34
Copied SessionStateDelegate comments to them.
| |
41 void SwitchActiveUser(const AccountId& account_id); | |
42 void CycleActiveUser(bool next_user); | |
43 | |
44 void AddSessionStateObserver(SessionStateObserver* observer); | |
45 void RemoveSessionStateObserver(SessionStateObserver* observer); | |
46 | |
47 // mojom::SessionController | |
48 void SetClient(mojom::SessionControllerClientPtr client) override; | |
49 void SetMaxUsers(uint32_t max_users) override; | |
50 void SetCanLockScreen(bool can_lock) override; | |
51 void SetShouldLockScreenAutomatically(bool should_lock) override; | |
52 void SetAddUserSessionPolicy( | |
53 AddUserSessionPolicy add_user_session_policy) override; | |
54 void SetSessionState(session_manager::SessionState state) override; | |
55 void SetUserSessions( | |
56 std::vector<mojom::UserSessionPtr> user_sessions) override; | |
57 | |
58 private: | |
59 // Bindings for mojom::SessionController interface. | |
60 mojo::BindingSet<mojom::SessionController> bindings_; | |
61 | |
62 // Client interface to Chrome. Only bound on Chrome OS. | |
James Cook
2016/12/01 23:01:43
nit: remove "Only bound on Chrome OS". I'm in the
xiyuan
2016/12/06 00:46:34
Done.
| |
63 mojom::SessionControllerClientPtr client_; | |
64 | |
65 // Cached session info. | |
66 uint32_t max_users_ = 0u; | |
James Cook
2016/12/01 23:01:43
#include <stdint.h>
or just use int, I'm not pick
xiyuan
2016/12/06 00:46:34
Done.
| |
67 bool can_lock_ = false; | |
68 bool should_lock_screen_automatically_ = false; | |
69 AddUserSessionPolicy add_user_session_policy_ = AddUserSessionPolicy::ALLOWED; | |
70 session_manager::SessionState state_ = session_manager::SessionState::UNKNOWN; | |
71 std::vector<mojom::UserSessionPtr> user_sessions_; | |
72 | |
73 base::ObserverList<ash::SessionStateObserver> observers_; | |
74 | |
75 DISALLOW_COPY_AND_ASSIGN(SessionController); | |
76 }; | |
77 | |
78 } // namespace ash | |
79 | |
80 #endif // ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ | |
OLD | NEW |