#include "remoting/host/setup/oauth_host_starter.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "base/strings/string_util.h"
#include "google_apis/google_api_keys.h"
#include "remoting/base/directory_service_client.h"
#include "remoting/base/passthrough_oauth_token_getter.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/host/setup/host_starter.h"
#include "remoting/host/setup/host_starter_base.h"
#include "remoting/proto/remoting/v1/directory_messages.pb.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace remoting {
namespace {
class OAuthHostStarter : public HostStarterBase { … };
OAuthHostStarter::OAuthHostStarter(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
OAuthHostStarter::~OAuthHostStarter() = default;
void OAuthHostStarter::RegisterNewHost(
const std::string& public_key,
std::optional<std::string> access_token) { … }
void OAuthHostStarter::RemoveOldHostFromDirectory(
base::OnceClosure on_host_removed) { … }
void OAuthHostStarter::OnRegisterHostResponse(
const ProtobufHttpStatus& status,
std::unique_ptr<apis::v1::RegisterHostResponse> response) { … }
void OAuthHostStarter::OnDeleteHostResponse(
const ProtobufHttpStatus& status,
std::unique_ptr<apis::v1::DeleteHostResponse> response) { … }
}
std::unique_ptr<HostStarter> CreateOAuthHostStarter(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) { … }
}