#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "components/domain_reliability/monitor.h"
#include <memory>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/notreached.h"
#include "components/domain_reliability/baked_in_configs.h"
#include "components/domain_reliability/features.h"
#include "components/domain_reliability/google_configs.h"
#include "components/domain_reliability/quic_error_mapping.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/base/network_anonymization_key.h"
#include "net/http/http_connection_info.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
namespace domain_reliability {
namespace {
std::unique_ptr<DomainReliabilityBeacon> CreateBeaconFromAttempt(
const DomainReliabilityBeacon& beacon_template,
const net::ConnectionAttempt& attempt) { … }
}
DomainReliabilityMonitor::DomainReliabilityMonitor(
net::URLRequestContext* url_request_context,
const std::string& upload_reporter_string,
const DomainReliabilityContext::UploadAllowedCallback&
upload_allowed_callback)
: … { … }
DomainReliabilityMonitor::DomainReliabilityMonitor(
net::URLRequestContext* url_request_context,
const std::string& upload_reporter_string,
const DomainReliabilityContext::UploadAllowedCallback&
upload_allowed_callback,
std::unique_ptr<MockableTime> time)
: … { … }
DomainReliabilityMonitor::~DomainReliabilityMonitor() { … }
void DomainReliabilityMonitor::Shutdown() { … }
void DomainReliabilityMonitor::AddBakedInConfigs() { … }
void DomainReliabilityMonitor::SetDiscardUploads(bool discard_uploads) { … }
void DomainReliabilityMonitor::OnBeforeRedirect(net::URLRequest* request) { … }
void DomainReliabilityMonitor::OnCompleted(net::URLRequest* request,
bool started,
int net_error) { … }
void DomainReliabilityMonitor::OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) { … }
void DomainReliabilityMonitor::ClearBrowsingData(
DomainReliabilityClearMode mode,
const base::RepeatingCallback<bool(const url::Origin&)>& origin_filter) { … }
const DomainReliabilityContext* DomainReliabilityMonitor::AddContextForTesting(
std::unique_ptr<const DomainReliabilityConfig> config) { … }
void DomainReliabilityMonitor::ForceUploadsForTesting() { … }
void DomainReliabilityMonitor::OnRequestLegCompleteForTesting(
const RequestInfo& request) { … }
const DomainReliabilityContext*
DomainReliabilityMonitor::LookupContextForTesting(
const std::string& hostname) const { … }
DomainReliabilityMonitor::RequestInfo::RequestInfo() = default;
DomainReliabilityMonitor::RequestInfo::RequestInfo(
const net::URLRequest& request,
int net_error)
: … { … }
DomainReliabilityMonitor::RequestInfo::RequestInfo(const RequestInfo& other) =
default;
DomainReliabilityMonitor::RequestInfo::~RequestInfo() { … }
bool DomainReliabilityMonitor::RequestInfo::ShouldReportRequest(
const DomainReliabilityMonitor::RequestInfo& request) { … }
void DomainReliabilityMonitor::OnRequestLegComplete(
const RequestInfo& request) { … }
}