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, ...@@ -928,14 +928,8 @@ void UserManagerImpl::Observe(int type,
if (device_local_account_policy_service_) if (device_local_account_policy_service_)
device_local_account_policy_service_->AddObserver(this); device_local_account_policy_service_->AddObserver(this);
} }
// Making this call synchronously is not gonna cut it because RetrieveTrustedDevicePolicies();
// notification order is not defined and in a single message loop run and UpdateOwnership();
// 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();
break; break;
case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: { case chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED: {
Profile* profile = content::Details<Profile>(details).ptr(); Profile* profile = content::Details<Profile>(details).ptr();
...@@ -1295,8 +1289,8 @@ void UserManagerImpl::RetrieveTrustedDevicePolicies() { ...@@ -1295,8 +1289,8 @@ void UserManagerImpl::RetrieveTrustedDevicePolicies() {
// Schedule a callback if device policy has not yet been verified. // Schedule a callback if device policy has not yet been verified.
if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues( if (CrosSettingsProvider::TRUSTED != cros_settings_->PrepareTrustedValues(
base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
base::Unretained(this)))) { base::Unretained(this)))) {
return; return;
} }
......
...@@ -149,6 +149,7 @@ void DeviceSettingsProvider::OwnershipStatusChanged() { ...@@ -149,6 +149,7 @@ void DeviceSettingsProvider::OwnershipStatusChanged() {
// immediate. // immediate.
DCHECK(!store_callback_factory_.HasWeakPtrs()); DCHECK(!store_callback_factory_.HasWeakPtrs());
trusted_status_ = TEMPORARILY_UNTRUSTED;
// Apply the locally-accumulated device settings on top of the initial // Apply the locally-accumulated device settings on top of the initial
// settings from the service and write back the result. // settings from the service and write back the result.
if (device_settings_service_->device_settings()) { if (device_settings_service_->device_settings()) {
......
...@@ -26,10 +26,8 @@ void AddAccountUITweaksLocalizedValues( ...@@ -26,10 +26,8 @@ void AddAccountUITweaksLocalizedValues(
UserManager::Get()->GetUserDisplayEmail(owner_email); UserManager::Get()->GetUserDisplayEmail(owner_email);
localized_strings->SetString("ownerUserId", display_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", localized_strings->SetBoolean("currentUserIsOwner",
UserManager::Get()->IsCurrentUserOwner()); ProfileHelper::IsOwnerProfile(profile));
localized_strings->SetBoolean("loggedInAsGuest", localized_strings->SetBoolean("loggedInAsGuest",
UserManager::Get()->IsLoggedInAsGuest()); UserManager::Get()->IsLoggedInAsGuest());
......
...@@ -121,9 +121,7 @@ IN_PROC_BROWSER_TEST_F(AccountsOptionsTest, PRE_MultiProfilesAccountsOptions) { ...@@ -121,9 +121,7 @@ IN_PROC_BROWSER_TEST_F(AccountsOptionsTest, PRE_MultiProfilesAccountsOptions) {
StartupUtils::MarkOobeCompleted(); StartupUtils::MarkOobeCompleted();
} }
// TODO(pastarmovj): Enable this test once https://crbug.com/362430 is fixed. IN_PROC_BROWSER_TEST_F(AccountsOptionsTest, MultiProfilesAccountsOptions) {
IN_PROC_BROWSER_TEST_F(AccountsOptionsTest,
DISABLED_MultiProfilesAccountsOptions) {
LoginUser(kTestUsers[0]); LoginUser(kTestUsers[0]);
UserAddingScreen::Get()->Start(); UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop(); content::RunAllPendingInMessageLoop();
......
...@@ -182,9 +182,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref( ...@@ -182,9 +182,7 @@ base::Value* CoreChromeOSOptionsHandler::FetchPref(
g_browser_process->platform_part()->browser_policy_connector_chromeos(); g_browser_process->platform_part()->browser_policy_connector_chromeos();
if (connector->IsEnterpriseManaged()) if (connector->IsEnterpriseManaged())
controlled_by = "policy"; controlled_by = "policy";
// TODO(pastarmovj): Replace this call with a multi-profile aware one. else if (!ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())))
// see http://crbug.com/362430
else if (!UserManager::Get()->IsCurrentUserOwner())
controlled_by = "owner"; controlled_by = "owner";
} }
dict->SetBoolean("disabled", !controlled_by.empty()); 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