Chromium Code Reviews| Index: chrome/browser/ui/ash/session_controller_client.h |
| diff --git a/chrome/browser/ui/ash/session_controller_client.h b/chrome/browser/ui/ash/session_controller_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8be69bdce18bf278b4122a3912dfe1f8ec910637 |
| --- /dev/null |
| +++ b/chrome/browser/ui/ash/session_controller_client.h |
| @@ -0,0 +1,71 @@ |
| +// 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 CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
| +#define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |
| + |
| +#include "ash/public/interfaces/session_controller.mojom.h" |
| +#include "base/macros.h" |
| +#include "components/session_manager/core/session_manager_observer.h" |
| +#include "components/user_manager/user_manager.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
| + |
| +namespace ash { |
| +enum class AddUserSessionPolicy; |
| +} |
| + |
| +// 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.
|
| +// session related calls from ash. |
| +// TODO(xiyuan): Update when UserSessionStateObserver is gone. |
| +class SessionControllerClient |
| + : public ash::mojom::SessionControllerClient, |
| + public user_manager::UserManager::UserSessionStateObserver, |
| + public session_manager::SessionManagerObserver { |
| + public: |
| + SessionControllerClient(); |
| + ~SessionControllerClient() override; |
| + |
| + 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.
|
| + |
| + // ash::mojom::SessionControllerClient: |
| + void RequestLockScreen() override; |
| + void SwitchActiveUser(const std::string& serialized_account_id) override; |
| + void CycleActiveUser(bool next_user) override; |
| + |
| + // user_manager::UserManager::UserSessionStateObserver: |
| + void ActiveUserChanged(const user_manager::User* active_user) override; |
| + void UserAddedToSession(const user_manager::User* added_user) override; |
| + |
| + // session_manager::SessionManagerObserver: |
| + void OnSessionStateChanged() override; |
| + |
| + // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone. |
| + static bool CanLockScreen(); |
| + static bool ShouldLockScreenAutomatically(); |
| + static ash::AddUserSessionPolicy GetAddUserSessionPolicy(); |
| + static void DoLockScreen(); |
| + static void DoSwitchActiveUser(const AccountId& account_id); |
| + static void DoCycleActiveUser(bool next_user); |
| + |
| + private: |
| + // Connects or reconnects to the |session_controller_| interface and set |
| + // this object as its client. |
| + void ConnectToSessionControllerAndSetClient(); |
| + |
| + // Handles errors on |session_controller_| interface. |
| + void OnClientConnectionError(); |
| + |
| + // Sends session info to ash. |
| + void SendSessionInfo(); |
| + |
| + // Binds to the client interface. |
| + mojo::Binding<ash::mojom::SessionControllerClient> binding_; |
| + |
| + // SessionController interface in ash. |
| + ash::mojom::SessionControllerPtr session_controller_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ |