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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 228553002: Preference dis/allowing supervised users creation is now available as owner setting, not only as de… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test-specific logic added: check for BrowserPolicyConnector existence used. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 222 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
223 content::NotificationService::AllSources()); 223 content::NotificationService::AllSources());
224 registrar_.Add(this, 224 registrar_.Add(this,
225 chrome::NOTIFICATION_PROFILE_CREATED, 225 chrome::NOTIFICATION_PROFILE_CREATED,
226 content::NotificationService::AllSources()); 226 content::NotificationService::AllSources());
227 RetrieveTrustedDevicePolicies(); 227 RetrieveTrustedDevicePolicies();
228 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( 228 local_accounts_subscription_ = cros_settings_->AddSettingsObserver(
229 kAccountsPrefDeviceLocalAccounts, 229 kAccountsPrefDeviceLocalAccounts,
230 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 230 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
231 base::Unretained(this))); 231 base::Unretained(this)));
232 supervised_users_subscription_ = cros_settings_->AddSettingsObserver(
233 kAccountsPrefSupervisedUsersEnabled,
234 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
235 base::Unretained(this)));
236 multi_profile_user_controller_.reset(new MultiProfileUserController( 232 multi_profile_user_controller_.reset(new MultiProfileUserController(
237 this, g_browser_process->local_state())); 233 this, g_browser_process->local_state()));
238 234
239 policy::BrowserPolicyConnectorChromeOS* connector = 235 policy::BrowserPolicyConnectorChromeOS* connector =
240 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 236 g_browser_process->platform_part()->browser_policy_connector_chromeos();
241 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( 237 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver(
242 cros_settings_, 238 cros_settings_,
243 this, 239 this,
244 connector->GetDeviceLocalAccountPolicyService(), 240 connector->GetDeviceLocalAccountPolicyService(),
245 policy::key::kUserAvatarImage, 241 policy::key::kUserAvatarImage,
(...skipping 20 matching lines...) Expand all
266 // These are pointers to the same User instances that were in users_ list. 262 // These are pointers to the same User instances that were in users_ list.
267 logged_in_users_.clear(); 263 logged_in_users_.clear();
268 lru_logged_in_users_.clear(); 264 lru_logged_in_users_.clear();
269 265
270 DeleteUser(active_user_); 266 DeleteUser(active_user_);
271 } 267 }
272 268
273 void UserManagerImpl::Shutdown() { 269 void UserManagerImpl::Shutdown() {
274 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
275 local_accounts_subscription_.reset(); 271 local_accounts_subscription_.reset();
276 supervised_users_subscription_.reset();
277 // Stop the session length limiter. 272 // Stop the session length limiter.
278 session_length_limiter_.reset(); 273 session_length_limiter_.reset();
279 274
280 if (device_local_account_policy_service_) 275 if (device_local_account_policy_service_)
281 device_local_account_policy_service_->RemoveObserver(this); 276 device_local_account_policy_service_->RemoveObserver(this);
282 277
283 for (UserImageManagerMap::iterator it = user_image_managers_.begin(), 278 for (UserImageManagerMap::iterator it = user_image_managers_.begin(),
284 ie = user_image_managers_.end(); 279 ie = user_image_managers_.end();
285 it != ie; ++it) { 280 it != ie; ++it) {
286 it->second->Shutdown(); 281 it->second->Shutdown();
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 return; 1844 return;
1850 1845
1851 chrome_client_id_ = chrome_client_id; 1846 chrome_client_id_ = chrome_client_id;
1852 chrome_client_secret_ = chrome_client_secret; 1847 chrome_client_secret_ = chrome_client_secret;
1853 } 1848 }
1854 1849
1855 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { 1850 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const {
1856 bool locally_managed_users_allowed = false; 1851 bool locally_managed_users_allowed = false;
1857 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, 1852 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled,
1858 &locally_managed_users_allowed); 1853 &locally_managed_users_allowed);
1859 policy::BrowserPolicyConnectorChromeOS* connector = 1854 return locally_managed_users_allowed;
1860 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1861 return locally_managed_users_allowed || !connector->IsEnterpriseManaged();
1862 } 1855 }
1863 1856
1864 base::FilePath UserManagerImpl::GetUserProfileDir( 1857 base::FilePath UserManagerImpl::GetUserProfileDir(
1865 const std::string& user_id) const { 1858 const std::string& user_id) const {
1866 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from 1859 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from
1867 // ProfileManager and use only this function to construct profile path. 1860 // ProfileManager and use only this function to construct profile path.
1868 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 1861 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233
1869 base::FilePath profile_dir; 1862 base::FilePath profile_dir;
1870 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1863 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1871 if (command_line.HasSwitch(::switches::kMultiProfiles)) { 1864 if (command_line.HasSwitch(::switches::kMultiProfiles)) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2097 } 2090 }
2098 2091
2099 void UserManagerImpl::DeleteUser(User* user) { 2092 void UserManagerImpl::DeleteUser(User* user) {
2100 const bool is_active_user = (user == active_user_); 2093 const bool is_active_user = (user == active_user_);
2101 delete user; 2094 delete user;
2102 if (is_active_user) 2095 if (is_active_user)
2103 active_user_ = NULL; 2096 active_user_ = NULL;
2104 } 2097 }
2105 2098
2106 } // namespace chromeos 2099 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698