#include "content/browser/devtools/network_service_devtools_observer.h"
#include "content/browser/devtools/devtools_agent_host_impl.h"
#include "content/browser/devtools/devtools_instrumentation.h"
#include "content/browser/devtools/protocol/audits_handler.h"
#include "content/browser/devtools/protocol/network_handler.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/public/common/content_client.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/network/public/mojom/http_raw_headers.mojom.h"
#include "services/network/public/mojom/shared_dictionary_error.mojom.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom.h"
namespace content {
namespace {
template <typename Handler, typename... MethodArgs, typename... Args>
void DispatchToAgents(DevToolsAgentHostImpl* agent_host,
void (Handler::*method)(MethodArgs...),
Args&&... args) { … }
RenderFrameHostImpl* GetRenderFrameHostImplFrom(int frame_tree_node_id) { … }
}
NetworkServiceDevToolsObserver::NetworkServiceDevToolsObserver(
base::PassKey<NetworkServiceDevToolsObserver> pass_key,
const std::string& id,
int frame_tree_node_id)
: … { … }
NetworkServiceDevToolsObserver::~NetworkServiceDevToolsObserver() = default;
DevToolsAgentHostImpl* NetworkServiceDevToolsObserver::GetDevToolsAgentHost() { … }
void NetworkServiceDevToolsObserver::OnRawRequest(
const std::string& devtools_request_id,
const net::CookieAccessResultList& request_cookie_list,
std::vector<network::mojom::HttpRawHeaderPairPtr> request_headers,
base::TimeTicks timestamp,
network::mojom::ClientSecurityStatePtr security_state,
network::mojom::OtherPartitionInfoPtr other_partition_info) { … }
void NetworkServiceDevToolsObserver::OnRawResponse(
const std::string& devtools_request_id,
const net::CookieAndLineAccessResultList& response_cookie_list,
std::vector<network::mojom::HttpRawHeaderPairPtr> response_headers,
const std::optional<std::string>& response_headers_text,
network::mojom::IPAddressSpace resource_address_space,
int32_t http_status_code,
const std::optional<net::CookiePartitionKey>& cookie_partition_key) { … }
void NetworkServiceDevToolsObserver::OnEarlyHintsResponse(
const std::string& devtools_request_id,
std::vector<network::mojom::HttpRawHeaderPairPtr> headers) { … }
void NetworkServiceDevToolsObserver::OnTrustTokenOperationDone(
const std::string& devtools_request_id,
network::mojom::TrustTokenOperationResultPtr result) { … }
void NetworkServiceDevToolsObserver::OnPrivateNetworkRequest(
const std::optional<std::string>& devtools_request_id,
const GURL& url,
bool is_warning,
network::mojom::IPAddressSpace resource_address_space,
network::mojom::ClientSecurityStatePtr client_security_state) { … }
void NetworkServiceDevToolsObserver::OnCorsPreflightRequest(
const base::UnguessableToken& devtools_request_id,
const net::HttpRequestHeaders& request_headers,
network::mojom::URLRequestDevToolsInfoPtr request_info,
const GURL& initiator_url,
const std::string& initiator_devtools_request_id) { … }
void NetworkServiceDevToolsObserver::OnCorsPreflightResponse(
const base::UnguessableToken& devtools_request_id,
const GURL& url,
network::mojom::URLResponseHeadDevToolsInfoPtr head) { … }
void NetworkServiceDevToolsObserver::OnCorsPreflightRequestCompleted(
const base::UnguessableToken& devtools_request_id,
const network::URLLoaderCompletionStatus& status) { … }
void NetworkServiceDevToolsObserver::OnCorsError(
const std::optional<std::string>& devtools_request_id,
const std::optional<::url::Origin>& initiator_origin,
network::mojom::ClientSecurityStatePtr client_security_state,
const GURL& url,
const network::CorsErrorStatus& cors_error_status,
bool is_warning) { … }
void NetworkServiceDevToolsObserver::OnOrbError(
const std::optional<std::string>& devtools_request_id,
const GURL& url) { … }
void NetworkServiceDevToolsObserver::OnSubresourceWebBundleMetadata(
const std::string& devtools_request_id,
const std::vector<GURL>& urls) { … }
void NetworkServiceDevToolsObserver::OnSubresourceWebBundleMetadataError(
const std::string& devtools_request_id,
const std::string& error_message) { … }
void NetworkServiceDevToolsObserver::OnSubresourceWebBundleInnerResponse(
const std::string& inner_request_devtools_id,
const GURL& url,
const std::optional<std::string>& bundle_request_devtools_id) { … }
void NetworkServiceDevToolsObserver::OnSubresourceWebBundleInnerResponseError(
const std::string& inner_request_devtools_id,
const GURL& url,
const std::string& error_message,
const std::optional<std::string>& bundle_request_devtools_id) { … }
namespace {
protocol::String BuildSharedDictionaryError(
network::mojom::SharedDictionaryError write_error) { … }
}
void NetworkServiceDevToolsObserver::OnSharedDictionaryError(
const std::string& devtool_request_id,
const GURL& url,
network::mojom::SharedDictionaryError error) { … }
void NetworkServiceDevToolsObserver::Clone(
mojo::PendingReceiver<network::mojom::DevToolsObserver> observer) { … }
mojo::PendingRemote<network::mojom::DevToolsObserver>
NetworkServiceDevToolsObserver::MakeSelfOwned(const std::string& id) { … }
mojo::PendingRemote<network::mojom::DevToolsObserver>
NetworkServiceDevToolsObserver::MakeSelfOwned(FrameTreeNode* frame_tree_node) { … }
}