0
Files
android_webview
apps
ash
base
build
build_overrides
buildtools
cc
chrome
chromecast
chromeos
codelabs
components
content
app
app_shim_remote_cocoa
browser
accessibility
aggregation_service
android
attribution_reporting
audio
background_fetch
background_sync
blob_storage
bluetooth
broadcast_channel
browser_plugin
browsing_data
browsing_topics
buckets
cache_storage
client_hints
cocoa
code_cache
compositor
compute_pressure
contacts
content_index
cookie_store
date_time_chooser
device
device_posture
device_sensors
devtools
direct_sockets
display_cutout
dom_storage
download
fenced_frame
file_system
file_system_access
first_party_sets
font_access
font_unique_name_lookup
generic_sensor
geolocation
gpu
handwriting
hid
hyphenation
idle
image_capture
indexed_db
installedapp
interest_group
keyboard_lock
loader
lock_screen
locks
manifest
media
media_session
memory
memory_pressure
metrics
ml
network
notifications
origin_trials
payments
performance_manager
permissions
picture_in_picture
portal
preloading
presentation
private_aggregation
process_internals
push_messaging
quota
reduce_accept_language
renderer_host
resources
runtime_feature_state
scheduler
screen_details
screen_orientation
screenlock_monitor
serial
service_worker
shape_detection
shared_storage
smart_card
sms
speech
ssl
system_dns_resolution
tracing
usb
wake_lock
web_contents
web_database
web_package
webauth
webid
webrtc
websockets
webtransport
webui
worker_host
xr
zygote_host
BACK_FORWARD_CACHE_OWNERS
BUILD.gn
CHILD_PROCESS_SECURITY_POLICY_OWNERS
DEPS
OWNERS
PRESUBMIT.py
README.md
about_url_loader_factory.cc
about_url_loader_factory.h
after_startup_task_utils.cc
after_startup_task_utils.h
back_forward_cache_basics_browsertest.cc
back_forward_cache_browsertest.cc
back_forward_cache_browsertest.h
back_forward_cache_features_browsertest.cc
back_forward_cache_internal_browsertest.cc
back_forward_cache_network_request_browsertest.cc
back_forward_cache_no_store_browsertest.cc
back_forward_cache_not_restored_reasons_browsertest.cc
back_forward_cache_test_util.cc
back_forward_cache_test_util.h
bad_message.cc
bad_message.h
battery_monitor_browsertest.cc
bookmarklet_browsertest.cc
browser_associated_interface_unittest.cc
browser_child_process_host_impl.cc
browser_child_process_host_impl.h
browser_child_process_host_impl_receiver_bindings.cc
browser_child_process_observer_browsertest.cc
browser_context.cc
browser_context_impl.cc
browser_context_impl.h
browser_interface_binders.cc
browser_interface_binders.h
browser_interface_broker_impl.h
browser_main.cc
browser_main.h
browser_main_loop.cc
browser_main_loop.h
browser_main_loop_unittest.cc
browser_main_runner_impl.cc
browser_main_runner_impl.h
browser_process_io_thread.cc
browser_process_io_thread.h
browser_task_traits_unittest.nc
browser_thread_browsertest.cc
browser_thread_impl.cc
browser_thread_impl.h
browser_thread_unittest.cc
browser_url_handler_impl.cc
browser_url_handler_impl.h
browser_url_handler_impl_unittest.cc
browsing_instance.cc
browsing_instance.h
byte_stream.cc
byte_stream.h
byte_stream_unittest.cc
can_commit_status.h
child_process_host_impl.cc
child_process_host_impl.h
child_process_launcher.cc
child_process_launcher.h
child_process_launcher_browsertest.cc
child_process_launcher_helper.cc
child_process_launcher_helper.h
child_process_launcher_helper_android.cc
child_process_launcher_helper_fuchsia.cc
child_process_launcher_helper_ios.cc
child_process_launcher_helper_linux.cc
child_process_launcher_helper_mac.cc
child_process_launcher_helper_posix.cc
child_process_launcher_helper_posix.h
child_process_launcher_helper_win.cc
child_process_security_policy_browsertest.cc
child_process_security_policy_impl.cc
child_process_security_policy_impl.h
child_process_security_policy_unittest.cc
child_process_task_port_provider_mac.cc
child_process_task_port_provider_mac.h
child_process_task_port_provider_mac_unittest.cc
content_security_policy_browsertest.cc
context_factory.cc
coop_related_group.cc
coop_related_group.h
cross_origin_opener_policy_browsertest.cc
cross_site_transfer_browsertest.cc
data_decoder_browsertest.cc
data_url_loader_factory.cc
data_url_loader_factory.h
database_browsertest.cc
do_not_track_browsertest.cc
eye_dropper_chooser_impl.cc
eye_dropper_chooser_impl.h
feature_observer.cc
feature_observer.h
field_trial_recorder.cc
field_trial_recorder.h
field_trial_synchronizer.cc
field_trial_synchronizer.h
find_in_page_client.cc
find_in_page_client.h
find_request_manager.cc
find_request_manager.h
find_request_manager_browsertest.cc
font_list_async.cc
font_preferences_browsertest.cc
font_service.cc
font_service.h
form_controls_browsertest.cc
host_zoom_level_context.cc
host_zoom_level_context.h
host_zoom_map_impl.cc
host_zoom_map_impl.h
host_zoom_map_impl_android_unittest.cc
host_zoom_map_impl_browsertest.cc
host_zoom_map_impl_unittest.cc
isolated_origin_browsertest.cc
isolated_origin_util.cc
isolated_origin_util.h
isolation_context.cc
isolation_context.h
keyboard_lock_browsertest.cc
keyboard_lock_browsertest.h
keyboard_lock_browsertest_ios.mm
keyboard_lock_browsertest_mac.mm
largest_contentful_paint_browsertests.cc
launch_as_mojo_client_browsertest.cc
log_console_message.cc
log_console_message.h
message_port_provider.cc
message_port_provider_browsertest.cc
mime_registry_impl.cc
mime_registry_impl.h
mojo_binder_policy_applier.cc
mojo_binder_policy_applier.h
mojo_binder_policy_applier_unittest.cc
mojo_binder_policy_map_impl.cc
mojo_binder_policy_map_impl.h
mojo_binder_policy_map_impl_unittest.cc
mojo_sandbox_browsertest.cc
native_profiling.pdl
navigation_browsertest.cc
navigation_mhtml_browsertest.cc
navigation_or_document_handle.cc
navigation_or_document_handle.h
navigation_subresource_loader_params.cc
navigation_subresource_loader_params.h
net_info_browsertest.cc
network_context_client_base_impl.cc
network_context_client_base_impl.h
network_context_client_base_impl_unittest.cc
network_sandbox.cc
network_sandbox.h
network_sandbox_grant_result.h
network_service_browsertest.cc
network_service_client.cc
network_service_client.h
network_service_instance_impl.cc
network_service_instance_impl.h
network_service_instance_impl_unittest.cc
network_service_restart_browsertest.cc
notification_service_impl.cc
notification_service_impl.h
notification_service_impl_unittest.cc
origin_agent_cluster_isolation_state.cc
origin_agent_cluster_isolation_state.h
per_web_ui_browser_interface_broker.cc
performance_memory_browsertest.cc
performance_timeline_browsertest.cc
plugin_list.cc
plugin_list.h
plugin_list_unittest.cc
plugin_service_impl.cc
plugin_service_impl.h
plugin_service_impl_browsertest.cc
pointer_lock_browsertest.cc
pointer_lock_browsertest.h
pointer_lock_browsertest_ios.mm
pointer_lock_browsertest_mac.mm
posix_file_descriptor_info_impl.cc
posix_file_descriptor_info_impl.h
posix_file_descriptor_info_impl_unittest.cc
power_monitor_browsertest.cc
ppapi_plugin_process_host.cc
ppapi_plugin_process_host.h
ppapi_plugin_process_host_receiver_bindings.cc
ppapi_plugin_sandboxed_process_launcher_delegate.cc
ppapi_plugin_sandboxed_process_launcher_delegate.h
ppapi_plugin_sandboxed_process_launcher_delegate_unittest.cc
process_lock.cc
process_lock.h
process_visibility_util.cc
profiling_utils.cc
resource_context_impl.cc
resource_context_impl.h
resource_coordinator_service.cc
resource_loading_browsertest.cc
sandbox_host_linux.cc
sandbox_host_linux.h
sandbox_ipc_linux.cc
sandbox_ipc_linux.h
sandbox_mac_unittest.mm
sandbox_parameters_mac.h
sandbox_parameters_mac.mm
sandbox_support_mac_impl.h
sandbox_support_mac_impl.mm
scoped_active_url.cc
scoped_active_url.h
security_exploit_browsertest.cc
service_process_host_browsertest.cc
service_process_host_impl.cc
session_history_browsertest.cc
shareable_file_reference_unittest.cc
site_info.cc
site_info.h
site_instance_group.cc
site_instance_group.h
site_instance_group_manager.cc
site_instance_group_manager.h
site_instance_group_unittest.cc
site_instance_impl.cc
site_instance_impl.h
site_instance_impl_unittest.cc
site_isolation_policy_unittest.cc
site_per_process_browsertest.cc
site_per_process_browsertest.h
site_per_process_hit_test_browsertest.cc
site_per_process_layout_browsertest.cc
site_per_process_mac_browsertest.mm
site_per_process_mixed_content_browsertest.cc
site_per_process_oopsif_browsertest.cc
site_per_process_sad_frame_browsertest.cc
site_per_process_scroll_browsertest.cc
site_per_process_unload_browsertest.cc
snapshot_browsertest.cc
ssl_private_key_impl.cc
ssl_private_key_impl.h
starscan_load_observer.cc
starscan_load_observer.h
startup_data_impl.cc
startup_data_impl.h
startup_helper.cc
startup_helper.h
startup_task_runner.cc
startup_task_runner.h
startup_task_runner_unittest.cc
storage_partition_config_unittest.cc
storage_partition_impl.cc
storage_partition_impl.h
storage_partition_impl_browsertest.cc
storage_partition_impl_map.cc
storage_partition_impl_map.h
storage_partition_impl_map_unittest.cc
storage_partition_impl_unittest.cc
storage_service_restart_browsertest.cc
storage_service_sandbox_browsertest.cc
text_fragment_browsertest.cc
theme_helper.cc
theme_helper.h
theme_helper_mac.h
theme_helper_mac.mm
ukm_internals_ui.cc
ukm_internals_ui.h
url_info.cc
url_info.h
url_loader_factory_getter.cc
url_loader_factory_getter.h
url_loader_factory_params_helper.cc
url_loader_factory_params_helper.h
utility_process_host.cc
utility_process_host.h
utility_process_host_browsertest.cc
utility_process_host_receiver_bindings.cc
utility_process_sandbox_browsertest.cc
utility_sandbox_delegate.cc
utility_sandbox_delegate.h
utility_sandbox_delegate_win.cc
v8_snapshot_files.cc
v8_snapshot_files.h
vibration_browsertest.cc
video_capture_service_impl.cc
video_capture_service_impl.h
web_exposed_isolation_info.cc
web_exposed_isolation_info.h
web_exposed_isolation_info_unittest.cc
web_ui_browser_interface_broker_registry.cc
webkit_browsertest.cc
worker_network_isolation_key_browsertest.cc
zoom_browsertest.cc
child
common
gpu
ppapi_plugin
public
renderer
services
shell
test
utility
web_test
zygote
BUILD.gn
DEPS
DIR_METADATA
OWNERS
README.md
architecture.png
content_resources.grd
courgette
crypto
dbus
device
docs
extensions
fuchsia_web
gin
google_apis
google_update
gpu
headless
infra
ios
ipc
media
mojo
native_client_sdk
net
pdf
ppapi
printing
remoting
rlz
sandbox
services
skia
sql
storage
styleguide
testing
third_party
tools
ui
url
weblayer
.clang-format
.clang-tidy
.eslintrc.js
.git-blame-ignore-revs
.gitattributes
.gitignore
.gn
.mailmap
.rustfmt.toml
.vpython3
.yapfignore
ATL_OWNERS
AUTHORS
BUILD.gn
CODE_OF_CONDUCT.md
DEPS
DIR_METADATA
LICENSE
LICENSE.chromium_os
OWNERS
PRESUBMIT.py
PRESUBMIT_test.py
PRESUBMIT_test_mocks.py
README.md
WATCHLISTS
codereview.settings
src/content/browser/network_service_client.cc
Matt Mueller 33d6b57a77 Simplify cert_database_mac notifier implementation
There can only be one, so don't have an overly complicated
implementation that pretends otherwise.

Bug: 1463342
Change-Id: I95872be22a7609de23e43394685a46e628d4f3fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4676148
Reviewed-by: David Benjamin <davidben@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Commit-Queue: Matt Mueller <mattm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1168427}
2023-07-10 23:54:40 +00:00

356 lines
14 KiB
C++

// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/network_service_client.h"
#include <utility>
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/sequence_checker.h"
#include "base/sequence_token.h"
#include "base/threading/sequence_bound.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "content/browser/browsing_data/clear_site_data_handler.h"
#include "content/browser/buildflags.h"
#include "content/browser/ssl/ssl_manager.h"
#include "content/browser/webrtc/webrtc_connections_observer.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/network_service_util.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/network_change_notifier.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/mojom/network_change_manager.mojom-forward.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/mojom/use_counter/metrics/web_feature.mojom.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/android/content_uri_utils.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "base/task/current_thread.h"
#endif
#if BUILDFLAG(IS_LINUX)
#include "net/base/address_map_linux.h"
#include "net/base/address_tracker_linux.h"
#endif
namespace content {
#if BUILDFLAG(IS_LINUX)
namespace {
// Takes care of passing updates to AddressTrackerLinux's AddressMap and set of
// online links to the network service to update its cache.
class NetworkInterfaceChangeHelper {
public:
explicit NetworkInterfaceChangeHelper(
mojo::PendingAssociatedRemote<
network::mojom::NetworkInterfaceChangeListener>
network_interface_change_listener_pending)
: network_interface_change_listener_pending_(
std::move(network_interface_change_listener_pending)) {
// This is constructed by NetworkServiceClient and only used on
// AddressTrackerLinux's sequence.
DETACH_FROM_SEQUENCE(sequence_checker_);
}
NetworkInterfaceChangeHelper(const NetworkInterfaceChangeHelper&) = delete;
NetworkInterfaceChangeHelper& operator=(const NetworkInterfaceChangeHelper&) =
delete;
~NetworkInterfaceChangeHelper() = default;
// Callback for AddressTrackerLinux::SetDiffCallback.
void SendAddressTrackerDiffsToNetworkService(
const net::AddressMapOwnerLinux::AddressMapDiff& addr_diff,
const net::AddressMapOwnerLinux::OnlineLinksDiff& online_links_diff) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// On the first call, this binds the |network_interface_change_listener_| on
// AddressTrackerLinux's sequence using
// |network_interface_change_listener_pending_|.
if (!network_interface_change_listener_) {
DCHECK(network_interface_change_listener_pending_);
network_interface_change_listener_.Bind(
std::move(network_interface_change_listener_pending_));
}
auto params = network::mojom::NetworkInterfaceChangeParams::New(
addr_diff, online_links_diff);
network_interface_change_listener_->OnNetworkInterfacesChanged(
std::move(params));
}
private:
SEQUENCE_CHECKER(sequence_checker_);
mojo::PendingAssociatedRemote<network::mojom::NetworkInterfaceChangeListener>
network_interface_change_listener_pending_;
mojo::AssociatedRemote<network::mojom::NetworkInterfaceChangeListener>
network_interface_change_listener_ GUARDED_BY_CONTEXT(sequence_checker_);
};
} // namespace
#endif
NetworkServiceClient::NetworkServiceClient()
#if BUILDFLAG(IS_ANDROID)
: app_status_listener_(base::android::ApplicationStatusListener::New(
base::BindRepeating(&NetworkServiceClient::OnApplicationStateChange,
base::Unretained(this))))
#endif
{
#if BUILDFLAG(IS_MAC)
net::CertDatabase::StartListeningForKeychainEvents();
#endif
if (IsOutOfProcessNetworkService()) {
net::CertDatabase::GetInstance()->AddObserver(this);
memory_pressure_listener_ = std::make_unique<base::MemoryPressureListener>(
FROM_HERE, base::BindRepeating(&NetworkServiceClient::OnMemoryPressure,
base::Unretained(this)));
}
webrtc_connections_observer_ =
std::make_unique<content::WebRtcConnectionsObserver>(base::BindRepeating(
&NetworkServiceClient::OnPeerToPeerConnectionsCountChange,
base::Unretained(this)));
}
NetworkServiceClient::~NetworkServiceClient() {
if (IsOutOfProcessNetworkService()) {
net::CertDatabase::GetInstance()->RemoveObserver(this);
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
bool remove_ncn_observers = true;
#if BUILDFLAG(IS_LINUX)
remove_ncn_observers = base::FeatureList::IsEnabled(
net::features::kAddressTrackerLinuxIsProxied);
#endif // BUILDFLAG(IS_LINUX)
if (remove_ncn_observers) {
net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
net::NetworkChangeNotifier::RemoveMaxBandwidthObserver(this);
net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
}
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
}
}
void NetworkServiceClient::OnTrustStoreChanged() {
GetNetworkService()->OnTrustStoreChanged();
}
void NetworkServiceClient::OnClientCertStoreChanged() {
GetNetworkService()->OnClientCertStoreChanged();
}
void NetworkServiceClient::OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) {
GetNetworkService()->OnMemoryPressure(memory_pressure_level);
}
void NetworkServiceClient::OnPeerToPeerConnectionsCountChange(uint32_t count) {
GetNetworkService()->OnPeerToPeerConnectionsCountChange(count);
}
#if BUILDFLAG(IS_ANDROID)
void NetworkServiceClient::OnApplicationStateChange(
base::android::ApplicationState state) {
GetNetworkService()->OnApplicationStateChange(state);
}
#endif // BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
void NetworkServiceClient::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
network_change_manager_->OnNetworkChanged(
false /* dns_changed */, false /* ip_address_changed */,
true /* connection_type_changed */, network::mojom::ConnectionType(type),
false /* connection_subtype_changed */,
network::mojom::ConnectionSubtype(
net::NetworkChangeNotifier::GetConnectionSubtype()));
}
void NetworkServiceClient::OnMaxBandwidthChanged(
double max_bandwidth_mbps,
net::NetworkChangeNotifier::ConnectionType type) {
// The connection subtype change will trigger a max bandwidth change in the
// network service notifier.
network_change_manager_->OnNetworkChanged(
false /* dns_changed */, false /* ip_address_changed */,
false /* connection_type_changed */, network::mojom::ConnectionType(type),
true /* connection_subtype_changed */,
network::mojom::ConnectionSubtype(
net::NetworkChangeNotifier::GetConnectionSubtype()));
}
void NetworkServiceClient::OnIPAddressChanged() {
network_change_manager_->OnNetworkChanged(
false /* dns_changed */, true /* ip_address_changed */,
false /* connection_type_changed */,
network::mojom::ConnectionType(
net::NetworkChangeNotifier::GetConnectionType()),
false /* connection_subtype_changed */,
network::mojom::ConnectionSubtype(
net::NetworkChangeNotifier::GetConnectionSubtype()));
}
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
#if BUILDFLAG(USE_SOCKET_BROKER)
mojo::PendingRemote<network::mojom::SocketBroker>
NetworkServiceClient::BindSocketBroker() {
return socket_broker_.BindNewRemote();
}
#endif // BUILDFLAG(USE_SOCKET_BROKER)
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
NetworkServiceClient::BindURLLoaderNetworkServiceObserver() {
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver> remote;
url_loader_network_service_observers_.Add(
this, remote.InitWithNewPipeAndPassReceiver());
return remote;
}
void NetworkServiceClient::OnNetworkServiceInitialized(
network::mojom::NetworkService* service) {
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
bool add_ncn_observers = true;
#if BUILDFLAG(IS_LINUX)
add_ncn_observers = base::FeatureList::IsEnabled(
net::features::kAddressTrackerLinuxIsProxied);
#endif // BUILDFLAG(IS_LINUX)
if (IsOutOfProcessNetworkService() && add_ncn_observers) {
DCHECK(!net::NetworkChangeNotifier::CreateIfNeeded());
service->GetNetworkChangeManager(
network_change_manager_.BindNewPipeAndPassReceiver());
#if BUILDFLAG(IS_LINUX)
// Keep the tracking AddressTrackerLinux in sync with the caching version in
// the network service, which cannot use AddressTrackerLinux in the sandbox.
mojo::PendingAssociatedRemote<
network::mojom::NetworkInterfaceChangeListener>
network_interface_change_listener_pending;
network_change_manager_->BindNetworkInterfaceChangeListener(
network_interface_change_listener_pending
.InitWithNewEndpointAndPassReceiver());
// Have the AddressTrackerLinux send any changes to the AddressMap or set of
// online links over |network_interface_change_listener_pending|.
auto diff_callback_helper = std::make_unique<NetworkInterfaceChangeHelper>(
std::move(network_interface_change_listener_pending));
net::NetworkChangeNotifier::GetAddressMapOwner()
->GetAddressTrackerLinux()
->SetDiffCallback(
base::BindRepeating(&NetworkInterfaceChangeHelper::
SendAddressTrackerDiffsToNetworkService,
std::move(diff_callback_helper)));
#endif // BUILDFLAG(IS_LINUX)
net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
net::NetworkChangeNotifier::AddMaxBandwidthObserver(this);
net::NetworkChangeNotifier::AddIPAddressObserver(this);
}
#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
}
void NetworkServiceClient::OnSSLCertificateError(
const GURL& url,
int net_error,
const net::SSLInfo& ssl_info,
bool fatal,
OnSSLCertificateErrorCallback response) {
std::move(response).Run(net::ERR_INSECURE_RESPONSE);
}
void NetworkServiceClient::OnCertificateRequested(
const absl::optional<base::UnguessableToken>& window_id,
const scoped_refptr<net::SSLCertRequestInfo>& cert_info,
mojo::PendingRemote<network::mojom::ClientCertificateResponder>
cert_responder_remote) {
mojo::Remote<network::mojom::ClientCertificateResponder> cert_responder(
std::move(cert_responder_remote));
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
network::switches::kIgnoreUrlFetcherCertRequests)) {
cert_responder->ContinueWithoutCertificate();
return;
}
cert_responder->CancelRequest();
}
void NetworkServiceClient::OnAuthRequired(
const absl::optional<base::UnguessableToken>& window_id,
uint32_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) {
mojo::Remote<network::mojom::AuthChallengeResponder>
auth_challenge_responder_remote(std::move(auth_challenge_responder));
auth_challenge_responder_remote->OnAuthCredentials(absl::nullopt);
}
void NetworkServiceClient::OnPrivateNetworkAccessPermissionRequired(
const GURL& url,
const net::IPAddress& ip_address,
const std::string& private_network_device_id,
const std::string& private_network_device_name,
OnPrivateNetworkAccessPermissionRequiredCallback callback) {
std::move(callback).Run(false);
}
void NetworkServiceClient::OnClearSiteData(
const GURL& url,
const std::string& header_value,
int load_flags,
const absl::optional<net::CookiePartitionKey>& cookie_partition_key,
bool partitioned_state_allowed_only,
OnClearSiteDataCallback callback) {
std::move(callback).Run();
}
void NetworkServiceClient::OnLoadingStateUpdate(
network::mojom::LoadInfoPtr info,
OnLoadingStateUpdateCallback callback) {
std::move(callback).Run();
}
void NetworkServiceClient::OnDataUseUpdate(
int32_t network_traffic_annotation_id_hash,
int64_t recv_bytes,
int64_t sent_bytes) {
GetContentClient()->browser()->OnNetworkServiceDataUseUpdate(
GlobalRenderFrameHostId(), network_traffic_annotation_id_hash, recv_bytes,
sent_bytes);
}
void NetworkServiceClient::OnSharedStorageHeaderReceived(
const url::Origin& request_origin,
std::vector<network::mojom::SharedStorageOperationPtr> operations,
OnSharedStorageHeaderReceivedCallback callback) {
std::move(callback).Run();
}
void NetworkServiceClient::Clone(
mojo::PendingReceiver<network::mojom::URLLoaderNetworkServiceObserver>
observer) {
url_loader_network_service_observers_.Add(this, std::move(observer));
}
} // namespace content