#include "remoting/signaling/remoting_log_to_server.h"
#include <sstream>
#include "base/functional/bind.h"
#include "base/logging.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "remoting/base/protobuf_http_client.h"
#include "remoting/base/protobuf_http_request.h"
#include "remoting/base/protobuf_http_request_config.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/base/service_urls.h"
#include "remoting/proto/remoting/v1/telemetry_messages.pb.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace remoting {
namespace {
const net::BackoffEntry::Policy kBackoffPolicy = …;
constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
constexpr char kCreateLogEntryPath[] = …;
CreateLogEntryResponseCallback;
class TelemetryClient { … };
TelemetryClient::TelemetryClient(
OAuthTokenGetter* token_getter,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
TelemetryClient::~TelemetryClient() = default;
void TelemetryClient::CreateLogEntry(
const apis::v1::CreateLogEntryRequest& request,
CreateLogEntryResponseCallback callback) { … }
}
RemotingLogToServer::RemotingLogToServer(
ServerLogEntry::Mode mode,
std::unique_ptr<OAuthTokenGetter> token_getter,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory)
: … { … }
RemotingLogToServer::~RemotingLogToServer() { … }
void RemotingLogToServer::Log(const ServerLogEntry& entry) { … }
void RemotingLogToServer::SendLogRequest(
const apis::v1::CreateLogEntryRequest& request,
int attempts_left) { … }
void RemotingLogToServer::SendLogRequestWithBackoff(
const apis::v1::CreateLogEntryRequest& request,
int attempts_left) { … }
void RemotingLogToServer::OnSendLogRequestResult(
const apis::v1::CreateLogEntryRequest& request,
int attempts_left,
const ProtobufHttpStatus& status,
std::unique_ptr<apis::v1::CreateLogEntryResponse> response) { … }
ServerLogEntry::Mode RemotingLogToServer::mode() const { … }
}