#include "device/fido/enclave/enclave_websocket_client.h"
#include <limits>
#include "components/device_event_log/device_event_log.h"
#include "device/fido/fido_constants.h"
#include "device/fido/fido_parsing_utils.h"
#include "device/fido/network_context_factory.h"
#include "net/http/http_request_headers.h"
#include "net/storage_access_api/status.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
namespace device::enclave {
namespace {
constexpr char kEnclaveWebSocketProtocol[] = …;
constexpr size_t kMaxIncomingMessageSize = …;
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
}
EnclaveWebSocketClient::EnclaveWebSocketClient(
const GURL& service_url,
std::string access_token,
std::optional<std::string> reauthentication_token,
NetworkContextFactory network_context_factory,
OnResponseCallback on_response)
: … { … }
EnclaveWebSocketClient::~EnclaveWebSocketClient() = default;
void EnclaveWebSocketClient::Write(base::span<const uint8_t> data) { … }
void EnclaveWebSocketClient::Connect() { … }
void EnclaveWebSocketClient::InternalWrite(base::span<const uint8_t> data) { … }
void EnclaveWebSocketClient::OnOpeningHandshakeStarted(
network::mojom::WebSocketHandshakeRequestPtr request) { … }
void EnclaveWebSocketClient::OnFailure(const std::string& message,
int net_error,
int response_code) { … }
void EnclaveWebSocketClient::OnConnectionEstablished(
mojo::PendingRemote<network::mojom::WebSocket> socket,
mojo::PendingReceiver<network::mojom::WebSocketClient> client_receiver,
network::mojom::WebSocketHandshakeResponsePtr response,
mojo::ScopedDataPipeConsumerHandle readable,
mojo::ScopedDataPipeProducerHandle writable) { … }
void EnclaveWebSocketClient::OnDataFrame(
bool finish,
network::mojom::WebSocketMessageType type,
uint64_t data_len) { … }
void EnclaveWebSocketClient::OnDropChannel(bool was_clean,
uint16_t code,
const std::string& reason) { … }
void EnclaveWebSocketClient::OnClosingHandshake() { … }
void EnclaveWebSocketClient::ReadFromDataPipe(MojoResult,
const mojo::HandleSignalsState&) { … }
void EnclaveWebSocketClient::ProcessCompletedResponse() { … }
void EnclaveWebSocketClient::ClosePipe(SocketStatus status) { … }
void EnclaveWebSocketClient::OnMojoPipeDisconnect() { … }
}