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/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/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" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 228 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
229 content::NotificationService::AllSources()); | 229 content::NotificationService::AllSources()); |
230 registrar_.Add(this, | 230 registrar_.Add(this, |
231 chrome::NOTIFICATION_PROFILE_CREATED, | 231 chrome::NOTIFICATION_PROFILE_CREATED, |
232 content::NotificationService::AllSources()); | 232 content::NotificationService::AllSources()); |
233 RetrieveTrustedDevicePolicies(); | 233 RetrieveTrustedDevicePolicies(); |
234 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( | 234 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( |
235 kAccountsPrefDeviceLocalAccounts, | 235 kAccountsPrefDeviceLocalAccounts, |
236 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | 236 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, |
237 base::Unretained(this))); | 237 base::Unretained(this))); |
238 supervised_users_subscription_ = cros_settings_->AddSettingsObserver( | |
239 kAccountsPrefSupervisedUsersEnabled, | |
240 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | |
241 base::Unretained(this))); | |
242 multi_profile_user_controller_.reset(new MultiProfileUserController( | 238 multi_profile_user_controller_.reset(new MultiProfileUserController( |
243 this, g_browser_process->local_state())); | 239 this, g_browser_process->local_state())); |
244 | 240 |
245 policy::BrowserPolicyConnectorChromeOS* connector = | 241 policy::BrowserPolicyConnectorChromeOS* connector = |
246 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 242 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
247 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( | 243 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( |
248 cros_settings_, | 244 cros_settings_, |
249 this, | 245 this, |
250 connector->GetDeviceLocalAccountPolicyService(), | 246 connector->GetDeviceLocalAccountPolicyService(), |
251 policy::key::kUserAvatarImage, | 247 policy::key::kUserAvatarImage, |
(...skipping 20 matching lines...) Expand all Loading... |
272 // These are pointers to the same User instances that were in users_ list. | 268 // These are pointers to the same User instances that were in users_ list. |
273 logged_in_users_.clear(); | 269 logged_in_users_.clear(); |
274 lru_logged_in_users_.clear(); | 270 lru_logged_in_users_.clear(); |
275 | 271 |
276 DeleteUser(active_user_); | 272 DeleteUser(active_user_); |
277 } | 273 } |
278 | 274 |
279 void UserManagerImpl::Shutdown() { | 275 void UserManagerImpl::Shutdown() { |
280 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 276 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
281 local_accounts_subscription_.reset(); | 277 local_accounts_subscription_.reset(); |
282 supervised_users_subscription_.reset(); | |
283 // Stop the session length limiter. | 278 // Stop the session length limiter. |
284 session_length_limiter_.reset(); | 279 session_length_limiter_.reset(); |
285 | 280 |
286 if (device_local_account_policy_service_) | 281 if (device_local_account_policy_service_) |
287 device_local_account_policy_service_->RemoveObserver(this); | 282 device_local_account_policy_service_->RemoveObserver(this); |
288 | 283 |
289 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), | 284 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), |
290 ie = user_image_managers_.end(); | 285 ie = user_image_managers_.end(); |
291 it != ie; ++it) { | 286 it != ie; ++it) { |
292 it->second->Shutdown(); | 287 it->second->Shutdown(); |
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 return; | 1864 return; |
1870 | 1865 |
1871 chrome_client_id_ = chrome_client_id; | 1866 chrome_client_id_ = chrome_client_id; |
1872 chrome_client_secret_ = chrome_client_secret; | 1867 chrome_client_secret_ = chrome_client_secret; |
1873 } | 1868 } |
1874 | 1869 |
1875 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { | 1870 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { |
1876 bool locally_managed_users_allowed = false; | 1871 bool locally_managed_users_allowed = false; |
1877 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, | 1872 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, |
1878 &locally_managed_users_allowed); | 1873 &locally_managed_users_allowed); |
1879 policy::BrowserPolicyConnectorChromeOS* connector = | 1874 return locally_managed_users_allowed; |
1880 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
1881 return locally_managed_users_allowed || !connector->IsEnterpriseManaged(); | |
1882 } | 1875 } |
1883 | 1876 |
1884 base::FilePath UserManagerImpl::GetUserProfileDir( | 1877 base::FilePath UserManagerImpl::GetUserProfileDir( |
1885 const std::string& user_id) const { | 1878 const std::string& user_id) const { |
1886 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from | 1879 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from |
1887 // ProfileManager and use only this function to construct profile path. | 1880 // ProfileManager and use only this function to construct profile path. |
1888 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 | 1881 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 |
1889 base::FilePath profile_dir; | 1882 base::FilePath profile_dir; |
1890 const User* user = FindUser(user_id); | 1883 const User* user = FindUser(user_id); |
1891 if (user && !user->username_hash().empty()) | 1884 if (user && !user->username_hash().empty()) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 } | 2097 } |
2105 | 2098 |
2106 void UserManagerImpl::DeleteUser(User* user) { | 2099 void UserManagerImpl::DeleteUser(User* user) { |
2107 const bool is_active_user = (user == active_user_); | 2100 const bool is_active_user = (user == active_user_); |
2108 delete user; | 2101 delete user; |
2109 if (is_active_user) | 2102 if (is_active_user) |
2110 active_user_ = NULL; | 2103 active_user_ = NULL; |
2111 } | 2104 } |
2112 | 2105 |
2113 } // namespace chromeos | 2106 } // namespace chromeos |
OLD | NEW |