#include "device/fido/fido_request_handler_base.h"
#include <string_view>
#include <utility>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/device_event_log/device_event_log.h"
#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "device/fido/ble_adapter_manager.h"
#include "device/fido/discoverable_credential_metadata.h"
#include "device/fido/features.h"
#include "device/fido/fido_authenticator.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_discovery_base.h"
#include "device/fido/fido_discovery_factory.h"
#include "device/fido/mac/icloud_keychain.h"
#if BUILDFLAG(IS_WIN)
#include "device/fido/win/authenticator.h"
#include "device/fido/win/util.h"
#include "device/fido/win/webauthn_api.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/process/process_info.h"
#include "device/fido/mac/util.h"
#endif
namespace device {
namespace {
bool IsGpmPasskeyAuthenticator(const FidoAuthenticator& authenticator) { … }
void MaybeRecordPlatformCredentialStatus(AuthenticatorType type,
base::TimeDelta elapsed_time) { … }
}
struct TransportAvailabilityCallbackReadiness { … };
FidoRequestHandlerBase::TransportAvailabilityInfo::TransportAvailabilityInfo() =
default;
FidoRequestHandlerBase::TransportAvailabilityInfo::TransportAvailabilityInfo(
const TransportAvailabilityInfo& data) = default;
FidoRequestHandlerBase::TransportAvailabilityInfo&
FidoRequestHandlerBase::TransportAvailabilityInfo::operator=(
const TransportAvailabilityInfo& other) = default;
FidoRequestHandlerBase::TransportAvailabilityInfo::
~TransportAvailabilityInfo() = default;
FidoRequestHandlerBase::Observer::~Observer() = default;
static bool g_always_allow_ble_calls = …;
FidoRequestHandlerBase::ScopedAlwaysAllowBLECalls::ScopedAlwaysAllowBLECalls() { … }
FidoRequestHandlerBase::ScopedAlwaysAllowBLECalls::
~ScopedAlwaysAllowBLECalls() { … }
FidoRequestHandlerBase::FidoRequestHandlerBase()
: … { … }
FidoRequestHandlerBase::FidoRequestHandlerBase(
FidoDiscoveryFactory* fido_discovery_factory,
const base::flat_set<FidoTransportProtocol>& available_transports)
: … { … }
FidoRequestHandlerBase::FidoRequestHandlerBase(
FidoDiscoveryFactory* fido_discovery_factory,
std::vector<std::unique_ptr<FidoDiscoveryBase>> additional_discoveries,
const base::flat_set<FidoTransportProtocol>& available_transports)
: … { … }
void FidoRequestHandlerBase::InitDiscoveries(
FidoDiscoveryFactory* fido_discovery_factory,
std::vector<std::unique_ptr<FidoDiscoveryBase>> additional_discoveries,
base::flat_set<FidoTransportProtocol> available_transports,
bool consider_enclave) { … }
FidoRequestHandlerBase::~FidoRequestHandlerBase() { … }
void FidoRequestHandlerBase::StartAuthenticatorRequest(
const std::string& authenticator_id) { … }
void FidoRequestHandlerBase::CancelActiveAuthenticators(
std::string_view exclude_device_id) { … }
void FidoRequestHandlerBase::OnBluetoothAdapterEnumerated(
bool is_present,
BleStatus ble_status,
bool can_power_on,
bool is_peripheral_role_supported) { … }
void FidoRequestHandlerBase::OnBluetoothAdapterStatusChanged(
BleStatus ble_status) { … }
void FidoRequestHandlerBase::PowerOnBluetoothAdapter() { … }
void FidoRequestHandlerBase::RequestBluetoothPermission(
BlePermissionCallback callback) { … }
base::WeakPtr<FidoRequestHandlerBase> FidoRequestHandlerBase::GetWeakPtr() { … }
void FidoRequestHandlerBase::set_observer(
FidoRequestHandlerBase::Observer* observer) { … }
void FidoRequestHandlerBase::Start() { … }
void FidoRequestHandlerBase::AuthenticatorRemoved(
FidoDiscoveryBase* discovery,
FidoAuthenticator* authenticator) { … }
void FidoRequestHandlerBase::DiscoveryStarted(
FidoDiscoveryBase* discovery,
bool success,
std::vector<FidoAuthenticator*> authenticators) { … }
void FidoRequestHandlerBase::AuthenticatorAdded(
FidoDiscoveryBase* discovery,
FidoAuthenticator* authenticator) { … }
void FidoRequestHandlerBase::GetPlatformCredentialStatus(
FidoAuthenticator* platform_authenticator) { … }
void FidoRequestHandlerBase::OnHavePlatformCredentialStatus(
AuthenticatorType authenticator_type,
std::optional<base::ElapsedTimer> timer,
std::vector<DiscoverableCredentialMetadata> creds,
RecognizedCredential has_credentials) { … }
bool FidoRequestHandlerBase::HasAuthenticator(
const std::string& authenticator_id) const { … }
void FidoRequestHandlerBase::MaybeSignalTransportsEnumerated() { … }
void FidoRequestHandlerBase::InitializeAuthenticatorAndDispatchRequest(
const std::string& authenticator_id) { … }
void FidoRequestHandlerBase::ConstructBleAdapterPowerManager() { … }
void FidoRequestHandlerBase::OnWinIsUvpaa(bool is_uvpaa) { … }
void FidoRequestHandlerBase::StopDiscoveries() { … }
constexpr base::TimeDelta
FidoRequestHandlerBase::kMinExpectedAuthenticatorResponseTime;
}