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

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: Default enable-supervised logic fixed. Duplicated subscriptions removed. Created 6 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 | 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, 223 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
224 content::NotificationService::AllSources()); 224 content::NotificationService::AllSources());
225 registrar_.Add(this, 225 registrar_.Add(this,
226 chrome::NOTIFICATION_PROFILE_CREATED, 226 chrome::NOTIFICATION_PROFILE_CREATED,
227 content::NotificationService::AllSources()); 227 content::NotificationService::AllSources());
228 RetrieveTrustedDevicePolicies(); 228 RetrieveTrustedDevicePolicies();
229 local_accounts_subscription_ = cros_settings_->AddSettingsObserver( 229 local_accounts_subscription_ = cros_settings_->AddSettingsObserver(
230 kAccountsPrefDeviceLocalAccounts, 230 kAccountsPrefDeviceLocalAccounts,
231 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 231 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
232 base::Unretained(this))); 232 base::Unretained(this)));
233 supervised_users_subscription_ = cros_settings_->AddSettingsObserver(
234 kAccountsPrefSupervisedUsersEnabled,
235 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
236 base::Unretained(this)));
237 multi_profile_user_controller_.reset(new MultiProfileUserController( 233 multi_profile_user_controller_.reset(new MultiProfileUserController(
238 this, g_browser_process->local_state())); 234 this, g_browser_process->local_state()));
239 235
240 policy::BrowserPolicyConnectorChromeOS* connector = 236 policy::BrowserPolicyConnectorChromeOS* connector =
241 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 237 g_browser_process->platform_part()->browser_policy_connector_chromeos();
242 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver( 238 avatar_policy_observer_.reset(new policy::CloudExternalDataPolicyObserver(
243 cros_settings_, 239 cros_settings_,
244 this, 240 this,
245 connector->GetDeviceLocalAccountPolicyService(), 241 connector->GetDeviceLocalAccountPolicyService(),
246 policy::key::kUserAvatarImage, 242 policy::key::kUserAvatarImage,
(...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 const std::string& chrome_client_secret) { 1830 const std::string& chrome_client_secret) {
1835 if (!chrome::IsRunningInForcedAppMode()) 1831 if (!chrome::IsRunningInForcedAppMode())
1836 return; 1832 return;
1837 1833
1838 chrome_client_id_ = chrome_client_id; 1834 chrome_client_id_ = chrome_client_id;
1839 chrome_client_secret_ = chrome_client_secret; 1835 chrome_client_secret_ = chrome_client_secret;
1840 } 1836 }
1841 1837
1842 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const { 1838 bool UserManagerImpl::AreLocallyManagedUsersAllowed() const {
1843 bool locally_managed_users_allowed = false; 1839 bool locally_managed_users_allowed = false;
1840 policy::BrowserPolicyConnectorChromeOS* connector =
Nikita (slow) 2014/04/14 11:48:59 nit: As discussed, please remove lines 1840..1845
merkulova 2014/04/14 12:14:47 Done.
1841 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1842 // For enterprise device supervised users are not allowed by default,
1843 // for consumer devices supervised users are enabled by default.
1844 if (!connector->IsEnterpriseManaged())
1845 locally_managed_users_allowed = true;
1844 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled, 1846 cros_settings_->GetBoolean(kAccountsPrefSupervisedUsersEnabled,
1845 &locally_managed_users_allowed); 1847 &locally_managed_users_allowed);
1846 policy::BrowserPolicyConnectorChromeOS* connector = 1848 return locally_managed_users_allowed;
1847 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1848 return locally_managed_users_allowed || !connector->IsEnterpriseManaged();
1849 } 1849 }
1850 1850
1851 base::FilePath UserManagerImpl::GetUserProfileDir( 1851 base::FilePath UserManagerImpl::GetUserProfileDir(
1852 const std::string& user_id) const { 1852 const std::string& user_id) const {
1853 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from 1853 // TODO(dpolukhin): Remove Chrome OS specific profile path logic from
1854 // ProfileManager and use only this function to construct profile path. 1854 // ProfileManager and use only this function to construct profile path.
1855 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233 1855 // TODO(nkostylev): Cleanup profile dir related code paths crbug.com/294233
1856 base::FilePath profile_dir; 1856 base::FilePath profile_dir;
1857 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 1857 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
1858 if (command_line.HasSwitch(::switches::kMultiProfiles)) { 1858 if (command_line.HasSwitch(::switches::kMultiProfiles)) {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2084 } 2084 }
2085 2085
2086 void UserManagerImpl::DeleteUser(User* user) { 2086 void UserManagerImpl::DeleteUser(User* user) {
2087 const bool is_active_user = (user == active_user_); 2087 const bool is_active_user = (user == active_user_);
2088 delete user; 2088 delete user;
2089 if (is_active_user) 2089 if (is_active_user)
2090 active_user_ = NULL; 2090 active_user_ = NULL;
2091 } 2091 }
2092 2092
2093 } // namespace chromeos 2093 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698