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 "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
746 const content::NotificationDetails& details) { | 746 const content::NotificationDetails& details) { |
747 switch (type) { | 747 switch (type) { |
748 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: | 748 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: |
749 if (!device_local_account_policy_service_) { | 749 if (!device_local_account_policy_service_) { |
750 device_local_account_policy_service_ = | 750 device_local_account_policy_service_ = |
751 g_browser_process->browser_policy_connector()-> | 751 g_browser_process->browser_policy_connector()-> |
752 GetDeviceLocalAccountPolicyService(); | 752 GetDeviceLocalAccountPolicyService(); |
753 if (device_local_account_policy_service_) | 753 if (device_local_account_policy_service_) |
754 device_local_account_policy_service_->AddObserver(this); | 754 device_local_account_policy_service_->AddObserver(this); |
755 } | 755 } |
756 CheckOwnership(); | |
757 RetrieveTrustedDevicePolicies(); | 756 RetrieveTrustedDevicePolicies(); |
757 UpdateOwnership(); | |
tbarzic
2013/09/04 23:57:26
I can't see any obvious reasons why this should be
pastarmovj
2013/09/05 12:48:18
I don't see any obvious reasons either. I think th
| |
758 break; | 758 break; |
759 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: | 759 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: |
760 if (IsUserLoggedIn() && | 760 if (IsUserLoggedIn() && |
761 !IsLoggedInAsGuest() && | 761 !IsLoggedInAsGuest() && |
762 !IsLoggedInAsKioskApp()) { | 762 !IsLoggedInAsKioskApp()) { |
763 Profile* profile = content::Details<Profile>(details).ptr(); | 763 Profile* profile = content::Details<Profile>(details).ptr(); |
764 if (!profile->IsOffTheRecord() && | 764 if (!profile->IsOffTheRecord() && |
765 profile == ProfileManager::GetDefaultProfile()) { | 765 profile == ProfileManager::GetDefaultProfile()) { |
766 // TODO(nkostylev): We should observe all logged in user's profiles. | 766 // TODO(nkostylev): We should observe all logged in user's profiles. |
767 // http://crbug.com/230860 | 767 // http://crbug.com/230860 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 content::NotificationService::current()->Notify( | 1320 content::NotificationService::current()->Notify( |
1321 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 1321 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
1322 content::Source<UserManager>(this), | 1322 content::Source<UserManager>(this), |
1323 content::Details<const User>(active_user_)); | 1323 content::Details<const User>(active_user_)); |
1324 | 1324 |
1325 // Indicate to DeviceSettingsService that the owner key may have become | 1325 // Indicate to DeviceSettingsService that the owner key may have become |
1326 // available. | 1326 // available. |
1327 DeviceSettingsService::Get()->SetUsername(active_user_->email()); | 1327 DeviceSettingsService::Get()->SetUsername(active_user_->email()); |
1328 } | 1328 } |
1329 | 1329 |
1330 void UserManagerImpl::UpdateOwnership( | 1330 void UserManagerImpl::UpdateOwnership() { |
1331 DeviceSettingsService::OwnershipStatus status, | 1331 bool is_owner = DeviceSettingsService::Get()->HasPrivateOwnerKey(); |
1332 bool is_owner) { | |
1333 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); | 1332 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); |
1334 | 1333 |
1335 SetCurrentUserIsOwner(is_owner); | 1334 SetCurrentUserIsOwner(is_owner); |
1336 } | 1335 } |
1337 | 1336 |
1338 void UserManagerImpl::CheckOwnership() { | |
1339 DeviceSettingsService::Get()->GetOwnershipStatusAsync( | |
1340 base::Bind(&UserManagerImpl::UpdateOwnership, | |
1341 base::Unretained(this))); | |
1342 } | |
1343 | |
1344 void UserManagerImpl::RemoveNonCryptohomeData(const std::string& email) { | 1337 void UserManagerImpl::RemoveNonCryptohomeData(const std::string& email) { |
1345 WallpaperManager::Get()->RemoveUserWallpaperInfo(email); | 1338 WallpaperManager::Get()->RemoveUserWallpaperInfo(email); |
1346 user_image_manager_->DeleteUserImage(email); | 1339 user_image_manager_->DeleteUserImage(email); |
1347 | 1340 |
1348 PrefService* prefs = g_browser_process->local_state(); | 1341 PrefService* prefs = g_browser_process->local_state(); |
1349 DictionaryPrefUpdate prefs_oauth_update(prefs, kUserOAuthTokenStatus); | 1342 DictionaryPrefUpdate prefs_oauth_update(prefs, kUserOAuthTokenStatus); |
1350 int oauth_status; | 1343 int oauth_status; |
1351 prefs_oauth_update->GetIntegerWithoutPathExpansion(email, &oauth_status); | 1344 prefs_oauth_update->GetIntegerWithoutPathExpansion(email, &oauth_status); |
1352 prefs_oauth_update->RemoveWithoutPathExpansion(email, NULL); | 1345 prefs_oauth_update->RemoveWithoutPathExpansion(email, NULL); |
1353 | 1346 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1817 base::TimeTicks::Now() - manager_creation_time_; | 1810 base::TimeTicks::Now() - manager_creation_time_; |
1818 if (!last_email.empty() && email != last_email && | 1811 if (!last_email.empty() && email != last_email && |
1819 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { | 1812 time_to_login.InSeconds() <= kLogoutToLoginDelayMaxSec) { |
1820 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", | 1813 UMA_HISTOGRAM_CUSTOM_COUNTS("UserManager.LogoutToLoginDelay", |
1821 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50); | 1814 time_to_login.InSeconds(), 0, kLogoutToLoginDelayMaxSec, 50); |
1822 } | 1815 } |
1823 } | 1816 } |
1824 } | 1817 } |
1825 | 1818 |
1826 } // namespace chromeos | 1819 } // namespace chromeos |
OLD | NEW |