Chromium Code Reviews| Index: ash/common/session/session_controller.h |
| diff --git a/ash/common/session/session_controller.h b/ash/common/session/session_controller.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0deca323f89caa0e5115f049a44bd74536dc391d |
| --- /dev/null |
| +++ b/ash/common/session/session_controller.h |
| @@ -0,0 +1,80 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ |
| +#define ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ |
| + |
| +#include "ash/public/cpp/session_types.h" |
| +#include "ash/public/interfaces/session_controller.mojom.h" |
| +#include "base/macros.h" |
| +#include "base/observer_list.h" |
| +#include "mojo/public/cpp/bindings/binding_set.h" |
| + |
| +class AccountId; |
| + |
| +namespace ash { |
| + |
| +class SessionStateObserver; |
| + |
| +class SessionController : public mojom::SessionController { |
|
James Cook
2016/12/01 23:01:43
Class comment please
xiyuan
2016/12/06 00:46:34
Done.
|
| + public: |
| + SessionController(); |
| + ~SessionController() override; |
| + |
| + // Binds the mojom::SessionControllerRequest to this object. |
| + void BindRequest(mojom::SessionControllerRequest request); |
| + |
| + // 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.
|
| + int GetMaximumNumberOfLoggedInUsers() const; |
| + int NumberOfLoggedInUsers() const; |
| + AddUserSessionPolicy GetAddUserPolicy() const; |
| + bool IsActiveUserSessionStarted() const; |
| + bool CanLockScreen() const; |
| + bool IsScreenLocked() const; |
| + bool ShouldLockScreenAutomatically() const; |
| + bool IsUserSessionBlocked() const; |
| + session_manager::SessionState GetSessionState() const; |
| + const std::vector<mojom::UserSessionPtr>& GetUserSessions() const; |
| + |
| + 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.
|
| + void SwitchActiveUser(const AccountId& account_id); |
| + void CycleActiveUser(bool next_user); |
| + |
| + void AddSessionStateObserver(SessionStateObserver* observer); |
| + void RemoveSessionStateObserver(SessionStateObserver* observer); |
| + |
| + // mojom::SessionController |
| + void SetClient(mojom::SessionControllerClientPtr client) override; |
| + void SetMaxUsers(uint32_t max_users) override; |
| + void SetCanLockScreen(bool can_lock) override; |
| + void SetShouldLockScreenAutomatically(bool should_lock) override; |
| + void SetAddUserSessionPolicy( |
| + AddUserSessionPolicy add_user_session_policy) override; |
| + void SetSessionState(session_manager::SessionState state) override; |
| + void SetUserSessions( |
| + std::vector<mojom::UserSessionPtr> user_sessions) override; |
| + |
| + private: |
| + // Bindings for mojom::SessionController interface. |
| + mojo::BindingSet<mojom::SessionController> bindings_; |
| + |
| + // 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.
|
| + mojom::SessionControllerClientPtr client_; |
| + |
| + // Cached session info. |
| + 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.
|
| + bool can_lock_ = false; |
| + bool should_lock_screen_automatically_ = false; |
| + AddUserSessionPolicy add_user_session_policy_ = AddUserSessionPolicy::ALLOWED; |
| + session_manager::SessionState state_ = session_manager::SessionState::UNKNOWN; |
| + std::vector<mojom::UserSessionPtr> user_sessions_; |
| + |
| + base::ObserverList<ash::SessionStateObserver> observers_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SessionController); |
| +}; |
| + |
| +} // namespace ash |
| + |
| +#endif // ASH_COMMON_SESSION_SESSION_CONTROLLER_H_ |