#include "remoting/protocol/pairing_registry.h"
#include <stddef.h>
#include <string_view>
#include <utility>
#include "base/base64.h"
#include "base/functional/bind.h"
#include "base/json/json_string_value_serializer.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/uuid.h"
#include "base/values.h"
#include "crypto/random.h"
namespace remoting::protocol {
const int kKeySize = …;
const char PairingRegistry::kCreatedTimeKey[] = …;
const char PairingRegistry::kClientIdKey[] = …;
const char PairingRegistry::kClientNameKey[] = …;
const char PairingRegistry::kSharedSecretKey[] = …;
PairingRegistry::Pairing::Pairing() = default;
PairingRegistry::Pairing::Pairing(const base::Time& created_time,
const std::string& client_name,
const std::string& client_id,
const std::string& shared_secret)
: … { … }
PairingRegistry::Pairing::Pairing(const Pairing& other) = default;
PairingRegistry::Pairing::~Pairing() = default;
PairingRegistry::Pairing PairingRegistry::Pairing::Create(
const std::string& client_name) { … }
PairingRegistry::Pairing PairingRegistry::Pairing::CreateFromValue(
const base::Value::Dict& pairing) { … }
base::Value::Dict PairingRegistry::Pairing::ToValue() const { … }
bool PairingRegistry::Pairing::operator==(const Pairing& other) const { … }
bool PairingRegistry::Pairing::is_valid() const { … }
PairingRegistry::PairingRegistry(
scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner,
std::unique_ptr<Delegate> delegate)
: … { … }
PairingRegistry::Pairing PairingRegistry::CreatePairing(
const std::string& client_name) { … }
void PairingRegistry::GetPairing(const std::string& client_id,
GetPairingCallback callback) { … }
void PairingRegistry::GetAllPairings(GetAllPairingsCallback callback) { … }
void PairingRegistry::DeletePairing(const std::string& client_id,
DoneCallback callback) { … }
void PairingRegistry::ClearAllPairings(DoneCallback callback) { … }
PairingRegistry::~PairingRegistry() = default;
void PairingRegistry::PostTask(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
const base::Location& from_here,
base::OnceClosure task) { … }
void PairingRegistry::AddPairing(const Pairing& pairing) { … }
void PairingRegistry::DoLoadAll(GetAllPairingsCallback callback) { … }
void PairingRegistry::DoDeleteAll(DoneCallback callback) { … }
void PairingRegistry::DoLoad(const std::string& client_id,
GetPairingCallback callback) { … }
void PairingRegistry::DoSave(const Pairing& pairing, DoneCallback callback) { … }
void PairingRegistry::DoDelete(const std::string& client_id,
DoneCallback callback) { … }
void PairingRegistry::InvokeDoneCallbackAndScheduleNext(DoneCallback callback,
bool success) { … }
void PairingRegistry::InvokeGetPairingCallbackAndScheduleNext(
GetPairingCallback callback,
Pairing pairing) { … }
void PairingRegistry::InvokeGetAllPairingsCallbackAndScheduleNext(
GetAllPairingsCallback callback,
base::Value::List pairings) { … }
void PairingRegistry::SanitizePairings(GetAllPairingsCallback callback,
base::Value::List pairings) { … }
void PairingRegistry::ServiceOrQueueRequest(base::OnceClosure request) { … }
void PairingRegistry::ServiceNextRequest() { … }
}