Commit 3779691d authored by Ramin Halavati's avatar Ramin Halavati Committed by Chromium LUCI CQ

Update signin intercept to Guest mode edge cases.

Two cases are updated for signin intercept to Guest mode:
 1- When Guest mode is disabled by policy, this will not be offered.
 2- If user opens a Guest profile whie signin intercept is showing,
    and chooses to go to Guest mode, this will be done.

Bug: 1157764
Change-Id: I4116b2c32125a76d893911eebe1c2c31b2284231
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2620559Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841956}
parent 3bf8b68f
...@@ -141,12 +141,16 @@ DiceSignedInProfileCreator::DiceSignedInProfileCreator( ...@@ -141,12 +141,16 @@ DiceSignedInProfileCreator::DiceSignedInProfileCreator(
callback_(std::move(callback)) { callback_(std::move(callback)) {
if (use_guest_profile) { if (use_guest_profile) {
DCHECK(Profile::IsEphemeralGuestProfileEnabled()); DCHECK(Profile::IsEphemeralGuestProfileEnabled());
DCHECK(!ProfileManager::GuestProfileExists()); // Make sure the callback is not called synchronously.
g_browser_process->profile_manager()->CreateProfileAsync( base::ThreadTaskRunnerHandle::Get()->PostTask(
ProfileManager::GetGuestProfilePath(), FROM_HERE,
base::BindRepeating(&DiceSignedInProfileCreator::OnNewProfileCreated, base::BindOnce(&ProfileManager::CreateProfileAsync,
weak_pointer_factory_.GetWeakPtr()), base::Unretained(g_browser_process->profile_manager()),
base::string16(), std::string()); ProfileManager::GetGuestProfilePath(),
base::BindRepeating(
&DiceSignedInProfileCreator::OnNewProfileCreated,
weak_pointer_factory_.GetWeakPtr()),
base::string16(), std::string()));
} else { } else {
ProfileAttributesStorage& storage = ProfileAttributesStorage& storage =
g_browser_process->profile_manager()->GetProfileAttributesStorage(); g_browser_process->profile_manager()->GetProfileAttributesStorage();
......
...@@ -90,7 +90,9 @@ bool HasNoBrowser(content::WebContents* web_contents) { ...@@ -90,7 +90,9 @@ bool HasNoBrowser(content::WebContents* web_contents) {
bool GuestOptionAvailable() { bool GuestOptionAvailable() {
return Profile::IsEphemeralGuestProfileEnabled() && return Profile::IsEphemeralGuestProfileEnabled() &&
!ProfileManager::GuestProfileExists(); !ProfileManager::GuestProfileExists() &&
g_browser_process->local_state()->GetBoolean(
prefs::kBrowserGuestModeEnabled);
} }
} // namespace } // namespace
......
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