#include "remoting/host/security_key/security_key_extension_session.h"
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/task/single_thread_task_runner.h"
#include "base/values.h"
#include "remoting/base/logging.h"
#include "remoting/host/client_session_details.h"
#include "remoting/host/security_key/security_key_auth_handler.h"
#include "remoting/proto/control.pb.h"
#include "remoting/protocol/client_stub.h"
namespace {
const char kExtensionMessageType[] = …;
const char kConnectionId[] = …;
const char kControlMessage[] = …;
const char kControlOption[] = …;
const char kDataMessage[] = …;
const char kDataPayload[] = …;
const char kErrorMessage[] = …;
const char kSecurityKeyAuthV1[] = …;
const char kMessageType[] = …;
unsigned int GetCommandCode(const std::string& data) { … }
bool ConvertListToString(const base::Value::List& bytes, std::string* out) { … }
}
namespace remoting {
SecurityKeyExtensionSession::SecurityKeyExtensionSession(
ClientSessionDetails* client_session_details,
protocol::ClientStub* client_stub,
scoped_refptr<base::SingleThreadTaskRunner> file_task_runner)
: … { … }
SecurityKeyExtensionSession::~SecurityKeyExtensionSession() { … }
bool SecurityKeyExtensionSession::OnExtensionMessage(
ClientSessionDetails* client_session_details,
protocol::ClientStub* client_stub,
const protocol::ExtensionMessage& message) { … }
#if BUILDFLAG(IS_WIN)
void SecurityKeyExtensionSession::BindSecurityKeyForwarder(
mojo::PendingReceiver<mojom::SecurityKeyForwarder> receiver) {
security_key_auth_handler_->BindSecurityKeyForwarder(std::move(receiver));
}
#endif
void SecurityKeyExtensionSession::ProcessControlMessage(
const base::Value::Dict& message_data) const { … }
void SecurityKeyExtensionSession::ProcessDataMessage(
const base::Value::Dict& message_data) const { … }
void SecurityKeyExtensionSession::ProcessErrorMessage(
const base::Value::Dict& message_data) const { … }
void SecurityKeyExtensionSession::SendMessageToClient(
int connection_id,
const std::string& data) const { … }
void SecurityKeyExtensionSession::SetSecurityKeyAuthHandlerForTesting(
std::unique_ptr<SecurityKeyAuthHandler> security_key_auth_handler) { … }
}