Commit 1f469b05 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Disable crOS Account Manager in Guest Sessions

Bug: 866354, 820046, 833797
Change-Id: Ib2b56a59fd9d5a7d2cc9b013a875f5d29b05b5e0
Reviewed-on: https://chromium-review.googlesource.com/1150166
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577971}
parent 81e5e6c6
......@@ -42,11 +42,12 @@ namespace {
bool ShouldCreateCrOsOAuthDelegate(Profile* profile) {
// Chrome OS Account Manager should only be instantiated in "regular"
// profiles. Do not try to create |ChromeOSOAuth2TokenServiceDelegate| (which
// uses CrOS Account Manager as the source of truth) for Signin Profile and
// Lock Screen Profile.
// uses CrOS Account Manager as the source of truth) for Signin Profile,
// Lock Screen Profile and Guest Sessions.
return chromeos::switches::IsAccountManagerEnabled() &&
!chromeos::ProfileHelper::IsSigninProfile(profile) &&
!chromeos::ProfileHelper::IsLockScreenAppProfile(profile);
!chromeos::ProfileHelper::IsLockScreenAppProfile(profile) &&
!profile->IsGuestSession();
}
std::unique_ptr<chromeos::ChromeOSOAuth2TokenServiceDelegate>
......
......@@ -31,6 +31,9 @@ AccountManagerUIHandler::AccountManagerUIHandler(
: account_manager_(account_manager),
account_tracker_service_(account_tracker_service),
weak_factory_(this) {
DCHECK(account_manager_);
DCHECK(account_tracker_service_);
account_manager_->AddObserver(this);
account_tracker_service_->AddObserver(this);
}
......
......@@ -183,15 +183,19 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AndroidAppsHandler>(profile));
chromeos::AccountManagerFactory* factory =
g_browser_process->platform_part()->GetAccountManagerFactory();
chromeos::AccountManager* account_manager =
factory->GetAccountManager(profile->GetPath().value());
DCHECK(account_manager);
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AccountManagerUIHandler>(
account_manager,
AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)));
if (!profile->IsGuestSession()) {
chromeos::AccountManagerFactory* factory =
g_browser_process->platform_part()->GetAccountManagerFactory();
chromeos::AccountManager* account_manager =
factory->GetAccountManager(profile->GetPath().value());
DCHECK(account_manager);
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AccountManagerUIHandler>(
account_manager,
AccountTrackerServiceFactory::GetInstance()->GetForProfile(
profile)));
}
AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::ChangePictureHandler>());
if (IsCrostiniUIAllowedForProfile(profile)) {
......
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