Question regarding chromium C++ codebase - net::ProxyConfigService on ChromeOS

40 views
Skip to first unread message

Vlad Krot

unread,
Feb 12, 2025, 10:45:46 AMFeb 12
to net...@chromium.org
I have a little question regarding usage of net::URLRequestContext and net::ProxyConfigService. It is not clear which instance of ProxyConfigService to create on ChromeOS.

Is ProxyConfigServiceFixed correct choice? I tried to use net::ProxyConfigService::CreateSystemProxyConfigService, but it doesn’t work for ChromeOS
LOG(ERROR) << "ProxyConfigService for ChromeOS should be created in "
<< "profile_io_data.cc::CreateProxyConfigService and this should "
<< "be used only for examples.";
And in profile_io_data.cc there’s no proxy service.

If you need more context why I use it, it is in my cl - https://chromium-review.googlesource.com/c/chromium/src/+/6196859?tab=comments

Matt Menke

unread,
Feb 12, 2025, 10:54:53 AMFeb 12
to Vlad Krot, net...@chromium.org
First off, you must not create a URLRequestContext in the browser process for security reasons, due to the rule of 2, and instead the network service should be accessed through a NetworkContext over a mojo pipe.  More generally, though, you shouldn't be creating your own NetworkContext, either - If you do it directly, you'll get it wrong, and creating an entire instance of the network stack is an extremely heavy weight operation.  There are, for the most part, two types of NetworkContexts in use by chrome.  There's the per-profile, web-exposed on, hanging off of a StoragePartition, which has a cookie store (though you can make cookieless, isolated requests that are not cached using it, if that's the behavior you need - it will respect per-profile proxy settings), and for internal requests not associated with a profile, there's the global SystemNetworkContext.  Since extensions are per-profile, I assume you want the former.

If you're still interested in the details of proxy configuration, the ChromeOS team actually owns components/proxy_config, which is used on all platforms, but I don't think the details are really relevant to what you should be doing there.


--
You received this message because you are subscribed to the Google Groups "net-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to net-dev+u...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/net-dev/CACrnVjGOUtFzPPpfHRxsdEAp%2BM9UCWmGExgmq%2BPUjwmW%3Dx0V-Q%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages