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

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 2798343003: Merge "cros: Fix flaky owner detection" (Closed)
Patch Set: Created 3 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
OLDNEW
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/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <cstddef> 9 #include <cstddef>
10 #include <set> 10 #include <set>
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 if (!device_local_account_policy_service_) { 451 if (!device_local_account_policy_service_) {
452 policy::BrowserPolicyConnectorChromeOS* connector = 452 policy::BrowserPolicyConnectorChromeOS* connector =
453 g_browser_process->platform_part() 453 g_browser_process->platform_part()
454 ->browser_policy_connector_chromeos(); 454 ->browser_policy_connector_chromeos();
455 device_local_account_policy_service_ = 455 device_local_account_policy_service_ =
456 connector->GetDeviceLocalAccountPolicyService(); 456 connector->GetDeviceLocalAccountPolicyService();
457 if (device_local_account_policy_service_) 457 if (device_local_account_policy_service_)
458 device_local_account_policy_service_->AddObserver(this); 458 device_local_account_policy_service_->AddObserver(this);
459 } 459 }
460 RetrieveTrustedDevicePolicies(); 460 RetrieveTrustedDevicePolicies();
461 UpdateOwnership();
462 break; 461 break;
463 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { 462 case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: {
464 Profile* profile = content::Details<Profile>(details).ptr(); 463 Profile* profile = content::Details<Profile>(details).ptr();
465 if (IsUserLoggedIn() && !IsLoggedInAsGuest() && !IsLoggedInAsKioskApp() && 464 if (IsUserLoggedIn() && !IsLoggedInAsGuest() && !IsLoggedInAsKioskApp() &&
466 !IsLoggedInAsArcKioskApp()) { 465 !IsLoggedInAsArcKioskApp()) {
467 if (IsLoggedInAsSupervisedUser()) 466 if (IsLoggedInAsSupervisedUser())
468 SupervisedUserPasswordServiceFactory::GetForProfile(profile); 467 SupervisedUserPasswordServiceFactory::GetForProfile(profile);
469 if (IsLoggedInAsUserWithGaiaAccount()) 468 if (IsLoggedInAsUserWithGaiaAccount())
470 ManagerPasswordServiceFactory::GetForProfile(profile); 469 ManagerPasswordServiceFactory::GetForProfile(profile);
471 470
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 // TODO(nkostylev): Deprecate this notification in favor of 940 // TODO(nkostylev): Deprecate this notification in favor of
942 // ActiveUserChanged() observer call. 941 // ActiveUserChanged() observer call.
943 content::NotificationService::current()->Notify( 942 content::NotificationService::current()->Notify(
944 chrome::NOTIFICATION_LOGIN_USER_CHANGED, 943 chrome::NOTIFICATION_LOGIN_USER_CHANGED,
945 content::Source<UserManager>(this), 944 content::Source<UserManager>(this),
946 content::Details<const user_manager::User>(GetActiveUser())); 945 content::Details<const user_manager::User>(GetActiveUser()));
947 946
948 UserSessionManager::GetInstance()->PerformPostUserLoggedInActions(); 947 UserSessionManager::GetInstance()->PerformPostUserLoggedInActions();
949 } 948 }
950 949
951 void ChromeUserManagerImpl::UpdateOwnership() {
952 bool is_owner =
953 FakeOwnership() || DeviceSettingsService::Get()->HasPrivateOwnerKey();
954 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner");
955
956 SetCurrentUserIsOwner(is_owner);
957 }
958
959 void ChromeUserManagerImpl::RemoveNonCryptohomeData( 950 void ChromeUserManagerImpl::RemoveNonCryptohomeData(
960 const AccountId& account_id) { 951 const AccountId& account_id) {
961 ChromeUserManager::RemoveNonCryptohomeData(account_id); 952 ChromeUserManager::RemoveNonCryptohomeData(account_id);
962 953
963 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id); 954 WallpaperManager::Get()->RemoveUserWallpaperInfo(account_id);
964 GetUserImageManager(account_id)->DeleteUserImage(); 955 GetUserImageManager(account_id)->DeleteUserImage();
965 956
966 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail()); 957 supervised_user_manager_->RemoveNonCryptohomeData(account_id.GetUserEmail());
967 958
968 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail()); 959 multi_profile_user_controller_->RemoveCachedValues(account_id.GetUserEmail());
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 break; 1363 break;
1373 default: 1364 default:
1374 NOTREACHED(); 1365 NOTREACHED();
1375 break; 1366 break;
1376 } 1367 }
1377 1368
1378 return user; 1369 return user;
1379 } 1370 }
1380 1371
1381 } // namespace chromeos 1372 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698