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 { ...@@ -42,11 +42,12 @@ namespace {
bool ShouldCreateCrOsOAuthDelegate(Profile* profile) { bool ShouldCreateCrOsOAuthDelegate(Profile* profile) {
// Chrome OS Account Manager should only be instantiated in "regular" // Chrome OS Account Manager should only be instantiated in "regular"
// profiles. Do not try to create |ChromeOSOAuth2TokenServiceDelegate| (which // profiles. Do not try to create |ChromeOSOAuth2TokenServiceDelegate| (which
// uses CrOS Account Manager as the source of truth) for Signin Profile and // uses CrOS Account Manager as the source of truth) for Signin Profile,
// Lock Screen Profile. // Lock Screen Profile and Guest Sessions.
return chromeos::switches::IsAccountManagerEnabled() && return chromeos::switches::IsAccountManagerEnabled() &&
!chromeos::ProfileHelper::IsSigninProfile(profile) && !chromeos::ProfileHelper::IsSigninProfile(profile) &&
!chromeos::ProfileHelper::IsLockScreenAppProfile(profile); !chromeos::ProfileHelper::IsLockScreenAppProfile(profile) &&
!profile->IsGuestSession();
} }
std::unique_ptr<chromeos::ChromeOSOAuth2TokenServiceDelegate> std::unique_ptr<chromeos::ChromeOSOAuth2TokenServiceDelegate>
......
...@@ -31,6 +31,9 @@ AccountManagerUIHandler::AccountManagerUIHandler( ...@@ -31,6 +31,9 @@ AccountManagerUIHandler::AccountManagerUIHandler(
: account_manager_(account_manager), : account_manager_(account_manager),
account_tracker_service_(account_tracker_service), account_tracker_service_(account_tracker_service),
weak_factory_(this) { weak_factory_(this) {
DCHECK(account_manager_);
DCHECK(account_tracker_service_);
account_manager_->AddObserver(this); account_manager_->AddObserver(this);
account_tracker_service_->AddObserver(this); account_tracker_service_->AddObserver(this);
} }
......
...@@ -183,15 +183,19 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui) ...@@ -183,15 +183,19 @@ MdSettingsUI::MdSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AndroidAppsHandler>(profile)); std::make_unique<chromeos::settings::AndroidAppsHandler>(profile));
if (!profile->IsGuestSession()) {
chromeos::AccountManagerFactory* factory = chromeos::AccountManagerFactory* factory =
g_browser_process->platform_part()->GetAccountManagerFactory(); g_browser_process->platform_part()->GetAccountManagerFactory();
chromeos::AccountManager* account_manager = chromeos::AccountManager* account_manager =
factory->GetAccountManager(profile->GetPath().value()); factory->GetAccountManager(profile->GetPath().value());
DCHECK(account_manager); DCHECK(account_manager);
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::AccountManagerUIHandler>( std::make_unique<chromeos::settings::AccountManagerUIHandler>(
account_manager, account_manager,
AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile))); AccountTrackerServiceFactory::GetInstance()->GetForProfile(
profile)));
}
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::ChangePictureHandler>()); std::make_unique<chromeos::settings::ChangePictureHandler>());
if (IsCrostiniUIAllowedForProfile(profile)) { 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