0

[FedCM] Move delegate implementation to content/browser

Currently, there is no default implementation of the federated identity
delegates in content/browser. In order to make FedCM work in headless,
this CL moves the in-memory delegate implementation from content/shell
to content/browser.

Bug: 336561988
Change-Id: I5097f86c76bcd5bb41193ef14f16d1b2f0eef6a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5740871
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1333637}
This commit is contained in:
Christian Biesinger
2024-07-26 17:08:22 +00:00
committed by Chromium LUCI CQ
parent cb2da5672b
commit c59336f303
11 changed files with 107 additions and 102 deletions

@ -1128,6 +1128,8 @@ source_set("browser") {
"idle/idle_manager_impl.h",
"image_capture/image_capture_impl.cc",
"image_capture/image_capture_impl.h",
"in_memory_federated_permission_context.cc",
"in_memory_federated_permission_context.h",
"indexed_db/indexed_db_internals_ui.cc",
"indexed_db/indexed_db_internals_ui.h",
"installedapp/fetch_related_apps_task.h",

@ -35,6 +35,7 @@
#include "content/browser/browsing_data/browsing_data_remover_impl.h"
#include "content/browser/child_process_host_impl.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/in_memory_federated_permission_context.h"
#include "content/browser/media/browser_feature_provider.h"
#include "content/browser/push_messaging/push_messaging_router.h"
#include "content/browser/site_info.h"
@ -374,17 +375,17 @@ BrowserContext::CreateVideoDecodePerfHistory() {
FederatedIdentityApiPermissionContextDelegate*
BrowserContext::GetFederatedIdentityApiPermissionContext() {
return nullptr;
return impl()->GetFederatedPermissionContext();
}
FederatedIdentityAutoReauthnPermissionContextDelegate*
BrowserContext::GetFederatedIdentityAutoReauthnPermissionContext() {
return nullptr;
return impl()->GetFederatedPermissionContext();
}
FederatedIdentityPermissionContextDelegate*
BrowserContext::GetFederatedIdentityPermissionContext() {
return nullptr;
return impl()->GetFederatedPermissionContext();
}
KAnonymityServiceDelegate* BrowserContext::GetKAnonymityServiceDelegate() {

@ -13,6 +13,7 @@
#include "content/browser/background_sync/background_sync_scheduler.h"
#include "content/browser/browsing_data/browsing_data_remover_impl.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/in_memory_federated_permission_context.h"
#include "content/browser/permissions/permission_controller_impl.h"
#include "content/browser/preloading/prefetch/prefetch_service.h"
#include "content/browser/renderer_host/navigation_transitions/navigation_entry_screenshot_cache.h"
@ -297,6 +298,19 @@ PrefetchService* BrowserContextImpl::GetPrefetchService() {
return prefetch_service_.get();
}
InMemoryFederatedPermissionContext*
BrowserContextImpl::GetFederatedPermissionContext() {
if (!federated_permission_context_) {
federated_permission_context_ =
std::make_unique<InMemoryFederatedPermissionContext>();
}
return federated_permission_context_.get();
}
void BrowserContextImpl::ResetFederatedPermissionContext() {
federated_permission_context_.reset();
}
void BrowserContextImpl::SetPrefetchServiceForTesting(
std::unique_ptr<PrefetchService> prefetch_service) {
prefetch_service_ = std::move(prefetch_service);

@ -39,6 +39,7 @@ class BackgroundSyncScheduler;
class BrowserContextImpl;
class BrowsingDataRemoverImpl;
class DownloadManager;
class InMemoryFederatedPermissionContext;
class NavigationEntryScreenshotManager;
class PermissionController;
class PrefetchService;
@ -103,6 +104,9 @@ class CONTENT_EXPORT BrowserContextImpl {
NavigationEntryScreenshotManager* GetNavigationEntryScreenshotManager();
InMemoryFederatedPermissionContext* GetFederatedPermissionContext();
void ResetFederatedPermissionContext();
using TraceProto = perfetto::protos::pbzero::ChromeBrowserContext;
// Write a representation of this object into a trace.
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const;
@ -139,6 +143,8 @@ class CONTENT_EXPORT BrowserContextImpl {
std::unique_ptr<PrefetchService> prefetch_service_;
std::unique_ptr<NavigationEntryScreenshotManager>
nav_entry_screenshot_manager_;
std::unique_ptr<InMemoryFederatedPermissionContext>
federated_permission_context_;
std::unique_ptr<media::learning::LearningSessionImpl> learning_session_;
std::unique_ptr<media::VideoDecodePerfHistory> video_decode_perf_history_;

@ -2,24 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/shell/browser/shell_federated_permission_context.h"
#include "content/browser/in_memory_federated_permission_context.h"
#include <algorithm>
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/callback_helpers.h"
#include "content/public/common/content_features.h"
#include "content/shell/common/shell_switches.h"
namespace content {
ShellFederatedPermissionContext::ShellFederatedPermissionContext() = default;
InMemoryFederatedPermissionContext::InMemoryFederatedPermissionContext() =
default;
ShellFederatedPermissionContext::~ShellFederatedPermissionContext() = default;
InMemoryFederatedPermissionContext::~InMemoryFederatedPermissionContext() =
default;
content::FederatedIdentityApiPermissionContextDelegate::PermissionStatus
ShellFederatedPermissionContext::GetApiPermissionStatus(
InMemoryFederatedPermissionContext::GetApiPermissionStatus(
const url::Origin& relying_party_embedder) {
if (!base::FeatureList::IsEnabled(features::kFedCm)) {
return PermissionStatus::BLOCKED_VARIATIONS;
@ -33,21 +35,22 @@ ShellFederatedPermissionContext::GetApiPermissionStatus(
}
// FederatedIdentityApiPermissionContextDelegate
void ShellFederatedPermissionContext::RecordDismissAndEmbargo(
void InMemoryFederatedPermissionContext::RecordDismissAndEmbargo(
const url::Origin& relying_party_embedder) {
embargoed_origins_.insert(relying_party_embedder);
}
void ShellFederatedPermissionContext::RemoveEmbargoAndResetCounts(
void InMemoryFederatedPermissionContext::RemoveEmbargoAndResetCounts(
const url::Origin& relying_party_embedder) {
embargoed_origins_.erase(relying_party_embedder);
}
bool ShellFederatedPermissionContext::ShouldCompleteRequestImmediately() const {
return switches::IsRunWebTestsSwitchPresent();
bool InMemoryFederatedPermissionContext::ShouldCompleteRequestImmediately()
const {
return base::CommandLine::ForCurrentProcess()->HasSwitch("run-web-tests");
}
bool ShellFederatedPermissionContext::HasThirdPartyCookiesAccess(
bool InMemoryFederatedPermissionContext::HasThirdPartyCookiesAccess(
content::RenderFrameHost& host,
const GURL& provider_url,
const url::Origin& relying_party_embedder) const {
@ -59,24 +62,25 @@ bool ShellFederatedPermissionContext::HasThirdPartyCookiesAccess(
}) != has_third_party_cookies_access_.end();
}
void ShellFederatedPermissionContext::SetHasThirdPartyCookiesAccessForTesting(
const std::string& identity_provider,
const std::string& relying_party_embedder) {
void InMemoryFederatedPermissionContext::
SetHasThirdPartyCookiesAccessForTesting(
const std::string& identity_provider,
const std::string& relying_party_embedder) {
has_third_party_cookies_access_.insert(
std::pair(identity_provider, relying_party_embedder));
}
// FederatedIdentityAutoReauthnPermissionContextDelegate
bool ShellFederatedPermissionContext::IsAutoReauthnSettingEnabled() {
bool InMemoryFederatedPermissionContext::IsAutoReauthnSettingEnabled() {
return auto_reauthn_permission_;
}
bool ShellFederatedPermissionContext::IsAutoReauthnEmbargoed(
bool InMemoryFederatedPermissionContext::IsAutoReauthnEmbargoed(
const url::Origin& relying_party_embedder) {
return false;
}
void ShellFederatedPermissionContext::SetRequiresUserMediation(
void InMemoryFederatedPermissionContext::SetRequiresUserMediation(
const url::Origin& rp_origin,
bool requires_user_mediation) {
if (requires_user_mediation) {
@ -87,29 +91,29 @@ void ShellFederatedPermissionContext::SetRequiresUserMediation(
OnSetRequiresUserMediation(rp_origin, base::DoNothing());
}
bool ShellFederatedPermissionContext::RequiresUserMediation(
bool InMemoryFederatedPermissionContext::RequiresUserMediation(
const url::Origin& rp_origin) {
return require_user_mediation_sites_.contains(net::SchemefulSite(rp_origin));
}
void ShellFederatedPermissionContext::OnSetRequiresUserMediation(
void InMemoryFederatedPermissionContext::OnSetRequiresUserMediation(
const url::Origin& relying_party,
base::OnceClosure callback) {
std::move(callback).Run();
}
base::Time ShellFederatedPermissionContext::GetAutoReauthnEmbargoStartTime(
base::Time InMemoryFederatedPermissionContext::GetAutoReauthnEmbargoStartTime(
const url::Origin& relying_party_embedder) {
return base::Time();
}
void ShellFederatedPermissionContext::RecordEmbargoForAutoReauthn(
void InMemoryFederatedPermissionContext::RecordEmbargoForAutoReauthn(
const url::Origin& relying_party_embedder) {}
void ShellFederatedPermissionContext::RemoveEmbargoForAutoReauthn(
void InMemoryFederatedPermissionContext::RemoveEmbargoForAutoReauthn(
const url::Origin& relying_party_embedder) {}
void ShellFederatedPermissionContext::AddIdpSigninStatusObserver(
void InMemoryFederatedPermissionContext::AddIdpSigninStatusObserver(
IdpSigninStatusObserver* observer) {
if (idp_signin_status_observer_list_.HasObserver(observer)) {
return;
@ -118,12 +122,12 @@ void ShellFederatedPermissionContext::AddIdpSigninStatusObserver(
idp_signin_status_observer_list_.AddObserver(observer);
}
void ShellFederatedPermissionContext::RemoveIdpSigninStatusObserver(
void InMemoryFederatedPermissionContext::RemoveIdpSigninStatusObserver(
IdpSigninStatusObserver* observer) {
idp_signin_status_observer_list_.RemoveObserver(observer);
}
bool ShellFederatedPermissionContext::HasSharingPermission(
bool InMemoryFederatedPermissionContext::HasSharingPermission(
const url::Origin& relying_party_requester,
const url::Origin& relying_party_embedder,
const url::Origin& identity_provider) {
@ -138,7 +142,8 @@ bool ShellFederatedPermissionContext::HasSharingPermission(
}) != sharing_permissions_.end();
}
std::optional<base::Time> ShellFederatedPermissionContext::GetLastUsedTimestamp(
std::optional<base::Time>
InMemoryFederatedPermissionContext::GetLastUsedTimestamp(
const url::Origin& relying_party_requester,
const url::Origin& relying_party_embedder,
const url::Origin& identity_provider,
@ -157,7 +162,7 @@ std::optional<base::Time> ShellFederatedPermissionContext::GetLastUsedTimestamp(
: std::nullopt;
}
bool ShellFederatedPermissionContext::HasSharingPermission(
bool InMemoryFederatedPermissionContext::HasSharingPermission(
const url::Origin& relying_party_requester) {
return std::find_if(sharing_permissions_.begin(), sharing_permissions_.end(),
[&](const auto& entry) {
@ -166,7 +171,7 @@ bool ShellFederatedPermissionContext::HasSharingPermission(
}) != sharing_permissions_.end();
}
void ShellFederatedPermissionContext::GrantSharingPermission(
void InMemoryFederatedPermissionContext::GrantSharingPermission(
const url::Origin& relying_party_requester,
const url::Origin& relying_party_embedder,
const url::Origin& identity_provider,
@ -176,7 +181,7 @@ void ShellFederatedPermissionContext::GrantSharingPermission(
identity_provider.Serialize(), account_id));
}
void ShellFederatedPermissionContext::RevokeSharingPermission(
void InMemoryFederatedPermissionContext::RevokeSharingPermission(
const url::Origin& relying_party_requester,
const url::Origin& relying_party_embedder,
const url::Origin& identity_provider,
@ -205,7 +210,7 @@ void ShellFederatedPermissionContext::RevokeSharingPermission(
}
}
void ShellFederatedPermissionContext::RefreshExistingSharingPermission(
void InMemoryFederatedPermissionContext::RefreshExistingSharingPermission(
const url::Origin& relying_party_requester,
const url::Origin& relying_party_embedder,
const url::Origin& identity_provider,
@ -214,7 +219,7 @@ void ShellFederatedPermissionContext::RefreshExistingSharingPermission(
// does nothing.
}
std::optional<bool> ShellFederatedPermissionContext::GetIdpSigninStatus(
std::optional<bool> InMemoryFederatedPermissionContext::GetIdpSigninStatus(
const url::Origin& idp_origin) {
auto idp_signin_status = idp_signin_status_.find(idp_origin.Serialize());
if (idp_signin_status != idp_signin_status_.end()) {
@ -224,7 +229,7 @@ std::optional<bool> ShellFederatedPermissionContext::GetIdpSigninStatus(
}
}
void ShellFederatedPermissionContext::SetIdpSigninStatus(
void InMemoryFederatedPermissionContext::SetIdpSigninStatus(
const url::Origin& idp_origin,
bool idp_signin_status) {
idp_signin_status_[idp_origin.Serialize()] = idp_signin_status;
@ -233,22 +238,37 @@ void ShellFederatedPermissionContext::SetIdpSigninStatus(
}
// TODO(crbug.com/40245925): Replace this with AddIdpSigninStatusObserver.
if (idp_signin_status_closure_)
if (idp_signin_status_closure_) {
idp_signin_status_closure_.Run();
}
}
void ShellFederatedPermissionContext::RegisterIdP(const ::GURL& configURL) {
void InMemoryFederatedPermissionContext::RegisterIdP(const ::GURL& configURL) {
idp_registry_.push_back(configURL);
}
void ShellFederatedPermissionContext::UnregisterIdP(const ::GURL& configURL) {
void InMemoryFederatedPermissionContext::UnregisterIdP(
const ::GURL& configURL) {
idp_registry_.erase(
std::remove(idp_registry_.begin(), idp_registry_.end(), configURL),
idp_registry_.end());
}
std::vector<GURL> ShellFederatedPermissionContext::GetRegisteredIdPs() {
std::vector<GURL> InMemoryFederatedPermissionContext::GetRegisteredIdPs() {
return idp_registry_;
}
void InMemoryFederatedPermissionContext::ResetForTesting() {
request_permissions_.clear();
sharing_permissions_.clear();
idp_signin_status_.clear();
has_third_party_cookies_access_.clear();
idp_signin_status_observer_list_.Clear();
idp_signin_status_closure_.Reset();
auto_reauthn_permission_ = true;
idp_registry_.clear();
embargoed_origins_.clear();
require_user_mediation_sites_.clear();
}
} // namespace content

@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_BROWSER_SHELL_FEDERATED_PERMISSION_CONTEXT_H_
#define CONTENT_SHELL_BROWSER_SHELL_FEDERATED_PERMISSION_CONTEXT_H_
#ifndef CONTENT_BROWSER_IN_MEMORY_FEDERATED_PERMISSION_CONTEXT_H_
#define CONTENT_BROWSER_IN_MEMORY_FEDERATED_PERMISSION_CONTEXT_H_
#include <map>
#include <set>
@ -14,6 +14,7 @@
#include "base/functional/callback.h"
#include "base/observer_list.h"
#include "base/time/time.h"
#include "content/common/content_export.h"
#include "content/public/browser/federated_identity_api_permission_context_delegate.h"
#include "content/public/browser/federated_identity_auto_reauthn_permission_context_delegate.h"
#include "content/public/browser/federated_identity_permission_context_delegate.h"
@ -26,16 +27,15 @@ class Origin;
namespace content {
// This class implements the various FedCM delegates for content_shell.
// It is used to store permission and login state in memory, so that we
// can run wpt tests against it.
class ShellFederatedPermissionContext
// This class implements the various FedCM delegates. It is used to store
// permission and login state in memory as a default implementation.
class InMemoryFederatedPermissionContext
: public FederatedIdentityApiPermissionContextDelegate,
public FederatedIdentityAutoReauthnPermissionContextDelegate,
public FederatedIdentityPermissionContextDelegate {
public:
ShellFederatedPermissionContext();
~ShellFederatedPermissionContext() override;
InMemoryFederatedPermissionContext();
~InMemoryFederatedPermissionContext() override;
// FederatedIdentityApiPermissionContextDelegate
content::FederatedIdentityApiPermissionContextDelegate::PermissionStatus
@ -106,10 +106,12 @@ class ShellFederatedPermissionContext
idp_signin_status_closure_ = std::move(closure);
}
void SetHasThirdPartyCookiesAccessForTesting(
CONTENT_EXPORT void SetHasThirdPartyCookiesAccessForTesting(
const std::string& identity_provider,
const std::string& relying_party_embedder);
CONTENT_EXPORT void ResetForTesting();
private:
// Pairs of <RP embedder, IDP>
std::set<std::pair<std::string, std::string>> request_permissions_;
@ -139,4 +141,4 @@ class ShellFederatedPermissionContext
} // namespace content
#endif // CONTENT_SHELL_BROWSER_SHELL_FEDERATED_PERMISSION_CONTEXT_H_
#endif // CONTENT_BROWSER_IN_MEMORY_FEDERATED_PERMISSION_CONTEXT_H_

@ -20,6 +20,7 @@
#include "base/test/values_test_util.h"
#include "base/values.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "content/browser/in_memory_federated_permission_context.h"
#include "content/browser/webid/fake_identity_request_dialog_controller.h"
#include "content/browser/webid/identity_registry.h"
#include "content/browser/webid/test/mock_digital_identity_provider.h"
@ -37,7 +38,6 @@
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
#include "content/shell/browser/shell_federated_permission_context.h"
#include "net/base/features.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_status_code.h"
@ -405,9 +405,9 @@ class WebIdIdpSigninStatusBrowserTest : public WebIdBrowserTest {
command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
}
ShellFederatedPermissionContext* sharing_context() {
InMemoryFederatedPermissionContext* sharing_context() {
BrowserContext* context = shell()->web_contents()->GetBrowserContext();
return static_cast<ShellFederatedPermissionContext*>(
return static_cast<InMemoryFederatedPermissionContext*>(
context->GetFederatedIdentityPermissionContext());
}
};
@ -423,9 +423,9 @@ class WebIdIdpSigninStatusForFetchKeepAliveBrowserTest
command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
}
ShellFederatedPermissionContext* sharing_context() {
InMemoryFederatedPermissionContext* sharing_context() {
BrowserContext* context = shell()->web_contents()->GetBrowserContext();
return static_cast<ShellFederatedPermissionContext*>(
return static_cast<InMemoryFederatedPermissionContext*>(
context->GetFederatedIdentityPermissionContext());
}
};
@ -444,9 +444,9 @@ class WebIdIdPRegistryBrowserTest : public WebIdBrowserTest {
command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
}
ShellFederatedPermissionContext* sharing_context() {
InMemoryFederatedPermissionContext* sharing_context() {
BrowserContext* context = shell()->web_contents()->GetBrowserContext();
return static_cast<ShellFederatedPermissionContext*>(
return static_cast<InMemoryFederatedPermissionContext*>(
context->GetFederatedIdentityPermissionContext());
}
};
@ -1165,9 +1165,9 @@ class WebIdDigitalCredentialsBrowserTest : public WebIdBrowserTest {
command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
}
ShellFederatedPermissionContext* sharing_context() {
InMemoryFederatedPermissionContext* sharing_context() {
BrowserContext* context = shell()->web_contents()->GetBrowserContext();
return static_cast<ShellFederatedPermissionContext*>(
return static_cast<InMemoryFederatedPermissionContext*>(
context->GetFederatedIdentityPermissionContext());
}
@ -1640,7 +1640,7 @@ IN_PROC_BROWSER_TEST_F(WebIdBrowserTest,
// The client id `client_id_1` is on the `approved_clients` list defined in
// content/test/data/fedcm/accounts_endpoint.json so by exempting the IdP from
// the check, auto re-authn can be triggered and a token can be returned.
static_cast<ShellFederatedPermissionContext*>(
static_cast<InMemoryFederatedPermissionContext*>(
shell()
->web_contents()
->GetBrowserContext()

@ -185,8 +185,6 @@ static_library("content_shell_lib") {
"browser/shell_devtools_manager_delegate.h",
"browser/shell_download_manager_delegate.cc",
"browser/shell_download_manager_delegate.h",
"browser/shell_federated_permission_context.cc",
"browser/shell_federated_permission_context.h",
"browser/shell_javascript_dialog.h",
"browser/shell_javascript_dialog_manager.cc",
"browser/shell_javascript_dialog_manager.h",

@ -31,7 +31,6 @@
#include "content/shell/browser/shell_content_browser_client.h"
#include "content/shell/browser/shell_content_index_provider.h"
#include "content/shell/browser/shell_download_manager_delegate.h"
#include "content/shell/browser/shell_federated_permission_context.h"
#include "content/shell/browser/shell_paths.h"
#include "content/shell/browser/shell_permission_manager.h"
#include "content/shell/common/shell_switches.h"
@ -188,33 +187,6 @@ ContentIndexProvider* ShellBrowserContext::GetContentIndexProvider() {
return content_index_provider_.get();
}
FederatedIdentityApiPermissionContextDelegate*
ShellBrowserContext::GetFederatedIdentityApiPermissionContext() {
return GetShellFederatedPermissionContext();
}
FederatedIdentityAutoReauthnPermissionContextDelegate*
ShellBrowserContext::GetFederatedIdentityAutoReauthnPermissionContext() {
return GetShellFederatedPermissionContext();
}
FederatedIdentityPermissionContextDelegate*
ShellBrowserContext::GetFederatedIdentityPermissionContext() {
return GetShellFederatedPermissionContext();
}
ShellFederatedPermissionContext*
ShellBrowserContext::GetShellFederatedPermissionContext() {
if (!federated_permission_context_)
federated_permission_context_ =
std::make_unique<ShellFederatedPermissionContext>();
return federated_permission_context_.get();
}
void ShellBrowserContext::ResetFederatedPermissionContext() {
federated_permission_context_.reset();
}
ReduceAcceptLanguageControllerDelegate*
ShellBrowserContext::GetReduceAcceptLanguageControllerDelegate() {
if (!reduce_accept_lang_controller_delegate_) {

@ -23,7 +23,6 @@ class OriginTrialsControllerDelegate;
class PermissionControllerDelegate;
class ReduceAcceptLanguageControllerDelegate;
class ShellDownloadManagerDelegate;
class ShellFederatedPermissionContext;
class ZoomLevelDelegate;
class ShellBrowserContext : public BrowserContext {
@ -61,19 +60,10 @@ class ShellBrowserContext : public BrowserContext {
BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate() override;
ContentIndexProvider* GetContentIndexProvider() override;
ClientHintsControllerDelegate* GetClientHintsControllerDelegate() override;
FederatedIdentityApiPermissionContextDelegate*
GetFederatedIdentityApiPermissionContext() override;
FederatedIdentityAutoReauthnPermissionContextDelegate*
GetFederatedIdentityAutoReauthnPermissionContext() override;
FederatedIdentityPermissionContextDelegate*
GetFederatedIdentityPermissionContext() override;
ReduceAcceptLanguageControllerDelegate*
GetReduceAcceptLanguageControllerDelegate() override;
OriginTrialsControllerDelegate* GetOriginTrialsControllerDelegate() override;
ShellFederatedPermissionContext* GetShellFederatedPermissionContext();
void ResetFederatedPermissionContext();
protected:
bool ignore_certificate_errors() const { return ignore_certificate_errors_; }
@ -81,8 +71,6 @@ class ShellBrowserContext : public BrowserContext {
std::unique_ptr<PermissionControllerDelegate> permission_manager_;
std::unique_ptr<BackgroundSyncController> background_sync_controller_;
std::unique_ptr<ContentIndexProvider> content_index_provider_;
std::unique_ptr<ShellFederatedPermissionContext>
federated_permission_context_;
std::unique_ptr<ReduceAcceptLanguageControllerDelegate>
reduce_accept_lang_controller_delegate_;
std::unique_ptr<OriginTrialsControllerDelegate>

@ -49,6 +49,7 @@
#include "components/custom_handlers/simple_protocol_handler_registry_factory.h"
#include "content/browser/aggregation_service/aggregation_service.h"
#include "content/browser/attribution_reporting/attribution_manager.h"
#include "content/browser/in_memory_federated_permission_context.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/navigation_request.h"
@ -79,7 +80,6 @@
#include "content/shell/browser/shell_content_browser_client.h"
#include "content/shell/browser/shell_content_index_provider.h"
#include "content/shell/browser/shell_devtools_frontend.h"
#include "content/shell/browser/shell_federated_permission_context.h"
#include "content/test/mock_platform_notification_service.h"
#include "content/test/storage_partition_test_helpers.h"
#include "content/web_test/browser/devtools_protocol_test_bindings.h"
@ -755,7 +755,9 @@ void WebTestControlHost::ResetBrowserAfterWebTest() {
ShellBrowserContext* browser_context =
ShellContentBrowserClient::Get()->browser_context();
browser_context->ResetFederatedPermissionContext();
static_cast<InMemoryFederatedPermissionContext*>(
browser_context->GetFederatedIdentityPermissionContext())
->ResetForTesting();
// Delete any ScopedVirtualPressureSourceForDevTools and
// WebTestPressureManager instances created by WebTestContentBrowserClient.