diff options
author | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 11:04:26 +0000 |
---|---|---|
committer | pastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-12 11:04:26 +0000 |
commit | d3fe5f28bb0948d1bab08da9673694d4cf20e4e9 (patch) | |
tree | 68e16277a23114a29d3d4cf3ddd8ebf433869b56 | |
parent | ea3987e4a52d5dae39a07950e5881ac761b7302e (diff) | |
download | chromium_src-d3fe5f28bb0948d1bab08da9673694d4cf20e4e9.zip chromium_src-d3fe5f28bb0948d1bab08da9673694d4cf20e4e9.tar.gz chromium_src-d3fe5f28bb0948d1bab08da9673694d4cf20e4e9.tar.bz2 |
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
5 files changed, 8 insertions, 19 deletions
diff --git a/chrome/browser/chromeos/login/user_manager_impl.cc b/chrome/browser/chromeos/login/user_manager_impl.cc index f9c557b..f6d4862 100644 --- a/chrome/browser/chromeos/login/user_manager_impl.cc +++ b/chrome/browser/chromeos/login/user_manager_impl.cc @@ -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; } diff --git a/chrome/browser/chromeos/settings/device_settings_provider.cc b/chrome/browser/chromeos/settings/device_settings_provider.cc index e38b877..b122ae04 100644 --- a/chrome/browser/chromeos/settings/device_settings_provider.cc +++ b/chrome/browser/chromeos/settings/device_settings_provider.cc @@ -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()) { diff --git a/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc b/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc index 32b5922..03f2f7f 100644 --- a/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc +++ b/chrome/browser/ui/webui/chromeos/ui_account_tweaks.cc @@ -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()); diff --git a/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc b/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc index 93ef377..c3bd615f 100644 --- a/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc +++ b/chrome/browser/ui/webui/options/chromeos/accounts_options_browsertest.cc @@ -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(); diff --git a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc index 5771c5e..6524a25 100644 --- a/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc +++ b/chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc @@ -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()); |