OLD | NEW |
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 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
16 #include "base/logging.h" | 16 #include "base/logging.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
18 #include "base/prefs/pref_registry_simple.h" | 18 #include "base/prefs/pref_registry_simple.h" |
19 #include "base/prefs/pref_service.h" | 19 #include "base/prefs/pref_service.h" |
20 #include "base/prefs/scoped_user_pref_update.h" | 20 #include "base/prefs/scoped_user_pref_update.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
23 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
24 #include "base/values.h" | 24 #include "base/values.h" |
25 #include "chrome/browser/browser_process.h" | 25 #include "chrome/browser/browser_process.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 27 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
28 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 28 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" | 29 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" |
30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" | 30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" |
31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" | 31 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" |
32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" | 32 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" |
33 #include "chrome/browser/chromeos/login/users/remove_user_delegate.h" | |
34 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" | 33 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
35 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 34 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
36 #include "chrome/browser/chromeos/policy/device_local_account.h" | 35 #include "chrome/browser/chromeos/policy/device_local_account.h" |
37 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" | 36 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog.
h" |
38 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 37 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
39 #include "chrome/browser/chromeos/session_length_limiter.h" | 38 #include "chrome/browser/chromeos/session_length_limiter.h" |
40 #include "chrome/browser/profiles/profile.h" | 39 #include "chrome/browser/profiles/profile.h" |
41 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" | 40 #include "chrome/browser/supervised_user/chromeos/manager_password_service_facto
ry.h" |
42 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" | 41 #include "chrome/browser/supervised_user/chromeos/supervised_user_password_servi
ce_factory.h" |
43 #include "chrome/common/chrome_constants.h" | 42 #include "chrome/common/chrome_constants.h" |
44 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/crash_keys.h" | 44 #include "chrome/common/crash_keys.h" |
46 #include "chrome/common/pref_names.h" | 45 #include "chrome/common/pref_names.h" |
47 #include "chrome/grit/theme_resources.h" | 46 #include "chrome/grit/theme_resources.h" |
48 #include "chromeos/chromeos_switches.h" | 47 #include "chromeos/chromeos_switches.h" |
49 #include "chromeos/login/user_names.h" | 48 #include "chromeos/login/user_names.h" |
50 #include "chromeos/settings/cros_settings_names.h" | 49 #include "chromeos/settings/cros_settings_names.h" |
51 #include "components/session_manager/core/session_manager.h" | 50 #include "components/session_manager/core/session_manager.h" |
| 51 #include "components/user_manager/remove_user_delegate.h" |
52 #include "components/user_manager/user_image/user_image.h" | 52 #include "components/user_manager/user_image/user_image.h" |
53 #include "components/user_manager/user_type.h" | 53 #include "components/user_manager/user_type.h" |
54 #include "content/public/browser/browser_thread.h" | 54 #include "content/public/browser/browser_thread.h" |
55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
56 #include "policy/policy_constants.h" | 56 #include "policy/policy_constants.h" |
57 #include "ui/base/resource/resource_bundle.h" | 57 #include "ui/base/resource/resource_bundle.h" |
58 #include "ui/wm/core/wm_core_switches.h" | 58 #include "ui/wm/core/wm_core_switches.h" |
59 | 59 |
60 using content::BrowserThread; | 60 using content::BrowserThread; |
61 | 61 |
62 namespace chromeos { | 62 namespace chromeos { |
63 namespace { | 63 namespace { |
64 | 64 |
65 // A vector pref of the the regular users known on this device, arranged in LRU | 65 // A vector pref of the the regular users known on this device, arranged in LRU |
66 // order. | 66 // order. |
67 const char kRegularUsers[] = "LoggedInUsers"; | 67 const char kRegularUsers[] = "LoggedInUsers"; |
68 | 68 |
69 // A vector pref of the public accounts defined on this device. | 69 // A vector pref of the public accounts defined on this device. |
70 const char kPublicAccounts[] = "PublicAccounts"; | 70 const char kPublicAccounts[] = "PublicAccounts"; |
71 | 71 |
72 // A string pref that gets set when a public account is removed but a user is | 72 // A string pref that gets set when a public account is removed but a user is |
73 // currently logged into that account, requiring the account's data to be | 73 // currently logged into that account, requiring the account's data to be |
74 // removed after logout. | 74 // removed after logout. |
75 const char kPublicAccountPendingDataRemoval[] = | 75 const char kPublicAccountPendingDataRemoval[] = |
76 "PublicAccountPendingDataRemoval"; | 76 "PublicAccountPendingDataRemoval"; |
77 | 77 |
78 } // namespace | 78 } // namespace |
79 | 79 |
80 // static | 80 // static |
81 void UserManager::RegisterPrefs(PrefRegistrySimple* registry) { | 81 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { |
82 UserManagerBase::RegisterPrefs(registry); | 82 ChromeUserManager::RegisterPrefs(registry); |
83 | 83 |
84 registry->RegisterListPref(kPublicAccounts); | 84 registry->RegisterListPref(kPublicAccounts); |
85 registry->RegisterStringPref(kPublicAccountPendingDataRemoval, std::string()); | 85 registry->RegisterStringPref(kPublicAccountPendingDataRemoval, std::string()); |
86 SupervisedUserManager::RegisterPrefs(registry); | 86 SupervisedUserManager::RegisterPrefs(registry); |
87 SessionLengthLimiter::RegisterPrefs(registry); | 87 SessionLengthLimiter::RegisterPrefs(registry); |
88 } | 88 } |
89 | 89 |
90 ChromeUserManager::ChromeUserManager() | 90 // static |
| 91 scoped_ptr<ChromeUserManager> ChromeUserManagerImpl::CreateChromeUserManager() { |
| 92 return scoped_ptr<ChromeUserManager>(new ChromeUserManagerImpl()); |
| 93 } |
| 94 |
| 95 ChromeUserManagerImpl::ChromeUserManagerImpl() |
91 : cros_settings_(CrosSettings::Get()), | 96 : cros_settings_(CrosSettings::Get()), |
92 device_local_account_policy_service_(NULL), | 97 device_local_account_policy_service_(NULL), |
93 supervised_user_manager_(new SupervisedUserManagerImpl(this)), | 98 supervised_user_manager_(new SupervisedUserManagerImpl(this)), |
94 weak_factory_(this) { | 99 weak_factory_(this) { |
95 UpdateNumberOfUsers(); | 100 UpdateNumberOfUsers(); |
96 | 101 |
97 // UserManager instance should be used only on UI thread. | 102 // UserManager instance should be used only on UI thread. |
98 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
99 registrar_.Add(this, | 104 registrar_.Add(this, |
100 chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, | 105 chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, |
101 content::NotificationService::AllSources()); | 106 content::NotificationService::AllSources()); |
102 registrar_.Add(this, | 107 registrar_.Add(this, |
103 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 108 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
104 content::NotificationService::AllSources()); | 109 content::NotificationService::AllSources()); |
105 registrar_.Add(this, | 110 registrar_.Add(this, |
106 chrome::NOTIFICATION_PROFILE_CREATED, | 111 chrome::NOTIFICATION_PROFILE_CREATED, |
107 content::NotificationService::AllSources()); | 112 content::NotificationService::AllSources()); |
108 | 113 |
109 // Since we're in ctor postpone any actions till this is fully created. | 114 // Since we're in ctor postpone any actions till this is fully created. |
110 if (base::MessageLoop::current()) { | 115 if (base::MessageLoop::current()) { |
111 base::MessageLoop::current()->PostTask( | 116 base::MessageLoop::current()->PostTask( |
112 FROM_HERE, | 117 FROM_HERE, |
113 base::Bind(&ChromeUserManager::RetrieveTrustedDevicePolicies, | 118 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
114 weak_factory_.GetWeakPtr())); | 119 weak_factory_.GetWeakPtr())); |
115 } | 120 } |
116 | 121 |
117 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( | 122 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( |
118 kAccountsPrefDeviceLocalAccounts, | 123 kAccountsPrefDeviceLocalAccounts, |
119 base::Bind(&ChromeUserManager::RetrieveTrustedDevicePolicies, | 124 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
120 weak_factory_.GetWeakPtr())); | 125 weak_factory_.GetWeakPtr())); |
121 multi_profile_user_controller_.reset( | 126 multi_profile_user_controller_.reset( |
122 new MultiProfileUserController(this, GetLocalState())); | 127 new MultiProfileUserController(this, GetLocalState())); |
123 | 128 |
124 policy::BrowserPolicyConnectorChromeOS* connector = | 129 policy::BrowserPolicyConnectorChromeOS* connector = |
125 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 130 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
126 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( | 131 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( |
127 cros_settings_, | 132 cros_settings_, |
128 connector->GetDeviceLocalAccountPolicyService(), | 133 connector->GetDeviceLocalAccountPolicyService(), |
129 policy::key::kUserAvatarImage, | 134 policy::key::kUserAvatarImage, |
130 this)); | 135 this)); |
131 avatar_policy_observer_->Init(); | 136 avatar_policy_observer_->Init(); |
132 | 137 |
133 wallpaper_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( | 138 wallpaper_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( |
134 cros_settings_, | 139 cros_settings_, |
135 connector->GetDeviceLocalAccountPolicyService(), | 140 connector->GetDeviceLocalAccountPolicyService(), |
136 policy::key::kWallpaperImage, | 141 policy::key::kWallpaperImage, |
137 this)); | 142 this)); |
138 wallpaper_policy_observer_->Init(); | 143 wallpaper_policy_observer_->Init(); |
139 } | 144 } |
140 | 145 |
141 ChromeUserManager::~ChromeUserManager() { | 146 ChromeUserManagerImpl::~ChromeUserManagerImpl() { |
142 } | 147 } |
143 | 148 |
144 void ChromeUserManager::Shutdown() { | 149 void ChromeUserManagerImpl::Shutdown() { |
145 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 150 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
146 UserManagerBase::Shutdown(); | 151 ChromeUserManager::Shutdown(); |
147 | 152 |
148 local_accounts_subscription_.reset(); | 153 local_accounts_subscription_.reset(); |
149 | 154 |
150 // Stop the session length limiter. | 155 // Stop the session length limiter. |
151 session_length_limiter_.reset(); | 156 session_length_limiter_.reset(); |
152 | 157 |
153 if (device_local_account_policy_service_) | 158 if (device_local_account_policy_service_) |
154 device_local_account_policy_service_->RemoveObserver(this); | 159 device_local_account_policy_service_->RemoveObserver(this); |
155 | 160 |
156 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), | 161 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), |
157 ie = user_image_managers_.end(); | 162 ie = user_image_managers_.end(); |
158 it != ie; | 163 it != ie; |
159 ++it) { | 164 ++it) { |
160 it->second->Shutdown(); | 165 it->second->Shutdown(); |
161 } | 166 } |
162 multi_profile_user_controller_.reset(); | 167 multi_profile_user_controller_.reset(); |
163 avatar_policy_observer_.reset(); | 168 avatar_policy_observer_.reset(); |
164 wallpaper_policy_observer_.reset(); | 169 wallpaper_policy_observer_.reset(); |
165 registrar_.RemoveAll(); | 170 registrar_.RemoveAll(); |
166 } | 171 } |
167 | 172 |
168 MultiProfileUserController* ChromeUserManager::GetMultiProfileUserController() { | 173 MultiProfileUserController* |
| 174 ChromeUserManagerImpl::GetMultiProfileUserController() { |
169 return multi_profile_user_controller_.get(); | 175 return multi_profile_user_controller_.get(); |
170 } | 176 } |
171 | 177 |
172 UserImageManager* ChromeUserManager::GetUserImageManager( | 178 UserImageManager* ChromeUserManagerImpl::GetUserImageManager( |
173 const std::string& user_id) { | 179 const std::string& user_id) { |
174 UserImageManagerMap::iterator ui = user_image_managers_.find(user_id); | 180 UserImageManagerMap::iterator ui = user_image_managers_.find(user_id); |
175 if (ui != user_image_managers_.end()) | 181 if (ui != user_image_managers_.end()) |
176 return ui->second.get(); | 182 return ui->second.get(); |
177 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); | 183 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); |
178 user_image_managers_[user_id] = mgr; | 184 user_image_managers_[user_id] = mgr; |
179 return mgr.get(); | 185 return mgr.get(); |
180 } | 186 } |
181 | 187 |
182 SupervisedUserManager* ChromeUserManager::GetSupervisedUserManager() { | 188 SupervisedUserManager* ChromeUserManagerImpl::GetSupervisedUserManager() { |
183 return supervised_user_manager_.get(); | 189 return supervised_user_manager_.get(); |
184 } | 190 } |
185 | 191 |
186 user_manager::UserList ChromeUserManager::GetUsersAdmittedForMultiProfile() | 192 user_manager::UserList ChromeUserManagerImpl::GetUsersAdmittedForMultiProfile() |
187 const { | 193 const { |
188 // Supervised users are not allowed to use multi-profiles. | 194 // Supervised users are not allowed to use multi-profiles. |
189 if (GetLoggedInUsers().size() == 1 && | 195 if (GetLoggedInUsers().size() == 1 && |
190 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { | 196 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { |
191 return user_manager::UserList(); | 197 return user_manager::UserList(); |
192 } | 198 } |
193 | 199 |
194 user_manager::UserList result; | 200 user_manager::UserList result; |
195 const user_manager::UserList& users = GetUsers(); | 201 const user_manager::UserList& users = GetUsers(); |
196 for (user_manager::UserList::const_iterator it = users.begin(); | 202 for (user_manager::UserList::const_iterator it = users.begin(); |
(...skipping 16 matching lines...) Expand all Loading... |
213 check == MultiProfileUserController::NOT_ALLOWED_POLICY_FORBIDS || | 219 check == MultiProfileUserController::NOT_ALLOWED_POLICY_FORBIDS || |
214 check == MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY) { | 220 check == MultiProfileUserController::NOT_ALLOWED_OWNER_AS_SECONDARY) { |
215 result.push_back(*it); | 221 result.push_back(*it); |
216 } | 222 } |
217 } | 223 } |
218 } | 224 } |
219 | 225 |
220 return result; | 226 return result; |
221 } | 227 } |
222 | 228 |
223 user_manager::UserList ChromeUserManager::GetUnlockUsers() const { | 229 user_manager::UserList ChromeUserManagerImpl::GetUnlockUsers() const { |
224 const user_manager::UserList& logged_in_users = GetLoggedInUsers(); | 230 const user_manager::UserList& logged_in_users = GetLoggedInUsers(); |
225 if (logged_in_users.empty()) | 231 if (logged_in_users.empty()) |
226 return user_manager::UserList(); | 232 return user_manager::UserList(); |
227 | 233 |
228 user_manager::UserList unlock_users; | 234 user_manager::UserList unlock_users; |
229 Profile* profile = ProfileHelper::Get()->GetProfileByUser(GetPrimaryUser()); | 235 Profile* profile = ProfileHelper::Get()->GetProfileByUser(GetPrimaryUser()); |
230 std::string primary_behavior = | 236 std::string primary_behavior = |
231 profile->GetPrefs()->GetString(prefs::kMultiProfileUserBehavior); | 237 profile->GetPrefs()->GetString(prefs::kMultiProfileUserBehavior); |
232 | 238 |
233 // Specific case: only one logged in user or | 239 // Specific case: only one logged in user or |
(...skipping 17 matching lines...) Expand all Loading... |
251 } else if (behavior == MultiProfileUserController::kBehaviorPrimaryOnly) { | 257 } else if (behavior == MultiProfileUserController::kBehaviorPrimaryOnly) { |
252 NOTREACHED() | 258 NOTREACHED() |
253 << "Spotted primary-only multi-profile policy for non-primary user"; | 259 << "Spotted primary-only multi-profile policy for non-primary user"; |
254 } | 260 } |
255 } | 261 } |
256 } | 262 } |
257 | 263 |
258 return unlock_users; | 264 return unlock_users; |
259 } | 265 } |
260 | 266 |
261 void ChromeUserManager::SessionStarted() { | 267 void ChromeUserManagerImpl::SessionStarted() { |
262 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 268 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
263 UserManagerBase::SessionStarted(); | 269 ChromeUserManager::SessionStarted(); |
264 | 270 |
265 content::NotificationService::current()->Notify( | 271 content::NotificationService::current()->Notify( |
266 chrome::NOTIFICATION_SESSION_STARTED, | 272 chrome::NOTIFICATION_SESSION_STARTED, |
267 content::Source<UserManager>(this), | 273 content::Source<UserManager>(this), |
268 content::Details<const user_manager::User>(GetActiveUser())); | 274 content::Details<const user_manager::User>(GetActiveUser())); |
269 } | 275 } |
270 | 276 |
271 void ChromeUserManager::RemoveUserInternal(const std::string& user_email, | 277 void ChromeUserManagerImpl::RemoveUserInternal( |
272 RemoveUserDelegate* delegate) { | 278 const std::string& user_email, |
| 279 user_manager::RemoveUserDelegate* delegate) { |
273 CrosSettings* cros_settings = CrosSettings::Get(); | 280 CrosSettings* cros_settings = CrosSettings::Get(); |
274 | 281 |
275 const base::Closure& callback = | 282 const base::Closure& callback = |
276 base::Bind(&ChromeUserManager::RemoveUserInternal, | 283 base::Bind(&ChromeUserManagerImpl::RemoveUserInternal, |
277 weak_factory_.GetWeakPtr(), | 284 weak_factory_.GetWeakPtr(), |
278 user_email, | 285 user_email, |
279 delegate); | 286 delegate); |
280 | 287 |
281 // Ensure the value of owner email has been fetched. | 288 // Ensure the value of owner email has been fetched. |
282 if (CrosSettingsProvider::TRUSTED != | 289 if (CrosSettingsProvider::TRUSTED != |
283 cros_settings->PrepareTrustedValues(callback)) { | 290 cros_settings->PrepareTrustedValues(callback)) { |
284 // Value of owner email is not fetched yet. RemoveUserInternal will be | 291 // Value of owner email is not fetched yet. RemoveUserInternal will be |
285 // called again after fetch completion. | 292 // called again after fetch completion. |
286 return; | 293 return; |
287 } | 294 } |
288 std::string owner; | 295 std::string owner; |
289 cros_settings->GetString(kDeviceOwner, &owner); | 296 cros_settings->GetString(kDeviceOwner, &owner); |
290 if (user_email == owner) { | 297 if (user_email == owner) { |
291 // Owner is not allowed to be removed from the device. | 298 // Owner is not allowed to be removed from the device. |
292 return; | 299 return; |
293 } | 300 } |
294 RemoveNonOwnerUserInternal(user_email, delegate); | 301 RemoveNonOwnerUserInternal(user_email, delegate); |
295 } | 302 } |
296 | 303 |
297 void ChromeUserManager::SaveUserOAuthStatus( | 304 void ChromeUserManagerImpl::SaveUserOAuthStatus( |
298 const std::string& user_id, | 305 const std::string& user_id, |
299 user_manager::User::OAuthTokenStatus oauth_token_status) { | 306 user_manager::User::OAuthTokenStatus oauth_token_status) { |
300 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 307 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
301 UserManagerBase::SaveUserOAuthStatus(user_id, oauth_token_status); | 308 ChromeUserManager::SaveUserOAuthStatus(user_id, oauth_token_status); |
302 | 309 |
303 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(oauth_token_status); | 310 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(oauth_token_status); |
304 } | 311 } |
305 | 312 |
306 void ChromeUserManager::SaveUserDisplayName( | 313 void ChromeUserManagerImpl::SaveUserDisplayName( |
307 const std::string& user_id, | 314 const std::string& user_id, |
308 const base::string16& display_name) { | 315 const base::string16& display_name) { |
309 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 316 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
310 UserManagerBase::SaveUserDisplayName(user_id, display_name); | 317 ChromeUserManager::SaveUserDisplayName(user_id, display_name); |
311 | 318 |
312 // Do not update local state if data stored or cached outside the user's | 319 // Do not update local state if data stored or cached outside the user's |
313 // cryptohome is to be treated as ephemeral. | 320 // cryptohome is to be treated as ephemeral. |
314 if (!IsUserNonCryptohomeDataEphemeral(user_id)) | 321 if (!IsUserNonCryptohomeDataEphemeral(user_id)) |
315 supervised_user_manager_->UpdateManagerName(user_id, display_name); | 322 supervised_user_manager_->UpdateManagerName(user_id, display_name); |
316 } | 323 } |
317 | 324 |
318 void ChromeUserManager::StopPolicyObserverForTesting() { | 325 void ChromeUserManagerImpl::StopPolicyObserverForTesting() { |
319 avatar_policy_observer_.reset(); | 326 avatar_policy_observer_.reset(); |
320 wallpaper_policy_observer_.reset(); | 327 wallpaper_policy_observer_.reset(); |
321 } | 328 } |
322 | 329 |
323 void ChromeUserManager::Observe(int type, | 330 void ChromeUserManagerImpl::Observe( |
324 const content::NotificationSource& source, | 331 int type, |
325 const content::NotificationDetails& details) { | 332 const content::NotificationSource& source, |
| 333 const content::NotificationDetails& details) { |
326 switch (type) { | 334 switch (type) { |
327 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: | 335 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: |
328 if (!device_local_account_policy_service_) { | 336 if (!device_local_account_policy_service_) { |
329 policy::BrowserPolicyConnectorChromeOS* connector = | 337 policy::BrowserPolicyConnectorChromeOS* connector = |
330 g_browser_process->platform_part() | 338 g_browser_process->platform_part() |
331 ->browser_policy_connector_chromeos(); | 339 ->browser_policy_connector_chromeos(); |
332 device_local_account_policy_service_ = | 340 device_local_account_policy_service_ = |
333 connector->GetDeviceLocalAccountPolicyService(); | 341 connector->GetDeviceLocalAccountPolicyService(); |
334 if (device_local_account_policy_service_) | 342 if (device_local_account_policy_service_) |
335 device_local_account_policy_service_->AddObserver(this); | 343 device_local_account_policy_service_->AddObserver(this); |
(...skipping 26 matching lines...) Expand all Loading... |
362 user->set_profile_is_created(); | 370 user->set_profile_is_created(); |
363 | 371 |
364 // If there is pending user switch, do it now. | 372 // If there is pending user switch, do it now. |
365 if (!GetPendingUserSwitchID().empty()) { | 373 if (!GetPendingUserSwitchID().empty()) { |
366 // Call SwitchActiveUser async because otherwise it may cause | 374 // Call SwitchActiveUser async because otherwise it may cause |
367 // ProfileManager::GetProfile before the profile gets registered | 375 // ProfileManager::GetProfile before the profile gets registered |
368 // in ProfileManager. It happens in case of sync profile load when | 376 // in ProfileManager. It happens in case of sync profile load when |
369 // NOTIFICATION_PROFILE_CREATED is called synchronously. | 377 // NOTIFICATION_PROFILE_CREATED is called synchronously. |
370 base::MessageLoop::current()->PostTask( | 378 base::MessageLoop::current()->PostTask( |
371 FROM_HERE, | 379 FROM_HERE, |
372 base::Bind(&ChromeUserManager::SwitchActiveUser, | 380 base::Bind(&ChromeUserManagerImpl::SwitchActiveUser, |
373 weak_factory_.GetWeakPtr(), | 381 weak_factory_.GetWeakPtr(), |
374 GetPendingUserSwitchID())); | 382 GetPendingUserSwitchID())); |
375 SetPendingUserSwitchID(std::string()); | 383 SetPendingUserSwitchID(std::string()); |
376 } | 384 } |
377 break; | 385 break; |
378 } | 386 } |
379 default: | 387 default: |
380 NOTREACHED(); | 388 NOTREACHED(); |
381 } | 389 } |
382 } | 390 } |
383 | 391 |
384 void ChromeUserManager::OnExternalDataSet(const std::string& policy, | 392 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, |
385 const std::string& user_id) { | 393 const std::string& user_id) { |
386 if (policy == policy::key::kUserAvatarImage) | 394 if (policy == policy::key::kUserAvatarImage) |
387 GetUserImageManager(user_id)->OnExternalDataSet(policy); | 395 GetUserImageManager(user_id)->OnExternalDataSet(policy); |
388 else if (policy == policy::key::kWallpaperImage) | 396 else if (policy == policy::key::kWallpaperImage) |
389 WallpaperManager::Get()->OnPolicySet(policy, user_id); | 397 WallpaperManager::Get()->OnPolicySet(policy, user_id); |
390 else | 398 else |
391 NOTREACHED(); | 399 NOTREACHED(); |
392 } | 400 } |
393 | 401 |
394 void ChromeUserManager::OnExternalDataCleared(const std::string& policy, | 402 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, |
395 const std::string& user_id) { | 403 const std::string& user_id) { |
396 if (policy == policy::key::kUserAvatarImage) | 404 if (policy == policy::key::kUserAvatarImage) |
397 GetUserImageManager(user_id)->OnExternalDataCleared(policy); | 405 GetUserImageManager(user_id)->OnExternalDataCleared(policy); |
398 else if (policy == policy::key::kWallpaperImage) | 406 else if (policy == policy::key::kWallpaperImage) |
399 WallpaperManager::Get()->OnPolicyCleared(policy, user_id); | 407 WallpaperManager::Get()->OnPolicyCleared(policy, user_id); |
400 else | 408 else |
401 NOTREACHED(); | 409 NOTREACHED(); |
402 } | 410 } |
403 | 411 |
404 void ChromeUserManager::OnExternalDataFetched(const std::string& policy, | 412 void ChromeUserManagerImpl::OnExternalDataFetched( |
405 const std::string& user_id, | 413 const std::string& policy, |
406 scoped_ptr<std::string> data) { | 414 const std::string& user_id, |
| 415 scoped_ptr<std::string> data) { |
407 if (policy == policy::key::kUserAvatarImage) | 416 if (policy == policy::key::kUserAvatarImage) |
408 GetUserImageManager(user_id)->OnExternalDataFetched(policy, data.Pass()); | 417 GetUserImageManager(user_id)->OnExternalDataFetched(policy, data.Pass()); |
409 else if (policy == policy::key::kWallpaperImage) | 418 else if (policy == policy::key::kWallpaperImage) |
410 WallpaperManager::Get()->OnPolicyFetched(policy, user_id, data.Pass()); | 419 WallpaperManager::Get()->OnPolicyFetched(policy, user_id, data.Pass()); |
411 else | 420 else |
412 NOTREACHED(); | 421 NOTREACHED(); |
413 } | 422 } |
414 | 423 |
415 void ChromeUserManager::OnPolicyUpdated(const std::string& user_id) { | 424 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { |
416 const user_manager::User* user = FindUser(user_id); | 425 const user_manager::User* user = FindUser(user_id); |
417 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 426 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
418 return; | 427 return; |
419 UpdatePublicAccountDisplayName(user_id); | 428 UpdatePublicAccountDisplayName(user_id); |
420 } | 429 } |
421 | 430 |
422 void ChromeUserManager::OnDeviceLocalAccountsChanged() { | 431 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { |
423 // No action needed here, changes to the list of device-local accounts get | 432 // No action needed here, changes to the list of device-local accounts get |
424 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. | 433 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. |
425 } | 434 } |
426 | 435 |
427 bool ChromeUserManager::CanCurrentUserLock() const { | 436 bool ChromeUserManagerImpl::CanCurrentUserLock() const { |
428 return UserManagerBase::CanCurrentUserLock() && | 437 return ChromeUserManager::CanCurrentUserLock() && |
429 GetCurrentUserFlow()->CanLockScreen(); | 438 GetCurrentUserFlow()->CanLockScreen(); |
430 } | 439 } |
431 | 440 |
432 bool ChromeUserManager::IsUserNonCryptohomeDataEphemeral( | 441 bool ChromeUserManagerImpl::IsUserNonCryptohomeDataEphemeral( |
433 const std::string& user_id) const { | 442 const std::string& user_id) const { |
434 // Data belonging to the obsolete public accounts whose data has not been | 443 // Data belonging to the obsolete public accounts whose data has not been |
435 // removed yet is not ephemeral. | 444 // removed yet is not ephemeral. |
436 bool is_obsolete_public_account = IsPublicAccountMarkedForRemoval(user_id); | 445 bool is_obsolete_public_account = IsPublicAccountMarkedForRemoval(user_id); |
437 | 446 |
438 return !is_obsolete_public_account && | 447 return !is_obsolete_public_account && |
439 UserManagerBase::IsUserNonCryptohomeDataEphemeral(user_id); | 448 ChromeUserManager::IsUserNonCryptohomeDataEphemeral(user_id); |
440 } | 449 } |
441 | 450 |
442 bool ChromeUserManager::AreEphemeralUsersEnabled() const { | 451 bool ChromeUserManagerImpl::AreEphemeralUsersEnabled() const { |
443 policy::BrowserPolicyConnectorChromeOS* connector = | 452 policy::BrowserPolicyConnectorChromeOS* connector = |
444 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 453 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
445 return GetEphemeralUsersEnabled() && | 454 return GetEphemeralUsersEnabled() && |
446 (connector->IsEnterpriseManaged() || !GetOwnerEmail().empty()); | 455 (connector->IsEnterpriseManaged() || !GetOwnerEmail().empty()); |
447 } | 456 } |
448 | 457 |
449 const std::string& ChromeUserManager::GetApplicationLocale() const { | 458 const std::string& ChromeUserManagerImpl::GetApplicationLocale() const { |
450 return g_browser_process->GetApplicationLocale(); | 459 return g_browser_process->GetApplicationLocale(); |
451 } | 460 } |
452 | 461 |
453 PrefService* ChromeUserManager::GetLocalState() const { | 462 PrefService* ChromeUserManagerImpl::GetLocalState() const { |
454 return g_browser_process ? g_browser_process->local_state() : NULL; | 463 return g_browser_process ? g_browser_process->local_state() : NULL; |
455 } | 464 } |
456 | 465 |
457 bool ChromeUserManager::IsEnterpriseManaged() const { | 466 void ChromeUserManagerImpl::HandleUserOAuthTokenStatusChange( |
| 467 const std::string& user_id, |
| 468 user_manager::User::OAuthTokenStatus status) const { |
| 469 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(status); |
| 470 } |
| 471 |
| 472 bool ChromeUserManagerImpl::IsEnterpriseManaged() const { |
458 policy::BrowserPolicyConnectorChromeOS* connector = | 473 policy::BrowserPolicyConnectorChromeOS* connector = |
459 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 474 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
460 return connector->IsEnterpriseManaged(); | 475 return connector->IsEnterpriseManaged(); |
461 } | 476 } |
462 | 477 |
463 void ChromeUserManager::LoadPublicAccounts( | 478 void ChromeUserManagerImpl::LoadPublicAccounts( |
464 std::set<std::string>* public_sessions_set) { | 479 std::set<std::string>* public_sessions_set) { |
465 const base::ListValue* prefs_public_sessions = | 480 const base::ListValue* prefs_public_sessions = |
466 GetLocalState()->GetList(kPublicAccounts); | 481 GetLocalState()->GetList(kPublicAccounts); |
467 std::vector<std::string> public_sessions; | 482 std::vector<std::string> public_sessions; |
468 ParseUserList(*prefs_public_sessions, | 483 ParseUserList(*prefs_public_sessions, |
469 std::set<std::string>(), | 484 std::set<std::string>(), |
470 &public_sessions, | 485 &public_sessions, |
471 public_sessions_set); | 486 public_sessions_set); |
472 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); | 487 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); |
473 it != public_sessions.end(); | 488 it != public_sessions.end(); |
474 ++it) { | 489 ++it) { |
475 users_.push_back(user_manager::User::CreatePublicAccountUser(*it)); | 490 users_.push_back(user_manager::User::CreatePublicAccountUser(*it)); |
476 UpdatePublicAccountDisplayName(*it); | 491 UpdatePublicAccountDisplayName(*it); |
477 } | 492 } |
478 } | 493 } |
479 | 494 |
480 void ChromeUserManager::PerformPreUserListLoadingActions() { | 495 void ChromeUserManagerImpl::PerformPreUserListLoadingActions() { |
481 // Clean up user list first. All code down the path should be synchronous, | 496 // Clean up user list first. All code down the path should be synchronous, |
482 // so that local state after transaction rollback is in consistent state. | 497 // so that local state after transaction rollback is in consistent state. |
483 // This process also should not trigger EnsureUsersLoaded again. | 498 // This process also should not trigger EnsureUsersLoaded again. |
484 if (supervised_user_manager_->HasFailedUserCreationTransaction()) | 499 if (supervised_user_manager_->HasFailedUserCreationTransaction()) |
485 supervised_user_manager_->RollbackUserCreationTransaction(); | 500 supervised_user_manager_->RollbackUserCreationTransaction(); |
486 } | 501 } |
487 | 502 |
488 void ChromeUserManager::PerformPostUserListLoadingActions() { | 503 void ChromeUserManagerImpl::PerformPostUserListLoadingActions() { |
489 for (user_manager::UserList::iterator ui = users_.begin(), ue = users_.end(); | 504 for (user_manager::UserList::iterator ui = users_.begin(), ue = users_.end(); |
490 ui != ue; | 505 ui != ue; |
491 ++ui) { | 506 ++ui) { |
492 GetUserImageManager((*ui)->email())->LoadUserImage(); | 507 GetUserImageManager((*ui)->email())->LoadUserImage(); |
493 } | 508 } |
494 } | 509 } |
495 | 510 |
496 void ChromeUserManager::PerformPostUserLoggedInActions(bool browser_restart) { | 511 void ChromeUserManagerImpl::PerformPostUserLoggedInActions( |
| 512 bool browser_restart) { |
497 // Initialize the session length limiter and start it only if | 513 // Initialize the session length limiter and start it only if |
498 // session limit is defined by the policy. | 514 // session limit is defined by the policy. |
499 session_length_limiter_.reset( | 515 session_length_limiter_.reset( |
500 new SessionLengthLimiter(NULL, browser_restart)); | 516 new SessionLengthLimiter(NULL, browser_restart)); |
501 } | 517 } |
502 | 518 |
503 bool ChromeUserManager::IsDemoApp(const std::string& user_id) const { | 519 bool ChromeUserManagerImpl::IsDemoApp(const std::string& user_id) const { |
504 return DemoAppLauncher::IsDemoAppSession(user_id); | 520 return DemoAppLauncher::IsDemoAppSession(user_id); |
505 } | 521 } |
506 | 522 |
507 bool ChromeUserManager::IsKioskApp(const std::string& user_id) const { | 523 bool ChromeUserManagerImpl::IsKioskApp(const std::string& user_id) const { |
508 policy::DeviceLocalAccount::Type device_local_account_type; | 524 policy::DeviceLocalAccount::Type device_local_account_type; |
509 return policy::IsDeviceLocalAccountUser(user_id, | 525 return policy::IsDeviceLocalAccountUser(user_id, |
510 &device_local_account_type) && | 526 &device_local_account_type) && |
511 device_local_account_type == | 527 device_local_account_type == |
512 policy::DeviceLocalAccount::TYPE_KIOSK_APP; | 528 policy::DeviceLocalAccount::TYPE_KIOSK_APP; |
513 } | 529 } |
514 | 530 |
515 bool ChromeUserManager::IsPublicAccountMarkedForRemoval( | 531 bool ChromeUserManagerImpl::IsPublicAccountMarkedForRemoval( |
516 const std::string& user_id) const { | 532 const std::string& user_id) const { |
517 return user_id == | 533 return user_id == |
518 GetLocalState()->GetString(kPublicAccountPendingDataRemoval); | 534 GetLocalState()->GetString(kPublicAccountPendingDataRemoval); |
519 } | 535 } |
520 | 536 |
521 void ChromeUserManager::RetrieveTrustedDevicePolicies() { | 537 void ChromeUserManagerImpl::RetrieveTrustedDevicePolicies() { |
522 // Local state may not be initialized in unit_tests. | 538 // Local state may not be initialized in unit_tests. |
523 if (!GetLocalState()) | 539 if (!GetLocalState()) |
524 return; | 540 return; |
525 | 541 |
526 SetEphemeralUsersEnabled(false); | 542 SetEphemeralUsersEnabled(false); |
527 SetOwnerEmail(std::string()); | 543 SetOwnerEmail(std::string()); |
528 | 544 |
529 // Schedule a callback if device policy has not yet been verified. | 545 // Schedule a callback if device policy has not yet been verified. |
530 if (CrosSettingsProvider::TRUSTED != | 546 if (CrosSettingsProvider::TRUSTED != |
531 cros_settings_->PrepareTrustedValues( | 547 cros_settings_->PrepareTrustedValues( |
532 base::Bind(&ChromeUserManager::RetrieveTrustedDevicePolicies, | 548 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
533 weak_factory_.GetWeakPtr()))) { | 549 weak_factory_.GetWeakPtr()))) { |
534 return; | 550 return; |
535 } | 551 } |
536 | 552 |
537 bool ephemeral_users_enabled = false; | 553 bool ephemeral_users_enabled = false; |
538 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, | 554 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, |
539 &ephemeral_users_enabled); | 555 &ephemeral_users_enabled); |
540 SetEphemeralUsersEnabled(ephemeral_users_enabled); | 556 SetEphemeralUsersEnabled(ephemeral_users_enabled); |
541 | 557 |
542 std::string owner_email; | 558 std::string owner_email; |
(...skipping 24 matching lines...) Expand all Loading... |
567 prefs_users_update->Append(new base::StringValue(user_email)); | 583 prefs_users_update->Append(new base::StringValue(user_email)); |
568 ++it; | 584 ++it; |
569 } | 585 } |
570 } | 586 } |
571 } | 587 } |
572 | 588 |
573 if (changed) | 589 if (changed) |
574 NotifyUserListChanged(); | 590 NotifyUserListChanged(); |
575 } | 591 } |
576 | 592 |
577 void ChromeUserManager::GuestUserLoggedIn() { | 593 void ChromeUserManagerImpl::GuestUserLoggedIn() { |
578 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 594 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
579 UserManagerBase::GuestUserLoggedIn(); | 595 ChromeUserManager::GuestUserLoggedIn(); |
580 | 596 |
581 // TODO(nkostylev): Add support for passing guest session cryptohome | 597 // TODO(nkostylev): Add support for passing guest session cryptohome |
582 // mount point. Legacy (--login-profile) value will be used for now. | 598 // mount point. Legacy (--login-profile) value will be used for now. |
583 // http://crosbug.com/230859 | 599 // http://crosbug.com/230859 |
584 active_user_->SetStubImage( | 600 active_user_->SetStubImage( |
585 user_manager::UserImage( | 601 user_manager::UserImage( |
586 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 602 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
587 IDR_PROFILE_PICTURE_LOADING)), | 603 IDR_PROFILE_PICTURE_LOADING)), |
588 user_manager::User::USER_IMAGE_INVALID, | 604 user_manager::User::USER_IMAGE_INVALID, |
589 false); | 605 false); |
590 | 606 |
591 // Initializes wallpaper after active_user_ is set. | 607 // Initializes wallpaper after active_user_ is set. |
592 WallpaperManager::Get()->SetUserWallpaperNow(chromeos::login::kGuestUserName); | 608 WallpaperManager::Get()->SetUserWallpaperNow(chromeos::login::kGuestUserName); |
593 } | 609 } |
594 | 610 |
595 void ChromeUserManager::RegularUserLoggedIn(const std::string& user_id) { | 611 void ChromeUserManagerImpl::RegularUserLoggedIn(const std::string& user_id) { |
596 UserManagerBase::RegularUserLoggedIn(user_id); | 612 ChromeUserManager::RegularUserLoggedIn(user_id); |
597 | 613 |
598 if (IsCurrentUserNew()) | 614 if (IsCurrentUserNew()) |
599 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 615 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
600 | 616 |
601 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); | 617 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); |
602 | 618 |
603 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 619 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
604 | 620 |
605 // Make sure that new data is persisted to Local State. | 621 // Make sure that new data is persisted to Local State. |
606 GetLocalState()->CommitPendingWrite(); | 622 GetLocalState()->CommitPendingWrite(); |
607 } | 623 } |
608 | 624 |
609 void ChromeUserManager::RegularUserLoggedInAsEphemeral( | 625 void ChromeUserManagerImpl::RegularUserLoggedInAsEphemeral( |
610 const std::string& user_id) { | 626 const std::string& user_id) { |
611 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 627 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
612 UserManagerBase::RegularUserLoggedInAsEphemeral(user_id); | 628 ChromeUserManager::RegularUserLoggedInAsEphemeral(user_id); |
613 | 629 |
614 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); | 630 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); |
615 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 631 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
616 } | 632 } |
617 | 633 |
618 void ChromeUserManager::SupervisedUserLoggedIn(const std::string& user_id) { | 634 void ChromeUserManagerImpl::SupervisedUserLoggedIn(const std::string& user_id) { |
619 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). | 635 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). |
620 | 636 |
621 // Remove the user from the user list. | 637 // Remove the user from the user list. |
622 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); | 638 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); |
623 | 639 |
624 // If the user was not found on the user list, create a new user. | 640 // If the user was not found on the user list, create a new user. |
625 if (!GetActiveUser()) { | 641 if (!GetActiveUser()) { |
626 SetIsCurrentUserNew(true); | 642 SetIsCurrentUserNew(true); |
627 active_user_ = user_manager::User::CreateSupervisedUser(user_id); | 643 active_user_ = user_manager::User::CreateSupervisedUser(user_id); |
628 // Leaving OAuth token status at the default state = unknown. | 644 // Leaving OAuth token status at the default state = unknown. |
(...skipping 18 matching lines...) Expand all Loading... |
647 GetActiveUser()->GetDisplayName()); | 663 GetActiveUser()->GetDisplayName()); |
648 } | 664 } |
649 | 665 |
650 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), true); | 666 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), true); |
651 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 667 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
652 | 668 |
653 // Make sure that new data is persisted to Local State. | 669 // Make sure that new data is persisted to Local State. |
654 GetLocalState()->CommitPendingWrite(); | 670 GetLocalState()->CommitPendingWrite(); |
655 } | 671 } |
656 | 672 |
657 void ChromeUserManager::PublicAccountUserLoggedIn(user_manager::User* user) { | 673 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( |
| 674 user_manager::User* user) { |
658 SetIsCurrentUserNew(true); | 675 SetIsCurrentUserNew(true); |
659 active_user_ = user; | 676 active_user_ = user; |
660 | 677 |
661 // The UserImageManager chooses a random avatar picture when a user logs in | 678 // The UserImageManager chooses a random avatar picture when a user logs in |
662 // for the first time. Tell the UserImageManager that this user is not new to | 679 // for the first time. Tell the UserImageManager that this user is not new to |
663 // prevent the avatar from getting changed. | 680 // prevent the avatar from getting changed. |
664 GetUserImageManager(user->email())->UserLoggedIn(false, true); | 681 GetUserImageManager(user->email())->UserLoggedIn(false, true); |
665 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 682 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
666 } | 683 } |
667 | 684 |
668 void ChromeUserManager::KioskAppLoggedIn(const std::string& app_id) { | 685 void ChromeUserManagerImpl::KioskAppLoggedIn(const std::string& app_id) { |
669 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 686 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
670 policy::DeviceLocalAccount::Type device_local_account_type; | 687 policy::DeviceLocalAccount::Type device_local_account_type; |
671 DCHECK(policy::IsDeviceLocalAccountUser(app_id, &device_local_account_type)); | 688 DCHECK(policy::IsDeviceLocalAccountUser(app_id, &device_local_account_type)); |
672 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, | 689 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, |
673 device_local_account_type); | 690 device_local_account_type); |
674 | 691 |
675 active_user_ = user_manager::User::CreateKioskAppUser(app_id); | 692 active_user_ = user_manager::User::CreateKioskAppUser(app_id); |
676 active_user_->SetStubImage( | 693 active_user_->SetStubImage( |
677 user_manager::UserImage( | 694 user_manager::UserImage( |
678 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 695 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
(...skipping 28 matching lines...) Expand all Loading... |
707 | 724 |
708 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 725 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
709 command_line->AppendSwitch(::switches::kForceAppMode); | 726 command_line->AppendSwitch(::switches::kForceAppMode); |
710 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id); | 727 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id); |
711 | 728 |
712 // Disable window animation since kiosk app runs in a single full screen | 729 // Disable window animation since kiosk app runs in a single full screen |
713 // window and window animation causes start-up janks. | 730 // window and window animation causes start-up janks. |
714 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); | 731 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); |
715 } | 732 } |
716 | 733 |
717 void ChromeUserManager::DemoAccountLoggedIn() { | 734 void ChromeUserManagerImpl::DemoAccountLoggedIn() { |
718 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 735 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
719 active_user_ = | 736 active_user_ = |
720 user_manager::User::CreateKioskAppUser(DemoAppLauncher::kDemoUserName); | 737 user_manager::User::CreateKioskAppUser(DemoAppLauncher::kDemoUserName); |
721 active_user_->SetStubImage( | 738 active_user_->SetStubImage( |
722 user_manager::UserImage( | 739 user_manager::UserImage( |
723 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 740 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
724 IDR_PROFILE_PICTURE_LOADING)), | 741 IDR_PROFILE_PICTURE_LOADING)), |
725 user_manager::User::USER_IMAGE_INVALID, | 742 user_manager::User::USER_IMAGE_INVALID, |
726 false); | 743 false); |
727 WallpaperManager::Get()->SetUserWallpaperNow(DemoAppLauncher::kDemoUserName); | 744 WallpaperManager::Get()->SetUserWallpaperNow(DemoAppLauncher::kDemoUserName); |
728 | 745 |
729 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 746 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
730 command_line->AppendSwitch(::switches::kForceAppMode); | 747 command_line->AppendSwitch(::switches::kForceAppMode); |
731 command_line->AppendSwitchASCII(::switches::kAppId, | 748 command_line->AppendSwitchASCII(::switches::kAppId, |
732 DemoAppLauncher::kDemoAppId); | 749 DemoAppLauncher::kDemoAppId); |
733 | 750 |
734 // Disable window animation since the demo app runs in a single full screen | 751 // Disable window animation since the demo app runs in a single full screen |
735 // window and window animation causes start-up janks. | 752 // window and window animation causes start-up janks. |
736 CommandLine::ForCurrentProcess()->AppendSwitch( | 753 CommandLine::ForCurrentProcess()->AppendSwitch( |
737 wm::switches::kWindowAnimationsDisabled); | 754 wm::switches::kWindowAnimationsDisabled); |
738 } | 755 } |
739 | 756 |
740 void ChromeUserManager::RetailModeUserLoggedIn() { | 757 void ChromeUserManagerImpl::RetailModeUserLoggedIn() { |
741 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
742 SetIsCurrentUserNew(true); | 759 SetIsCurrentUserNew(true); |
743 active_user_ = user_manager::User::CreateRetailModeUser(); | 760 active_user_ = user_manager::User::CreateRetailModeUser(); |
744 GetUserImageManager(chromeos::login::kRetailModeUserName) | 761 GetUserImageManager(chromeos::login::kRetailModeUserName) |
745 ->UserLoggedIn(IsCurrentUserNew(), true); | 762 ->UserLoggedIn(IsCurrentUserNew(), true); |
746 WallpaperManager::Get()->SetUserWallpaperNow( | 763 WallpaperManager::Get()->SetUserWallpaperNow( |
747 chromeos::login::kRetailModeUserName); | 764 chromeos::login::kRetailModeUserName); |
748 } | 765 } |
749 | 766 |
750 void ChromeUserManager::NotifyOnLogin() { | 767 void ChromeUserManagerImpl::NotifyOnLogin() { |
751 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 768 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
752 | 769 |
753 UserSessionManager::OverrideHomedir(); | 770 UserSessionManager::OverrideHomedir(); |
754 UpdateNumberOfUsers(); | 771 UpdateNumberOfUsers(); |
755 | 772 |
756 UserManagerBase::NotifyOnLogin(); | 773 ChromeUserManager::NotifyOnLogin(); |
757 | 774 |
758 // TODO(nkostylev): Deprecate this notification in favor of | 775 // TODO(nkostylev): Deprecate this notification in favor of |
759 // ActiveUserChanged() observer call. | 776 // ActiveUserChanged() observer call. |
760 content::NotificationService::current()->Notify( | 777 content::NotificationService::current()->Notify( |
761 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 778 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
762 content::Source<UserManager>(this), | 779 content::Source<UserManager>(this), |
763 content::Details<const user_manager::User>(GetActiveUser())); | 780 content::Details<const user_manager::User>(GetActiveUser())); |
764 | 781 |
765 UserSessionManager::GetInstance()->PerformPostUserLoggedInActions(); | 782 UserSessionManager::GetInstance()->PerformPostUserLoggedInActions(); |
766 } | 783 } |
767 | 784 |
768 void ChromeUserManager::UpdateOwnership() { | 785 void ChromeUserManagerImpl::UpdateOwnership() { |
769 bool is_owner = DeviceSettingsService::Get()->HasPrivateOwnerKey(); | 786 bool is_owner = DeviceSettingsService::Get()->HasPrivateOwnerKey(); |
770 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); | 787 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); |
771 | 788 |
772 SetCurrentUserIsOwner(is_owner); | 789 SetCurrentUserIsOwner(is_owner); |
773 } | 790 } |
774 | 791 |
775 void ChromeUserManager::RemoveNonCryptohomeData(const std::string& user_id) { | 792 void ChromeUserManagerImpl::RemoveNonCryptohomeData( |
776 UserManagerBase::RemoveNonCryptohomeData(user_id); | 793 const std::string& user_id) { |
| 794 ChromeUserManager::RemoveNonCryptohomeData(user_id); |
777 | 795 |
778 WallpaperManager::Get()->RemoveUserWallpaperInfo(user_id); | 796 WallpaperManager::Get()->RemoveUserWallpaperInfo(user_id); |
779 GetUserImageManager(user_id)->DeleteUserImage(); | 797 GetUserImageManager(user_id)->DeleteUserImage(); |
780 | 798 |
781 supervised_user_manager_->RemoveNonCryptohomeData(user_id); | 799 supervised_user_manager_->RemoveNonCryptohomeData(user_id); |
782 | 800 |
783 multi_profile_user_controller_->RemoveCachedValues(user_id); | 801 multi_profile_user_controller_->RemoveCachedValues(user_id); |
784 } | 802 } |
785 | 803 |
786 void ChromeUserManager::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { | 804 void |
| 805 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { |
787 PrefService* local_state = GetLocalState(); | 806 PrefService* local_state = GetLocalState(); |
788 const std::string public_account_pending_data_removal = | 807 const std::string public_account_pending_data_removal = |
789 local_state->GetString(kPublicAccountPendingDataRemoval); | 808 local_state->GetString(kPublicAccountPendingDataRemoval); |
790 if (public_account_pending_data_removal.empty() || | 809 if (public_account_pending_data_removal.empty() || |
791 (IsUserLoggedIn() && | 810 (IsUserLoggedIn() && |
792 public_account_pending_data_removal == GetActiveUser()->email())) { | 811 public_account_pending_data_removal == GetActiveUser()->email())) { |
793 return; | 812 return; |
794 } | 813 } |
795 | 814 |
796 RemoveNonCryptohomeData(public_account_pending_data_removal); | 815 RemoveNonCryptohomeData(public_account_pending_data_removal); |
797 local_state->ClearPref(kPublicAccountPendingDataRemoval); | 816 local_state->ClearPref(kPublicAccountPendingDataRemoval); |
798 } | 817 } |
799 | 818 |
800 void ChromeUserManager::CleanUpPublicAccountNonCryptohomeData( | 819 void ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeData( |
801 const std::vector<std::string>& old_public_accounts) { | 820 const std::vector<std::string>& old_public_accounts) { |
802 std::set<std::string> users; | 821 std::set<std::string> users; |
803 for (user_manager::UserList::const_iterator it = users_.begin(); | 822 for (user_manager::UserList::const_iterator it = users_.begin(); |
804 it != users_.end(); | 823 it != users_.end(); |
805 ++it) | 824 ++it) |
806 users.insert((*it)->email()); | 825 users.insert((*it)->email()); |
807 | 826 |
808 // If the user is logged into a public account that has been removed from the | 827 // If the user is logged into a public account that has been removed from the |
809 // user list, mark the account's data as pending removal after logout. | 828 // user list, mark the account's data as pending removal after logout. |
810 if (IsLoggedInAsPublicAccount()) { | 829 if (IsLoggedInAsPublicAccount()) { |
811 const std::string active_user_id = GetActiveUser()->email(); | 830 const std::string active_user_id = GetActiveUser()->email(); |
812 if (users.find(active_user_id) == users.end()) { | 831 if (users.find(active_user_id) == users.end()) { |
813 GetLocalState()->SetString(kPublicAccountPendingDataRemoval, | 832 GetLocalState()->SetString(kPublicAccountPendingDataRemoval, |
814 active_user_id); | 833 active_user_id); |
815 users.insert(active_user_id); | 834 users.insert(active_user_id); |
816 } | 835 } |
817 } | 836 } |
818 | 837 |
819 // Remove the data belonging to any other public accounts that are no longer | 838 // Remove the data belonging to any other public accounts that are no longer |
820 // found on the user list. | 839 // found on the user list. |
821 for (std::vector<std::string>::const_iterator it = | 840 for (std::vector<std::string>::const_iterator it = |
822 old_public_accounts.begin(); | 841 old_public_accounts.begin(); |
823 it != old_public_accounts.end(); | 842 it != old_public_accounts.end(); |
824 ++it) { | 843 ++it) { |
825 if (users.find(*it) == users.end()) | 844 if (users.find(*it) == users.end()) |
826 RemoveNonCryptohomeData(*it); | 845 RemoveNonCryptohomeData(*it); |
827 } | 846 } |
828 } | 847 } |
829 | 848 |
830 bool ChromeUserManager::UpdateAndCleanUpPublicAccounts( | 849 bool ChromeUserManagerImpl::UpdateAndCleanUpPublicAccounts( |
831 const std::vector<policy::DeviceLocalAccount>& device_local_accounts) { | 850 const std::vector<policy::DeviceLocalAccount>& device_local_accounts) { |
832 // Try to remove any public account data marked as pending removal. | 851 // Try to remove any public account data marked as pending removal. |
833 CleanUpPublicAccountNonCryptohomeDataPendingRemoval(); | 852 CleanUpPublicAccountNonCryptohomeDataPendingRemoval(); |
834 | 853 |
835 // Get the current list of public accounts. | 854 // Get the current list of public accounts. |
836 std::vector<std::string> old_public_accounts; | 855 std::vector<std::string> old_public_accounts; |
837 for (user_manager::UserList::const_iterator it = users_.begin(); | 856 for (user_manager::UserList::const_iterator it = users_.begin(); |
838 it != users_.end(); | 857 it != users_.end(); |
839 ++it) { | 858 ++it) { |
840 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 859 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 GetUserImageManager((*ui)->email())->LoadUserImage(); | 928 GetUserImageManager((*ui)->email())->LoadUserImage(); |
910 } | 929 } |
911 | 930 |
912 // Remove data belonging to public accounts that are no longer found on the | 931 // Remove data belonging to public accounts that are no longer found on the |
913 // user list. | 932 // user list. |
914 CleanUpPublicAccountNonCryptohomeData(old_public_accounts); | 933 CleanUpPublicAccountNonCryptohomeData(old_public_accounts); |
915 | 934 |
916 return true; | 935 return true; |
917 } | 936 } |
918 | 937 |
919 void ChromeUserManager::UpdatePublicAccountDisplayName( | 938 void ChromeUserManagerImpl::UpdatePublicAccountDisplayName( |
920 const std::string& user_id) { | 939 const std::string& user_id) { |
921 std::string display_name; | 940 std::string display_name; |
922 | 941 |
923 if (device_local_account_policy_service_) { | 942 if (device_local_account_policy_service_) { |
924 policy::DeviceLocalAccountPolicyBroker* broker = | 943 policy::DeviceLocalAccountPolicyBroker* broker = |
925 device_local_account_policy_service_->GetBrokerForUser(user_id); | 944 device_local_account_policy_service_->GetBrokerForUser(user_id); |
926 if (broker) | 945 if (broker) |
927 display_name = broker->GetDisplayName(); | 946 display_name = broker->GetDisplayName(); |
928 } | 947 } |
929 | 948 |
930 // Set or clear the display name. | 949 // Set or clear the display name. |
931 SaveUserDisplayName(user_id, base::UTF8ToUTF16(display_name)); | 950 SaveUserDisplayName(user_id, base::UTF8ToUTF16(display_name)); |
932 } | 951 } |
933 | 952 |
934 UserFlow* ChromeUserManager::GetCurrentUserFlow() const { | 953 UserFlow* ChromeUserManagerImpl::GetCurrentUserFlow() const { |
935 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 954 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
936 if (!IsUserLoggedIn()) | 955 if (!IsUserLoggedIn()) |
937 return GetDefaultUserFlow(); | 956 return GetDefaultUserFlow(); |
938 return GetUserFlow(GetLoggedInUser()->email()); | 957 return GetUserFlow(GetLoggedInUser()->email()); |
939 } | 958 } |
940 | 959 |
941 UserFlow* ChromeUserManager::GetUserFlow(const std::string& user_id) const { | 960 UserFlow* ChromeUserManagerImpl::GetUserFlow(const std::string& user_id) const { |
942 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 961 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
943 FlowMap::const_iterator it = specific_flows_.find(user_id); | 962 FlowMap::const_iterator it = specific_flows_.find(user_id); |
944 if (it != specific_flows_.end()) | 963 if (it != specific_flows_.end()) |
945 return it->second; | 964 return it->second; |
946 return GetDefaultUserFlow(); | 965 return GetDefaultUserFlow(); |
947 } | 966 } |
948 | 967 |
949 void ChromeUserManager::SetUserFlow(const std::string& user_id, | 968 void ChromeUserManagerImpl::SetUserFlow(const std::string& user_id, |
950 UserFlow* flow) { | 969 UserFlow* flow) { |
951 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 970 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
952 ResetUserFlow(user_id); | 971 ResetUserFlow(user_id); |
953 specific_flows_[user_id] = flow; | 972 specific_flows_[user_id] = flow; |
954 } | 973 } |
955 | 974 |
956 void ChromeUserManager::ResetUserFlow(const std::string& user_id) { | 975 void ChromeUserManagerImpl::ResetUserFlow(const std::string& user_id) { |
957 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 976 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
958 FlowMap::iterator it = specific_flows_.find(user_id); | 977 FlowMap::iterator it = specific_flows_.find(user_id); |
959 if (it != specific_flows_.end()) { | 978 if (it != specific_flows_.end()) { |
960 delete it->second; | 979 delete it->second; |
961 specific_flows_.erase(it); | 980 specific_flows_.erase(it); |
962 } | 981 } |
963 } | 982 } |
964 | 983 |
965 bool ChromeUserManager::AreSupervisedUsersAllowed() const { | 984 bool ChromeUserManagerImpl::AreSupervisedUsersAllowed() const { |
966 bool supervised_users_allowed = false; | 985 bool supervised_users_allowed = false; |
967 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, | 986 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, |
968 &supervised_users_allowed); | 987 &supervised_users_allowed); |
969 return supervised_users_allowed; | 988 return supervised_users_allowed; |
970 } | 989 } |
971 | 990 |
972 UserFlow* ChromeUserManager::GetDefaultUserFlow() const { | 991 UserFlow* ChromeUserManagerImpl::GetDefaultUserFlow() const { |
973 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 992 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
974 if (!default_flow_.get()) | 993 if (!default_flow_.get()) |
975 default_flow_.reset(new DefaultUserFlow()); | 994 default_flow_.reset(new DefaultUserFlow()); |
976 return default_flow_.get(); | 995 return default_flow_.get(); |
977 } | 996 } |
978 | 997 |
979 void ChromeUserManager::NotifyUserListChanged() { | 998 void ChromeUserManagerImpl::NotifyUserListChanged() { |
980 content::NotificationService::current()->Notify( | 999 content::NotificationService::current()->Notify( |
981 chrome::NOTIFICATION_USER_LIST_CHANGED, | 1000 chrome::NOTIFICATION_USER_LIST_CHANGED, |
982 content::Source<UserManager>(this), | 1001 content::Source<UserManager>(this), |
983 content::NotificationService::NoDetails()); | 1002 content::NotificationService::NoDetails()); |
984 } | 1003 } |
985 | 1004 |
986 void ChromeUserManager::NotifyUserAddedToSession( | 1005 void ChromeUserManagerImpl::NotifyUserAddedToSession( |
987 const user_manager::User* added_user, | 1006 const user_manager::User* added_user, |
988 bool user_switch_pending) { | 1007 bool user_switch_pending) { |
989 if (user_switch_pending) | 1008 if (user_switch_pending) |
990 SetPendingUserSwitchID(added_user->email()); | 1009 SetPendingUserSwitchID(added_user->email()); |
991 | 1010 |
992 UpdateNumberOfUsers(); | 1011 UpdateNumberOfUsers(); |
993 UserManagerBase::NotifyUserAddedToSession(added_user, user_switch_pending); | 1012 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); |
994 } | 1013 } |
995 | 1014 |
996 void ChromeUserManager::OnUserNotAllowed(const std::string& user_email) { | 1015 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { |
997 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1016 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
998 "current session"; | 1017 "current session"; |
999 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1018 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); |
1000 } | 1019 } |
1001 | 1020 |
1002 void ChromeUserManager::UpdateNumberOfUsers() { | 1021 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
1003 size_t users = GetLoggedInUsers().size(); | 1022 size_t users = GetLoggedInUsers().size(); |
1004 if (users) { | 1023 if (users) { |
1005 // Write the user number as UMA stat when a multi user session is possible. | 1024 // Write the user number as UMA stat when a multi user session is possible. |
1006 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1) | 1025 if ((users + GetUsersAdmittedForMultiProfile().size()) > 1) |
1007 ash::MultiProfileUMA::RecordUserCount(users); | 1026 ash::MultiProfileUMA::RecordUserCount(users); |
1008 } | 1027 } |
1009 | 1028 |
1010 base::debug::SetCrashKeyValue( | 1029 base::debug::SetCrashKeyValue( |
1011 crash_keys::kNumberOfUsers, | 1030 crash_keys::kNumberOfUsers, |
1012 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); | 1031 base::StringPrintf("%" PRIuS, GetLoggedInUsers().size())); |
1013 } | 1032 } |
1014 | 1033 |
1015 } // namespace chromeos | 1034 } // namespace chromeos |
OLD | NEW |