Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Unified Diff: chrome/browser/ui/ash/session_controller_client.h

Issue 2545723003: ash: Add SessionController/Client mojo interfaces (Closed)
Patch Set: use a default to fix null avatar image failures Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698