OLD | NEW |
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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: | 919 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: |
920 if (!device_local_account_policy_service_) { | 920 if (!device_local_account_policy_service_) { |
921 policy::BrowserPolicyConnectorChromeOS* connector = | 921 policy::BrowserPolicyConnectorChromeOS* connector = |
922 g_browser_process->platform_part() | 922 g_browser_process->platform_part() |
923 ->browser_policy_connector_chromeos(); | 923 ->browser_policy_connector_chromeos(); |
924 device_local_account_policy_service_ = | 924 device_local_account_policy_service_ = |
925 connector->GetDeviceLocalAccountPolicyService(); | 925 connector->GetDeviceLocalAccountPolicyService(); |
926 if (device_local_account_policy_service_) | 926 if (device_local_account_policy_service_) |
927 device_local_account_policy_service_->AddObserver(this); | 927 device_local_account_policy_service_->AddObserver(this); |
928 } | 928 } |
929 // Making this call synchronously is not gonna cut it because | 929 RetrieveTrustedDevicePolicies(); |
930 // notification order is not defined and in a single message loop run and | 930 UpdateOwnership(); |
931 // getting trusted settings rely on a reload that happens on the very same | |
932 // notification observation. | |
933 base::MessageLoop::current()->PostTask(FROM_HERE, | |
934 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | |
935 base::Unretained(this))); | |
936 UserManagerImpl::UpdateOwnership(); | |
937 break; | 931 break; |
938 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { | 932 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { |
939 Profile* profile = content::Details<Profile>(details).ptr(); | 933 Profile* profile = content::Details<Profile>(details).ptr(); |
940 if (IsUserLoggedIn() && | 934 if (IsUserLoggedIn() && |
941 !IsLoggedInAsGuest() && | 935 !IsLoggedInAsGuest() && |
942 !IsLoggedInAsKioskApp()) { | 936 !IsLoggedInAsKioskApp()) { |
943 if (IsLoggedInAsLocallyManagedUser()) | 937 if (IsLoggedInAsLocallyManagedUser()) |
944 ManagedUserPasswordServiceFactory::GetForProfile(profile); | 938 ManagedUserPasswordServiceFactory::GetForProfile(profile); |
945 if (IsLoggedInAsRegularUser()) | 939 if (IsLoggedInAsRegularUser()) |
946 ManagerPasswordServiceFactory::GetForProfile(profile); | 940 ManagerPasswordServiceFactory::GetForProfile(profile); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 GetUserImageManager((*ui)->email())->LoadUserImage(); | 1280 GetUserImageManager((*ui)->email())->LoadUserImage(); |
1287 } | 1281 } |
1288 } | 1282 } |
1289 | 1283 |
1290 void UserManagerImpl::RetrieveTrustedDevicePolicies() { | 1284 void UserManagerImpl::RetrieveTrustedDevicePolicies() { |
1291 ephemeral_users_enabled_ = false; | 1285 ephemeral_users_enabled_ = false; |
1292 owner_email_ = ""; | 1286 owner_email_ = ""; |
1293 | 1287 |
1294 // Schedule a callback if device policy has not yet been verified. | 1288 // Schedule a callback if device policy has not yet been verified. |
1295 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( | 1289 if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( |
1296 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, | 1290 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, |
1297 base::Unretained(this)))) { | 1291 base::Unretained(this)))) { |
1298 return; | 1292 return; |
1299 } | 1293 } |
1300 | 1294 |
1301 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, | 1295 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, |
1302 &ephemeral_users_enabled_); | 1296 &ephemeral_users_enabled_); |
1303 cros_settings_->GetString(kDeviceOwner, &owner_email_); | 1297 cros_settings_->GetString(kDeviceOwner, &owner_email_); |
1304 | 1298 |
1305 EnsureUsersLoaded(); | 1299 EnsureUsersLoaded(); |
1306 | 1300 |
1307 bool changed = UpdateAndCleanUpPublicAccounts( | 1301 bool changed = UpdateAndCleanUpPublicAccounts( |
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2096 } | 2090 } |
2097 | 2091 |
2098 void UserManagerImpl::DeleteUser(User* user) { | 2092 void UserManagerImpl::DeleteUser(User* user) { |
2099 const bool is_active_user = (user == active_user_); | 2093 const bool is_active_user = (user == active_user_); |
2100 delete user; | 2094 delete user; |
2101 if (is_active_user) | 2095 if (is_active_user) |
2102 active_user_ = NULL; | 2096 active_user_ = NULL; |
2103 } | 2097 } |
2104 | 2098 |
2105 } // namespace chromeos | 2099 } // namespace chromeos |
OLD | NEW |