#include "remoting/base/url_loader_network_service_observer.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/task/single_thread_task_runner.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/net_errors.h"
#include "net/ssl/client_cert_store.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "net/ssl/ssl_private_key.h"
#include "net/url_request/url_request.h"
#include "remoting/base/certificate_helpers.h"
#include "remoting/base/logging.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "url/gurl.h"
namespace remoting {
namespace {
constexpr char kCertIssuerWildCard[] = …;
class SSLPrivateKeyWrapper : public network::mojom::SSLPrivateKey { … };
void PrintCertificateDetails(const net::X509Certificate& cert) { … }
}
UrlLoaderNetworkServiceObserver::UrlLoaderNetworkServiceObserver() = default;
UrlLoaderNetworkServiceObserver::~UrlLoaderNetworkServiceObserver() = default;
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
UrlLoaderNetworkServiceObserver::Bind() { … }
void UrlLoaderNetworkServiceObserver::OnSSLCertificateError(
const GURL& url,
int net_error,
const net::SSLInfo& ssl_info,
bool fatal,
OnSSLCertificateErrorCallback response) { … }
void UrlLoaderNetworkServiceObserver::OnCertificateRequested(
const std::optional<base::UnguessableToken>& window_id,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
client_cert_responder) { … }
void UrlLoaderNetworkServiceObserver::OnAuthRequired(
const std::optional<base::UnguessableToken>& window_id,
int32_t request_id,
const GURL& url,
bool first_auth_attempt,
const net::AuthChallengeInfo& auth_info,
const scoped_refptr<net::HttpResponseHeaders>& head_headers,
mojo::PendingRemote<network::mojom::AuthChallengeResponder>
auth_challenge_responder) { … }
void UrlLoaderNetworkServiceObserver::OnPrivateNetworkAccessPermissionRequired(
const GURL& url,
const net::IPAddress& ip_address,
const std::optional<std::string>& private_network_device_id,
const std::optional<std::string>& private_network_device_name,
OnPrivateNetworkAccessPermissionRequiredCallback callback) { … }
void UrlLoaderNetworkServiceObserver::OnClearSiteData(
const GURL& url,
const std::string& header_value,
int32_t load_flags,
const std::optional<net::CookiePartitionKey>& cookie_partition_key,
bool partitioned_state_allowed_only,
OnClearSiteDataCallback callback) { … }
void UrlLoaderNetworkServiceObserver::OnLoadingStateUpdate(
network::mojom::LoadInfoPtr info,
OnLoadingStateUpdateCallback callback) { … }
void UrlLoaderNetworkServiceObserver::OnDataUseUpdate(
int32_t network_traffic_annotation_id_hash,
int64_t recv_bytes,
int64_t sent_bytes) { … }
void UrlLoaderNetworkServiceObserver::OnSharedStorageHeaderReceived(
const url::Origin& request_origin,
std::vector<network::mojom::SharedStorageOperationPtr> operations,
OnSharedStorageHeaderReceivedCallback callback) { … }
void UrlLoaderNetworkServiceObserver::Clone(
mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver>
observer) { … }
void UrlLoaderNetworkServiceObserver::OnWebSocketConnectedToPrivateNetwork(
network::mojom::IPAddressSpace ip_address_space) { … }
void UrlLoaderNetworkServiceObserver::OnCertificatesSelected(
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
client_cert_responder,
std::unique_ptr<net::ClientCertStore> cert_store,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
net::ClientCertIdentityList selected_certs) { … }
void UrlLoaderNetworkServiceObserver::ContinueWithCertificate(
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
client_cert_responder,
scoped_refptr<net::X509Certificate> client_cert,
scoped_refptr<net::SSLPrivateKey> private_key) { … }
}