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

Side by Side Diff: chrome/browser/ui/ash/session_controller_client.h

Issue 2873453003: cros: Update ash when prefs related to lock are changed (Closed)
Patch Set: fix nits Created 3 years, 7 months 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 | « no previous file | 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ 5 #ifndef CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ 6 #define CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
7 7
8 #include <vector>
9
8 #include "ash/public/interfaces/session_controller.mojom.h" 10 #include "ash/public/interfaces/session_controller.mojom.h"
9 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
10 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/supervised_user/supervised_user_service_observer.h" 15 #include "chrome/browser/supervised_user/supervised_user_service_observer.h"
14 #include "components/session_manager/core/session_manager_observer.h" 16 #include "components/session_manager/core/session_manager_observer.h"
15 #include "components/user_manager/user_manager.h" 17 #include "components/user_manager/user_manager.h"
16 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
17 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
18 #include "mojo/public/cpp/bindings/binding.h" 20 #include "mojo/public/cpp/bindings/binding.h"
19 21
20 class Profile; 22 class Profile;
23 class PrefChangeRegistrar;
21 24
22 namespace ash { 25 namespace ash {
23 enum class AddUserSessionPolicy; 26 enum class AddUserSessionPolicy;
24 } 27 }
25 28
26 namespace user_manager { 29 namespace user_manager {
27 class User; 30 class User;
28 } 31 }
29 32
30 // Updates session state etc to ash via SessionController interface and handles 33 // Updates session state etc to ash via SessionController interface and handles
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 static void DoLockScreen(); 93 static void DoLockScreen();
91 static void DoSwitchActiveUser(const AccountId& account_id); 94 static void DoSwitchActiveUser(const AccountId& account_id);
92 static void DoCycleActiveUser(ash::CycleUserDirection direction); 95 static void DoCycleActiveUser(ash::CycleUserDirection direction);
93 96
94 // Flushes the mojo pipe to ash. 97 // Flushes the mojo pipe to ash.
95 static void FlushForTesting(); 98 static void FlushForTesting();
96 99
97 private: 100 private:
98 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SendUserSession); 101 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SendUserSession);
99 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser); 102 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, SupervisedUser);
103 FRIEND_TEST_ALL_PREFIXES(SessionControllerClientTest, UserPrefsChange);
100 104
101 // Called when the login profile is ready. 105 // Called when the login profile is ready.
102 void OnLoginUserProfilePrepared(Profile* profile); 106 void OnLoginUserProfilePrepared(Profile* profile);
103 107
104 // Sends the user session info for a given profile. 108 // Sends the user session info for a given profile.
105 void SendUserSessionForProfile(Profile* profile); 109 void SendUserSessionForProfile(Profile* profile);
106 110
107 // Connects to the |session_controller_| interface. 111 // Connects to the |session_controller_| interface.
108 void ConnectToSessionController(); 112 void ConnectToSessionController();
109 113
(...skipping 14 matching lines...) Expand all
124 128
125 // Whether the primary user session info is sent to ash. 129 // Whether the primary user session info is sent to ash.
126 bool primary_user_session_sent_ = false; 130 bool primary_user_session_sent_ = false;
127 131
128 // If the session is for a supervised user, the profile of that user. 132 // If the session is for a supervised user, the profile of that user.
129 // Chrome OS only supports a single supervised user in a session. 133 // Chrome OS only supports a single supervised user in a session.
130 Profile* supervised_user_profile_ = nullptr; 134 Profile* supervised_user_profile_ = nullptr;
131 135
132 content::NotificationRegistrar registrar_; 136 content::NotificationRegistrar registrar_;
133 137
138 // Pref change observers to update session info when a relevant user pref
139 // changes. There is one observer per user and they have no particular order,
140 // i.e. they don't much the user session order.
141 std::vector<std::unique_ptr<PrefChangeRegistrar>> pref_change_registrars_;
142
134 // Used to suppress duplicate IPCs to ash. 143 // Used to suppress duplicate IPCs to ash.
135 ash::mojom::SessionInfoPtr last_sent_session_info_; 144 ash::mojom::SessionInfoPtr last_sent_session_info_;
136 ash::mojom::UserSessionPtr last_sent_user_session_; 145 ash::mojom::UserSessionPtr last_sent_user_session_;
137 146
138 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_; 147 base::WeakPtrFactory<SessionControllerClient> weak_ptr_factory_;
139 148
140 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient); 149 DISALLOW_COPY_AND_ASSIGN(SessionControllerClient);
141 }; 150 };
142 151
143 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_ 152 #endif // CHROME_BROWSER_UI_ASH_SESSION_CONTROLLER_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/session_controller_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698