#include "chrome/browser/webauthn/authenticator_request_dialog_model.h"
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include "base/containers/fixed_flat_map.h"
#include "base/functional/callback.h"
#include "base/observer_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/ui/webauthn/authenticator_request_dialog.h"
#include "chrome/browser/ui/webauthn/authenticator_request_window.h"
#include "chrome/browser/webauthn/authenticator_transport.h"
#include "chrome/browser/webauthn/webauthn_pref_names.h"
#include "components/device_event_log/device_event_log.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "device/fido/fido_types.h"
#include "ui/gfx/paint_vector_icon.h"
namespace {
enum class StepUIType { … };
StepUIType step_ui_type(AuthenticatorRequestDialogModel::Step step) { … }
std::optional<content::GlobalRenderFrameHostId> FrameHostIdFromMaybeNull(
content::RenderFrameHost* render_frame_host) { … }
content::WebContents* GetWebContentsFromFrameHostId(
std::optional<content::GlobalRenderFrameHostId> frame_host_id) { … }
}
#define AUTHENTICATOR_REQUEST_EVENT_0 …
#define AUTHENTICATOR_REQUEST_EVENT_1 …
AUTHENTICATOR_EVENTS
#undef AUTHENTICATOR_REQUEST_EVENT_0
#undef AUTHENTICATOR_REQUEST_EVENT_1
AuthenticatorRequestDialogModel::AuthenticatorRequestDialogModel(
content::RenderFrameHost* render_frame_host)
: … { … }
AuthenticatorRequestDialogModel::~AuthenticatorRequestDialogModel() { … }
void AuthenticatorRequestDialogModel::AddObserver(
AuthenticatorRequestDialogModel::Observer* observer) { … }
void AuthenticatorRequestDialogModel::RemoveObserver(
AuthenticatorRequestDialogModel::Observer* observer) { … }
void AuthenticatorRequestDialogModel::SetStep(Step step) { … }
void AuthenticatorRequestDialogModel::DisableUiOrShowLoadingDialog() { … }
bool AuthenticatorRequestDialogModel::should_dialog_be_closed() const { … }
std::optional<AccountInfo>
AuthenticatorRequestDialogModel::GetGpmAccountInfo() { … }
std::string AuthenticatorRequestDialogModel::GetGpmAccountEmail() { … }
Profile* AuthenticatorRequestDialogModel::GetProfile() { … }
#define AUTHENTICATOR_REQUEST_EVENT_0 …
#define AUTHENTICATOR_REQUEST_EVENT_1 …
AUTHENTICATOR_EVENTS
#undef AUTHENTICATOR_REQUEST_EVENT_0
#undef AUTHENTICATOR_REQUEST_EVENT_1
std::ostream& operator<<(std::ostream& os,
const AuthenticatorRequestDialogModel::Step& step) { … }
AuthenticatorRequestDialogModel::Mechanism::Mechanism(
AuthenticatorRequestDialogModel::Mechanism::Type in_type,
std::u16string in_name,
std::u16string in_short_name,
const gfx::VectorIcon& in_icon,
base::RepeatingClosure in_callback)
: … { … }
AuthenticatorRequestDialogModel::Mechanism::~Mechanism() = default;
AuthenticatorRequestDialogModel::Mechanism::Mechanism(Mechanism&&) = default;
AuthenticatorRequestDialogModel::Mechanism::CredentialInfo::CredentialInfo(
device::AuthenticatorType source_in,
std::vector<uint8_t> user_id_in)
: … { … }
AuthenticatorRequestDialogModel::Mechanism::CredentialInfo::CredentialInfo(
const CredentialInfo&) = default;
AuthenticatorRequestDialogModel::Mechanism::CredentialInfo::~CredentialInfo() =
default;
bool AuthenticatorRequestDialogModel::Mechanism::CredentialInfo::operator==(
const CredentialInfo&) const = default;