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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.h

Issue 1865133002: kiosk: Fix kiosk session restart (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore "PublicAccounts" local state Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/linked_ptr.h" 14 #include "base/memory/linked_ptr.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/synchronization/lock.h" 18 #include "base/synchronization/lock.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_manager.h" 20 #include "chrome/browser/chromeos/login/easy_unlock/bootstrap_manager.h"
21 #include "chrome/browser/chromeos/login/user_flow.h" 21 #include "chrome/browser/chromeos/login/user_flow.h"
22 #include "chrome/browser/chromeos/login/users/affiliation.h" 22 #include "chrome/browser/chromeos/login/users/affiliation.h"
23 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" 23 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h"
24 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 24 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
25 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h" 25 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller_dele gate.h"
26 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h" 26 #include "chrome/browser/chromeos/policy/cloud_external_data_policy_observer.h"
27 #include "chrome/browser/chromeos/policy/device_local_account.h"
27 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 28 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
28 #include "chrome/browser/chromeos/settings/cros_settings.h" 29 #include "chrome/browser/chromeos/settings/cros_settings.h"
29 #include "chrome/browser/chromeos/settings/device_settings_service.h" 30 #include "chrome/browser/chromeos/settings/device_settings_service.h"
30 #include "components/signin/core/account_id/account_id.h" 31 #include "components/signin/core/account_id/account_id.h"
31 #include "components/user_manager/user.h" 32 #include "components/user_manager/user.h"
32 #include "content/public/browser/notification_observer.h" 33 #include "content/public/browser/notification_observer.h"
33 #include "content/public/browser/notification_registrar.h" 34 #include "content/public/browser/notification_registrar.h"
34 35
35 class PrefRegistrySimple; 36 class PrefRegistrySimple;
36 class PrefService; 37 class PrefService;
37 class ProfileSyncService; 38 class ProfileSyncService;
38 39
39 namespace gfx { 40 namespace gfx {
40 class ImageSkia; 41 class ImageSkia;
41 } 42 }
42 43
43 namespace policy {
44 struct DeviceLocalAccount;
45 }
46
47 namespace user_manager { 44 namespace user_manager {
48 class RemoveUserDelegate; 45 class RemoveUserDelegate;
49 } 46 }
50 47
51 namespace chromeos { 48 namespace chromeos {
52 49
53 class MultiProfileUserController; 50 class MultiProfileUserController;
54 class SupervisedUserManagerImpl; 51 class SupervisedUserManagerImpl;
55 class SessionLengthLimiter; 52 class SessionLengthLimiter;
56 53
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 const std::string& user_email, 144 const std::string& user_email,
148 const AffiliationIDSet& user_affiliation_ids) override; 145 const AffiliationIDSet& user_affiliation_ids) override;
149 146
150 protected: 147 protected:
151 const std::string& GetApplicationLocale() const override; 148 const std::string& GetApplicationLocale() const override;
152 PrefService* GetLocalState() const override; 149 PrefService* GetLocalState() const override;
153 void HandleUserOAuthTokenStatusChange( 150 void HandleUserOAuthTokenStatusChange(
154 const AccountId& account_id, 151 const AccountId& account_id,
155 user_manager::User::OAuthTokenStatus status) const override; 152 user_manager::User::OAuthTokenStatus status) const override;
156 bool IsEnterpriseManaged() const override; 153 bool IsEnterpriseManaged() const override;
157 void LoadPublicAccounts(std::set<AccountId>* users_set) override; 154 void LoadDeviceLocalAccounts(std::set<AccountId>* users_set) override;
158 void NotifyOnLogin() override; 155 void NotifyOnLogin() override;
159 void NotifyUserAddedToSession(const user_manager::User* added_user, 156 void NotifyUserAddedToSession(const user_manager::User* added_user,
160 bool user_switch_pending) override; 157 bool user_switch_pending) override;
161 void PerformPreUserListLoadingActions() override; 158 void PerformPreUserListLoadingActions() override;
162 void PerformPostUserListLoadingActions() override; 159 void PerformPostUserListLoadingActions() override;
163 void PerformPostUserLoggedInActions(bool browser_restart) override; 160 void PerformPostUserLoggedInActions(bool browser_restart) override;
164 void RemoveNonCryptohomeData(const AccountId& account_id) override; 161 void RemoveNonCryptohomeData(const AccountId& account_id) override;
165 void RemoveUserInternal(const AccountId& account_id, 162 void RemoveUserInternal(const AccountId& account_id,
166 user_manager::RemoveUserDelegate* delegate) override; 163 user_manager::RemoveUserDelegate* delegate) override;
167 bool IsDemoApp(const AccountId& account_id) const override; 164 bool IsDemoApp(const AccountId& account_id) const override;
168 bool IsKioskApp(const AccountId& account_id) const override;
169 bool IsPublicAccountMarkedForRemoval( 165 bool IsPublicAccountMarkedForRemoval(
170 const AccountId& account_id) const override; 166 const AccountId& account_id) const override;
171 void DemoAccountLoggedIn() override; 167 void DemoAccountLoggedIn() override;
172 void GuestUserLoggedIn() override; 168 void GuestUserLoggedIn() override;
173 void KioskAppLoggedIn(const AccountId& kiosk_app_account_id) override; 169 void KioskAppLoggedIn(user_manager::User* user) override;
174 void PublicAccountUserLoggedIn(user_manager::User* user) override; 170 void PublicAccountUserLoggedIn(user_manager::User* user) override;
175 void RegularUserLoggedIn(const AccountId& account_id) override; 171 void RegularUserLoggedIn(const AccountId& account_id) override;
176 void RegularUserLoggedInAsEphemeral(const AccountId& account_id) override; 172 void RegularUserLoggedInAsEphemeral(const AccountId& account_id) override;
177 void SupervisedUserLoggedIn(const AccountId& account_id) override; 173 void SupervisedUserLoggedIn(const AccountId& account_id) override;
178 bool HasPendingBootstrap(const AccountId& account_id) const override; 174 bool HasPendingBootstrap(const AccountId& account_id) const override;
179 175
180 private: 176 private:
181 friend class SupervisedUserManagerImpl; 177 friend class SupervisedUserManagerImpl;
182 friend class UserManagerTest; 178 friend class UserManagerTest;
183 friend class WallpaperManager; 179 friend class WallpaperManager;
184 friend class WallpaperManagerTest; 180 friend class WallpaperManagerTest;
185 181
186 using UserImageManagerMap = 182 using UserImageManagerMap =
187 base::hash_map<AccountId, linked_ptr<UserImageManager> >; 183 base::hash_map<AccountId, linked_ptr<UserImageManager> >;
188 184
189 ChromeUserManagerImpl(); 185 ChromeUserManagerImpl();
190 186
191 // Retrieves trusted device policies and removes users from the persistent 187 // Retrieves trusted device policies and removes users from the persistent
192 // list if ephemeral users are enabled. Schedules a callback to itself if 188 // list if ephemeral users are enabled. Schedules a callback to itself if
193 // trusted device policies are not yet available. 189 // trusted device policies are not yet available.
194 void RetrieveTrustedDevicePolicies(); 190 void RetrieveTrustedDevicePolicies();
195 191
196 // Updates current user ownership on UI thread. 192 // Updates current user ownership on UI thread.
197 void UpdateOwnership(); 193 void UpdateOwnership();
198 194
199 // If data for a public account is marked as pending removal and the user is 195 // If data for a device local account is marked as pending removal and the
200 // no longer logged into that account, removes the data. 196 // user is no longer logged into that account, removes the data.
201 void CleanUpPublicAccountNonCryptohomeDataPendingRemoval(); 197 void CleanUpDeviceLocalAccountNonCryptohomeDataPendingRemoval();
202 198
203 // Removes data belonging to public accounts that are no longer found on the 199 // Removes data belonging to device local accounts that are no longer found on
204 // user list. If the user is currently logged into one of these accounts, the 200 // the user list. If the user is currently logged into one of these accounts,
205 // data for that account is not removed immediately but marked as pending 201 // the data for that account is not removed immediately but marked as pending
206 // removal after logout. 202 // removal after logout.
207 void CleanUpPublicAccountNonCryptohomeData( 203 void CleanUpDeviceLocalAccountNonCryptohomeData(
208 const std::vector<std::string>& old_public_accounts); 204 const std::vector<std::string>& old_public_accounts);
bartfab (slow) 2016/04/12 15:08:13 Nit: s/old_public_accounts/old_device_local_accoun
xiyuan 2016/04/12 16:22:51 Done.
209 205
210 // Replaces the list of public accounts with those found in 206 // Replaces the list of device local accounts with those found in
211 // |device_local_accounts|. Ensures that data belonging to accounts no longer 207 // |device_local_accounts|. Ensures that data belonging to accounts no longer
212 // on the list is removed. Returns |true| if the list has changed. 208 // on the list is removed. Returns |true| if the list has changed.
213 // Public accounts are defined by policy. This method is called whenever an 209 // Device local accounts are defined by policy. This method is called whenever
214 // updated list of public accounts is received from policy. 210 // an updated list of device local accounts is received from policy.
215 bool UpdateAndCleanUpPublicAccounts( 211 bool UpdateAndCleanUpDeviceLocalAccounts(
216 const std::vector<policy::DeviceLocalAccount>& device_local_accounts); 212 const std::vector<policy::DeviceLocalAccount>& device_local_accounts);
217 213
218 // Updates the display name for public account |username| from policy settings 214 // Updates the display name for public account |username| from policy settings
219 // associated with that username. 215 // associated with that username.
220 void UpdatePublicAccountDisplayName(const std::string& user_id); 216 void UpdatePublicAccountDisplayName(const std::string& user_id);
221 217
222 // Notifies the UI about a change to the user list. 218 // Notifies the UI about a change to the user list.
223 void NotifyUserListChanged(); 219 void NotifyUserListChanged();
224 220
225 // Lazily creates default user flow. 221 // Lazily creates default user flow.
(...skipping 11 matching lines...) Expand all
237 // Starts (or stops) automatic timezone refresh on geolocation, 233 // Starts (or stops) automatic timezone refresh on geolocation,
238 // depending on user preferences. 234 // depending on user preferences.
239 void UpdateUserTimeZoneRefresher(Profile* profile); 235 void UpdateUserTimeZoneRefresher(Profile* profile);
240 236
241 // Adds user to the list of the users who should be reported. 237 // Adds user to the list of the users who should be reported.
242 void AddReportingUser(const AccountId& account_id); 238 void AddReportingUser(const AccountId& account_id);
243 239
244 // Removes user from the list of the users who should be reported. 240 // Removes user from the list of the users who should be reported.
245 void RemoveReportingUser(const AccountId& account_id); 241 void RemoveReportingUser(const AccountId& account_id);
246 242
243 // Creates a user for the given device local account.
244 user_manager::User* CreateUserFromDeviceLocalAccount(
bartfab (slow) 2016/04/12 15:08:13 Nit: Return an std::unique_ptr to indicate ownersh
xiyuan 2016/04/12 16:22:51 Done. Also moved User's ctor/dtor to public to wor
245 const AccountId& account_id,
246 const policy::DeviceLocalAccount::Type type) const;
247
247 // Interface to the signed settings store. 248 // Interface to the signed settings store.
248 CrosSettings* cros_settings_; 249 CrosSettings* cros_settings_;
249 250
250 // Interface to device-local account definitions and associated policy. 251 // Interface to device-local account definitions and associated policy.
251 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_; 252 policy::DeviceLocalAccountPolicyService* device_local_account_policy_service_;
252 253
253 content::NotificationRegistrar registrar_; 254 content::NotificationRegistrar registrar_;
254 255
255 // User avatar managers. 256 // User avatar managers.
256 UserImageManagerMap user_image_managers_; 257 UserImageManagerMap user_image_managers_;
(...skipping 27 matching lines...) Expand all
284 scoped_ptr<BootstrapManager> bootstrap_manager_; 285 scoped_ptr<BootstrapManager> bootstrap_manager_;
285 286
286 base::WeakPtrFactory<ChromeUserManagerImpl> weak_factory_; 287 base::WeakPtrFactory<ChromeUserManagerImpl> weak_factory_;
287 288
288 DISALLOW_COPY_AND_ASSIGN(ChromeUserManagerImpl); 289 DISALLOW_COPY_AND_ASSIGN(ChromeUserManagerImpl);
289 }; 290 };
290 291
291 } // namespace chromeos 292 } // namespace chromeos
292 293
293 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_ 294 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_CHROME_USER_MANAGER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698