| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 225 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 226 content::NotificationService::AllSources()); | 226 content::NotificationService::AllSources()); |
| 227 registrar_.Add(this, | 227 registrar_.Add(this, |
| 228 chrome::NOTIFICATION_PROFILE_CREATED, | 228 chrome::NOTIFICATION_PROFILE_CREATED, |
| 229 content::NotificationService::AllSources()); | 229 content::NotificationService::AllSources()); |
| 230 RetrieveTrustedDevicePolicies(); | 230 RetrieveTrustedDevicePolicies(); |
| 231 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( | 231 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( |
| 232 kAccountsPrefDeviceLocalAccounts, | 232 kAccountsPrefDeviceLocalAccounts, |
| 233 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | 233 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, |
| 234 base::Unretained(this))); | 234 base::Unretained(this))); |
| 235 supervised_users_subscription_ = cros_settings_->AddSettingsObserver( | |
| 236 kAccountsPrefSupervisedUsersEnabled, | |
| 237 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | |
| 238 base::Unretained(this))); | |
| 239 multi_profile_user_controller_.reset(new MultiProfileUserController( | 235 multi_profile_user_controller_.reset(new MultiProfileUserController( |
| 240 this, g_browser_process->local_state())); | 236 this, g_browser_process->local_state())); |
| 241 | 237 |
| 242 policy::BrowserPolicyConnectorChromeOS* connector = | 238 policy::BrowserPolicyConnectorChromeOS* connector = |
| 243 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 239 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 244 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( | 240 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( |
| 245 cros_settings_, | 241 cros_settings_, |
| 246 this, | 242 this, |
| 247 connector->GetDeviceLocalAccountPolicyService(), | 243 connector->GetDeviceLocalAccountPolicyService(), |
| 248 policy::key::kUserAvatarImage, | 244 policy::key::kUserAvatarImage, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 269 // These are pointers to the same User instances that were in users_ list. | 265 // These are pointers to the same User instances that were in users_ list. |
| 270 logged_in_users_.clear(); | 266 logged_in_users_.clear(); |
| 271 lru_logged_in_users_.clear(); | 267 lru_logged_in_users_.clear(); |
| 272 | 268 |
| 273 DeleteUser(active_user_); | 269 DeleteUser(active_user_); |
| 274 } | 270 } |
| 275 | 271 |
| 276 void UserManagerImpl::Shutdown() { | 272 void UserManagerImpl::Shutdown() { |
| 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 273 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 278 local_accounts_subscription_.reset(); | 274 local_accounts_subscription_.reset(); |
| 279 supervised_users_subscription_.reset(); | |
| 280 // Stop the session length limiter. | 275 // Stop the session length limiter. |
| 281 session_length_limiter_.reset(); | 276 session_length_limiter_.reset(); |
| 282 | 277 |
| 283 if (device_local_account_policy_service_) | 278 if (device_local_account_policy_service_) |
| 284 device_local_account_policy_service_->RemoveObserver(this); | 279 device_local_account_policy_service_->RemoveObserver(this); |
| 285 | 280 |
| 286 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), | 281 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), |
| 287 ie = user_image_managers_.end(); | 282 ie = user_image_managers_.end(); |
| 288 it != ie; ++it) { | 283 it != ie; ++it) { |
| 289 it->second->Shutdown(); | 284 it->second->Shutdown(); |
| (...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1851 return; | 1846 return; |
| 1852 | 1847 |
| 1853 chrome_client_id_ = chrome_client_id; | 1848 chrome_client_id_ = chrome_client_id; |
| 1854 chrome_client_secret_ = chrome_client_secret; | 1849 chrome_client_secret_ = chrome_client_secret; |
| 1855 } | 1850 } |
| 1856 | 1851 |
| 1857 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { | 1852 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { |
| 1858 bool locally_managed_users_allowed = false; | 1853 bool locally_managed_users_allowed = false; |
| 1859 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, | 1854 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, |
| 1860 &locally_managed_users_allowed); | 1855 &locally_managed_users_allowed); |
| 1861 policy::BrowserPolicyConnectorChromeOS* connector = | 1856 return locally_managed_users_allowed; |
| 1862 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
| 1863 return locally_managed_users_allowed || !connector->IsEnterpriseManaged(); | |
| 1864 } | 1857 } |
| 1865 | 1858 |
| 1866 base::FilePath UserManagerImpl::GetUserProfileDir( | 1859 base::FilePath UserManagerImpl::GetUserProfileDir( |
| 1867 const std::string& user_id) const { | 1860 const std::string& user_id) const { |
| 1868 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from | 1861 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from |
| 1869 // ProfileManager and use only this function to construct profile path. | 1862 // ProfileManager and use only this function to construct profile path. |
| 1870 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 | 1863 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 |
| 1871 base::FilePath profile_dir; | 1864 base::FilePath profile_dir; |
| 1872 const User* user = FindUser(user_id); | 1865 const User* user = FindUser(user_id); |
| 1873 if (user && !user->username_hash().empty()) | 1866 if (user && !user->username_hash().empty()) |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2086 } | 2079 } |
| 2087 | 2080 |
| 2088 void UserManagerImpl::DeleteUser(User* user) { | 2081 void UserManagerImpl::DeleteUser(User* user) { |
| 2089 const bool is_active_user = (user == active_user_); | 2082 const bool is_active_user = (user == active_user_); |
| 2090 delete user; | 2083 delete user; |
| 2091 if (is_active_user) | 2084 if (is_active_user) |
| 2092 active_user_ = NULL; | 2085 active_user_ = NULL; |
| 2093 } | 2086 } |
| 2094 | 2087 |
| 2095 } // namespace chromeos | 2088 } // namespace chromeos |
| OLD | NEW |