#include "chrome/browser/extensions/api/web_authentication_proxy/web_authentication_proxy_service.h"
#include <limits>
#include "base/functional/overloaded.h"
#include "base/json/json_string_value_serializer.h"
#include "base/no_destructor.h"
#include "base/rand_util.h"
#include "base/sequence_checker.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/web_authentication_proxy.h"
#include "components/webauthn/json/value_conversions.h"
#include "content/public/browser/browser_context.h"
#include "device/fido/public_key_credential_rp_entity.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/event_router_factory.h"
#include "extensions/browser/extension_event_histogram_value.h"
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extension_util.h"
#include "extensions/common/permissions/permissions_data.h"
#include "services/data_decoder/public/cpp/data_decoder.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom-shared.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "url/gurl.h"
namespace extensions {
namespace {
bool ProxyMayAttachToHost(const Extension& extension,
const url::Origin& origin) { … }
}
WebAuthenticationProxyRegistrar::WebAuthenticationProxyRegistrar(
Profile* profile)
: … { … }
WebAuthenticationProxyRegistrar::~WebAuthenticationProxyRegistrar() = default;
bool WebAuthenticationProxyRegistrar::SetRequestProxy(
Profile* profile,
const Extension* extension) { … }
void WebAuthenticationProxyRegistrar::ClearRequestProxy(Profile* profile) { … }
WebAuthenticationProxyRegistrar::ProxyStatus
WebAuthenticationProxyRegistrar::ProxyActiveForProfile(Profile* profile) { … }
void WebAuthenticationProxyRegistrar::OnExtensionUnloaded(
content::BrowserContext* browser_context,
const Extension* extension,
UnloadedExtensionReason reason) { … }
void WebAuthenticationProxyRegistrar::OnOffTheRecordProfileCreated(
Profile* otr_profile) { … }
void WebAuthenticationProxyRegistrar::OnProfileWillBeDestroyed(
Profile* profile) { … }
WebAuthenticationProxyRegistrarFactory*
WebAuthenticationProxyRegistrarFactory::GetInstance() { … }
WebAuthenticationProxyRegistrarFactory::WebAuthenticationProxyRegistrarFactory()
: … { … }
WebAuthenticationProxyRegistrarFactory::
~WebAuthenticationProxyRegistrarFactory() = default;
WebAuthenticationProxyRegistrar*
WebAuthenticationProxyRegistrarFactory::GetForBrowserContext(
content::BrowserContext* context) { … }
std::unique_ptr<KeyedService>
WebAuthenticationProxyRegistrarFactory::BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const { … }
WebAuthenticationProxyService*
WebAuthenticationProxyService::GetIfProxyAttached(
content::BrowserContext* browser_context) { … }
WebAuthenticationProxyService::WebAuthenticationProxyService(
content::BrowserContext* browser_context)
: … { … }
WebAuthenticationProxyService::~WebAuthenticationProxyService() = default;
const Extension* WebAuthenticationProxyService::GetActiveRequestProxy() { … }
void WebAuthenticationProxyService::CompleteCreateRequest(
const api::web_authentication_proxy::CreateResponseDetails& details,
RespondCallback respond_callback) { … }
void WebAuthenticationProxyService::CompleteGetRequest(
const api::web_authentication_proxy::GetResponseDetails& details,
RespondCallback respond_callback) { … }
bool WebAuthenticationProxyService::CompleteIsUvpaaRequest(
const api::web_authentication_proxy::IsUvpaaResponseDetails& details) { … }
void WebAuthenticationProxyService::CancelRequest(RequestId request_id) { … }
void WebAuthenticationProxyService::SetRequestProxy(
base::PassKey<WebAuthenticationProxyRegistrar>,
const Extension* extension) { … }
void WebAuthenticationProxyService::ClearRequestProxy(
base::PassKey<WebAuthenticationProxyRegistrar>) { … }
void WebAuthenticationProxyService::CancelPendingCallbacks() { … }
WebAuthenticationProxyService::RequestId
WebAuthenticationProxyService::NewRequestId() { … }
void WebAuthenticationProxyService::OnParseCreateResponse(
RespondCallback respond_callback,
RequestId request_id,
data_decoder::DataDecoder::ValueOrError value_or_error) { … }
void WebAuthenticationProxyService::OnParseGetResponse(
RespondCallback respond_callback,
RequestId request_id,
data_decoder::DataDecoder::ValueOrError value_or_error) { … }
bool WebAuthenticationProxyService::IsActive(const url::Origin& caller_origin) { … }
WebAuthenticationProxyService::RequestId
WebAuthenticationProxyService::SignalCreateRequest(
const blink::mojom::PublicKeyCredentialCreationOptionsPtr& options_ptr,
CreateCallback callback) { … }
WebAuthenticationProxyService::RequestId
WebAuthenticationProxyService::SignalGetRequest(
const blink::mojom::PublicKeyCredentialRequestOptionsPtr& options_ptr,
GetCallback callback) { … }
WebAuthenticationProxyService::RequestId
WebAuthenticationProxyService::SignalIsUvpaaRequest(IsUvpaaCallback callback) { … }
WebAuthenticationProxyServiceFactory*
WebAuthenticationProxyServiceFactory::GetInstance() { … }
WebAuthenticationProxyServiceFactory::WebAuthenticationProxyServiceFactory()
: … { … }
WebAuthenticationProxyServiceFactory::~WebAuthenticationProxyServiceFactory() =
default;
WebAuthenticationProxyService*
WebAuthenticationProxyServiceFactory::GetForBrowserContext(
content::BrowserContext* context) { … }
KeyedService* WebAuthenticationProxyServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { … }
}