Reintroduce proper checking for owner profile for the UI.

Fixes an issue where transient untrusted state is reported as permanent.

BUG=362430
TEST=browser_tests

Review URL: https://codereview.chromium.org/271063002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269765 0039d316-1c4b-4281-b951-d872f2087c98
parent ea3987e4
......@@ -928,14 +928,8 @@ void UserManagerImpl::Observe(int type,
if (device_local_account_policy_service_)
device_local_account_policy_service_->AddObserver(this);
}
// Making this call synchronously is not gonna cut it because
// notification order is not defined and in a single message loop run and
// getting trusted settings rely on a reload that happens on the very same
// notification observation.
base::MessageLoop::current()->PostTask(FROM_HERE,
base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
base::Unretained(this)));
UserManagerImpl::UpdateOwnership();
RetrieveTrustedDevicePolicies();
UpdateOwnership();
break;
case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: {
Profile* profile = content::Details<Profile>(details).ptr();
......@@ -1295,8 +1289,8 @@ void UserManagerImpl::RetrieveTrustedDevicePolicies() {
// Schedule a callback if device policy has not yet been verified.
if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
base::Unretained(this)))) {
base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
base::Unretained(this)))) {
return;
}
......
......@@ -149,6 +149,7 @@ void DeviceSettingsProvider::OwnershipStatusChanged() {
// immediate.
DCHECK(!store_callback_factory_.HasWeakPtrs());
trusted_status_ = TEMPORARILY_UNTRUSTED;
// Apply the locally-accumulated device settings on top of the initial
// settings from the service and write back the result.
if (device_settings_service_->device_settings()) {
......
......@@ -26,10 +26,8 @@ void AddAccountUITweaksLocalizedValues(
UserManager::Get()->GetUserDisplayEmail(owner_email);
localized_strings->SetString("ownerUserId", display_email);
// TODO(pastarmovj): Replace this call with a multi-profile aware one.
// see http://crbug.com/362430
localized_strings->SetBoolean("currentUserIsOwner",
UserManager::Get()->IsCurrentUserOwner());
ProfileHelper::IsOwnerProfile(profile));
localized_strings->SetBoolean("loggedInAsGuest",
UserManager::Get()->IsLoggedInAsGuest());
......
......@@ -121,9 +121,7 @@ IN_PROC_BROWSER_TEST_F(AccountsOptionsTest, PRE_MultiProfilesAccountsOptions) {
StartupUtils::MarkOobeCompleted();
}
// TODO(pastarmovj): Enable this test once https://crbug.com/362430 is fixed.
IN_PROC_BROWSER_TEST_F(AccountsOptionsTest,
DISABLED_MultiProfilesAccountsOptions) {
IN_PROC_BROWSER_TEST_F(AccountsOptionsTest, MultiProfilesAccountsOptions) {
LoginUser(kTestUsers[0]);
UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop();
......
......@@ -182,9 +182,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
g_browser_process->platform_part()->browser_policy_connector_chromeos();
if (connector->IsEnterpriseManaged())
controlled_by = "policy";
// TODO(pastarmovj): Replace this call with a multi-profile aware one.
// see http://crbug.com/362430
else if (!UserManager::Get()->IsCurrentUserOwner())
else if (!ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())))
controlled_by = "owner";
}
dict->SetBoolean("disabled", !controlled_by.empty());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment