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

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

Issue 2545723003: ash: Add SessionController/Client mojo interfaces (Closed)
Patch Set: rebase, use ash_util::GetAshServiceName 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
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/ash/session_controller_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d97bc6bb75e10d50a9aa74e4b087c0772c3108cd
--- /dev/null
+++ b/chrome/browser/ui/ash/session_controller_client.h
@@ -0,0 +1,81 @@
+// 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;
+}
+
+namespace user_manager {
+class User;
+}
+
+// Updates session state etc to ash via SessionController interface and handles
+// 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;
+
+ // 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();
+
+ // Sends session info to ash.
+ void SendSessionInfoIfChanged();
+
+ // Sends the user session info.
+ void SendUserSession(const user_manager::User& user);
+
+ // Sends the order of user sessions to ash.
+ void SendUserSessionOrder();
+
+ // Binds to the client interface.
+ mojo::Binding<ash::mojom::SessionControllerClient> binding_;
+
+ // SessionController interface in ash.
+ ash::mojom::SessionControllerPtr session_controller_;
+
+ // Whether the primary user session info is sent to ash.
+ bool primary_user_session_sent_ = false;
+
+ ash::mojom::SessionInfoPtr last_sent_session_info_;
+
+ DISALLOW_COPY_AND_ASSIGN(SessionControllerClient);
+};
+
+#endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/ash/session_controller_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698