#include "chrome/browser/digital_credentials/digital_identity_provider_desktop.h"
#include <memory>
#include "base/containers/span.h"
#include "base/functional/overloaded.h"
#include "base/json/json_writer.h"
#include "chrome/browser/digital_credentials/digital_identity_low_risk_origins.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/ui/views/digital_credentials/digital_identity_bluetooth_manual_dialog_controller.h"
#include "chrome/browser/ui/views/digital_credentials/digital_identity_multi_step_dialog.h"
#include "chrome/browser/ui/views/digital_credentials/digital_identity_safety_interstitial_controller_desktop.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
#include "components/qr_code_generator/bitmap_generator.h"
#include "components/url_formatter/elide_url.h"
#include "content/public/browser/digital_credentials_cross_device.h"
#include "content/public/browser/digital_identity_provider.h"
#include "content/public/browser/web_contents.h"
#include "crypto/random.h"
#include "device/fido/cable/v2_constants.h"
#include "device/fido/cable/v2_handshake.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/dialog_model.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/bubble/bubble_dialog_model_host.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/widget/widget.h"
namespace {
const int kQrCodeSize = …;
DigitalIdentityInterstitialAbortCallback;
RequestStatusForMetrics;
Error;
Event;
ProtocolError;
RemoteError;
Response;
SystemError;
SystemEvent;
Transaction;
void RunDigitalIdentityCallback(
std::unique_ptr<DigitalIdentitySafetyInterstitialControllerDesktop>
controller,
content::DigitalIdentityProvider::DigitalIdentityInterstitialCallback
callback,
content::DigitalIdentityProvider::RequestStatusForMetrics
status_for_metrics) { … }
std::unique_ptr<views::View> MakeQrCodeImageView(const std::string& qr_url) { … }
}
DigitalIdentityProviderDesktop::DigitalIdentityProviderDesktop() = default;
DigitalIdentityProviderDesktop::~DigitalIdentityProviderDesktop() = default;
bool DigitalIdentityProviderDesktop::IsLowRiskOrigin(
const url::Origin& to_check) const { … }
DigitalIdentityInterstitialAbortCallback
DigitalIdentityProviderDesktop::ShowDigitalIdentityInterstitial(
content::WebContents& web_contents,
const url::Origin& origin,
content::DigitalIdentityInterstitialType interstitial_type,
DigitalIdentityInterstitialCallback callback) { … }
void DigitalIdentityProviderDesktop::Request(content::WebContents* web_contents,
const url::Origin& rp_origin,
base::Value request,
DigitalIdentityCallback callback) { … }
void DigitalIdentityProviderDesktop::OnEvent(Event event) { … }
void DigitalIdentityProviderDesktop::OnFinished(
base::expected<Response, Error> result) { … }
DigitalIdentityMultiStepDialog*
DigitalIdentityProviderDesktop::EnsureDialogCreated() { … }
void DigitalIdentityProviderDesktop::ShowQrCodeDialog() { … }
void DigitalIdentityProviderDesktop::ShowBluetoothManualTurnOnDialog() { … }
void DigitalIdentityProviderDesktop::OnUserRequestedBluetoothPowerOn() { … }
void DigitalIdentityProviderDesktop::OnCanceled() { … }
void DigitalIdentityProviderDesktop::EndRequestWithError(
RequestStatusForMetrics status) { … }