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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
7
8 #include "ash/public/interfaces/session_controller.mojom.h"
9 #include "base/macros.h"
10 #include "components/session_manager/core/session_manager_observer.h"
11 #include "components/user_manager/user_manager.h"
12 #include "mojo/public/cpp/bindings/binding.h"
13
14 namespace ash {
15 enum class AddUserSessionPolicy;
16 }
17
18 namespace user_manager {
19 class User;
20 }
21
22 // Updates session state etc to ash via SessionController interface and handles
23 // session related calls from ash.
24 // TODO(xiyuan): Update when UserSessionStateObserver is gone.
25 class SessionControllerClient
26 : public ash::mojom::SessionControllerClient,
27 public user_manager::UserManager::UserSessionStateObserver,
28 public session_manager::SessionManagerObserver {
29 public:
30 SessionControllerClient();
31 ~SessionControllerClient() override;
32
33 // ash::mojom::SessionControllerClient:
34 void RequestLockScreen() override;
35 void SwitchActiveUser(const std::string& serialized_account_id) override;
36 void CycleActiveUser(bool next_user) override;
37
38 // user_manager::UserManager::UserSessionStateObserver:
39 void ActiveUserChanged(const user_manager::User* active_user) override;
40 void UserAddedToSession(const user_manager::User* added_user) override;
41
42 // session_manager::SessionManagerObserver:
43 void OnSessionStateChanged() override;
44
45 // TODO(xiyuan): Remove after SessionStateDelegateChromeOS is gone.
46 static bool CanLockScreen();
47 static bool ShouldLockScreenAutomatically();
48 static ash::AddUserSessionPolicy GetAddUserSessionPolicy();
49 static void DoLockScreen();
50 static void DoSwitchActiveUser(const AccountId& account_id);
51 static void DoCycleActiveUser(bool next_user);
52
53 private:
54 // Connects or reconnects to the |session_controller_| interface and set
55 // this object as its client.
56 void ConnectToSessionControllerAndSetClient();
57
58 // Sends session info to ash.
59 void SendSessionInfoIfChanged();
60
61 // Sends the user session info.
62 void SendUserSession(const user_manager::User& user);
63
64 // Sends the order of user sessions to ash.
65 void SendUserSessionOrder();
66
67 // Binds to the client interface.
68 mojo::Binding<ash::mojom::SessionControllerClient> binding_;
69
70 // SessionController interface in ash.
71 ash::mojom::SessionControllerPtr session_controller_;
72
73 // Whether the primary user session info is sent to ash.
74 bool primary_user_session_sent_ = false;
75
76 ash::mojom::SessionInfoPtr last_sent_session_info_;
77
78 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient);
79 };
80
81 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
OLDNEW
« 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