#include "remoting/host/webauthn/remote_webauthn_native_messaging_host.h"
#include <memory>
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/ranges/algorithm.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "remoting/base/logging.h"
#include "remoting/host/chromoting_host_services_client.h"
#include "remoting/host/mojom/webauthn_proxy.mojom.h"
#include "remoting/host/native_messaging/native_messaging_constants.h"
#include "remoting/host/native_messaging/native_messaging_helpers.h"
#include "remoting/host/webauthn/remote_webauthn_constants.h"
namespace remoting {
namespace {
base::Value::Dict CreateWebAuthnExceptionDetailsDict(
const std::string& name,
const std::string& message) { … }
base::Value::Dict MojoErrorToErrorDict(
const mojom::WebAuthnExceptionDetailsPtr& mojo_error) { … }
}
RemoteWebAuthnNativeMessagingHost::RemoteWebAuthnNativeMessagingHost(
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
RemoteWebAuthnNativeMessagingHost::RemoteWebAuthnNativeMessagingHost(
std::unique_ptr<ChromotingHostServicesProvider> host_service_api_client,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
RemoteWebAuthnNativeMessagingHost::~RemoteWebAuthnNativeMessagingHost() { … }
void RemoteWebAuthnNativeMessagingHost::OnMessage(const std::string& message) { … }
void RemoteWebAuthnNativeMessagingHost::Start(
extensions::NativeMessageHost::Client* client) { … }
scoped_refptr<base::SingleThreadTaskRunner>
RemoteWebAuthnNativeMessagingHost::task_runner() const { … }
void RemoteWebAuthnNativeMessagingHost::ProcessHello(
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::ProcessIsUvpaa(
const base::Value::Dict& request,
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::ProcessCreate(
const base::Value::Dict& request,
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::ProcessGet(
const base::Value::Dict& request,
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::ProcessCancel(
const base::Value::Dict& request,
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::ProcessGetRemoteState(
base::Value::Dict response) { … }
void RemoteWebAuthnNativeMessagingHost::OnQueryVersionResult(uint32_t version) { … }
void RemoteWebAuthnNativeMessagingHost::OnIpcDisconnected() { … }
void RemoteWebAuthnNativeMessagingHost::OnIsUvpaaResponse(
base::Value::Dict response,
bool is_available) { … }
void RemoteWebAuthnNativeMessagingHost::OnCreateResponse(
base::Value::Dict response,
mojom::WebAuthnCreateResponsePtr remote_response) { … }
void RemoteWebAuthnNativeMessagingHost::OnGetResponse(
base::Value::Dict response,
mojom::WebAuthnGetResponsePtr remote_response) { … }
void RemoteWebAuthnNativeMessagingHost::OnCancelResponse(
base::Value::Dict response,
bool was_canceled) { … }
void RemoteWebAuthnNativeMessagingHost::QueryNextRemoteState() { … }
void RemoteWebAuthnNativeMessagingHost::SendNextRemoteState(bool is_remoted) { … }
bool RemoteWebAuthnNativeMessagingHost::EnsureIpcConnection() { … }
void RemoteWebAuthnNativeMessagingHost::SendMessageToClient(
base::Value::Dict message) { … }
const base::Value* RemoteWebAuthnNativeMessagingHost::FindMessageIdOrSendError(
base::Value::Dict& response) { … }
const std::string*
RemoteWebAuthnNativeMessagingHost::FindRequestDataOrSendError(
const base::Value::Dict& request,
const std::string& request_data_key,
base::Value::Dict& response) { … }
mojo::PendingReceiver<mojom::WebAuthnRequestCanceller>
RemoteWebAuthnNativeMessagingHost::AddRequestCanceller(base::Value message_id) { … }
void RemoteWebAuthnNativeMessagingHost::RemoveRequestCancellerByMessageId(
const base::Value& message_id) { … }
void RemoteWebAuthnNativeMessagingHost::OnRequestCancellerDisconnected(
mojo::RemoteSetElementId disconnecting_canceller) { … }
void RemoteWebAuthnNativeMessagingHost::SendClientDisconnectedMessage() { … }
}