Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1651)

Unified Diff: chrome/browser/profiles/profile_io_data.h

Issue 2978443002: Make ProfileIOData use URLRequestContextBuilder (Closed)
Patch Set: Response to comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_io_data.h
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index d626a457c3762d3603c5327ab2c797548d6f02ae..d4cf4d441b6f2467f98b09e51e9d16f3245916f9 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -82,8 +82,7 @@ class ProxyConfigService;
class ReportingService;
class ReportSender;
class SSLConfigService;
-class TransportSecurityPersister;
-class URLRequestContextStorage;
+class URLRequestContextBuilder;
class URLRequestJobFactoryImpl;
} // namespace net
@@ -122,10 +121,17 @@ class ProfileIOData {
// Utility to install additional WebUI handlers into the |job_factory|.
// Ownership of the handlers is transfered from |protocol_handlers|
// to the |job_factory|.
+ // TODO(mmenke): Remove this, once only AddProtocolHandlersToBuilder is used.
static void InstallProtocolHandlers(
net::URLRequestJobFactoryImpl* job_factory,
content::ProtocolHandlerMap* protocol_handlers);
+ // Utility to install additional WebUI handlers into |builder|. Ownership of
+ // the handlers is transfered from |protocol_handlers| to |builder|.
+ static void AddProtocolHandlersToBuilder(
+ net::URLRequestContextBuilder* builder,
+ content::ProtocolHandlerMap* protocol_handlers);
+
// Sets a global CertVerifier to use when initializing all profiles.
static void SetCertVerifierForTesting(net::CertVerifier* cert_verifier);
@@ -343,7 +349,6 @@ class ProfileIOData {
explicit ProfileIOData(Profile::ProfileType profile_type);
void InitializeOnUIThread(Profile* profile);
- void ApplyProfileParamsToContext(net::URLRequestContext* context) const;
// Does common setup of the URLRequestJobFactories. Adds default
// ProtocolHandlers to |job_factory|, adds URLRequestInterceptors in front of
@@ -352,6 +357,9 @@ class ProfileIOData {
// |protocol_handler_interceptor| is configured to intercept URLRequests
// before all other URLRequestInterceptors, if non-null.
// |host_resolver| is needed to set up the FtpProtocolHandler.
+ //
+ // TODO(mmenke): Remove this once all URLRequestContexts are set up using
+ // URLRequestContextBuilders.
std::unique_ptr<net::URLRequestJobFactory> SetUpJobFactoryDefaults(
std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory,
content::URLRequestInterceptorScopedVector request_interceptors,
@@ -360,6 +368,20 @@ class ProfileIOData {
net::NetworkDelegate* network_delegate,
net::HostResolver* host_resolver) const;
+ // Does common setup of the URLRequestJobFactories. Adds default
+ // ProtocolHandlers to |builder|, and adds URLRequestInterceptors in front of
+ // them as needed.
+ //
+ // |protocol_handler_interceptor| is configured to intercept URLRequests
+ // before all other URLRequestInterceptors, if non-null.
+ // |host_resolver| is needed to set up the FtpProtocolHandler.
+ void SetUpJobFactoryDefaultsForBuilder(
+ net::URLRequestContextBuilder* builder,
+ content::URLRequestInterceptorScopedVector request_interceptors,
+ std::unique_ptr<ProtocolHandlerRegistry::JobInterceptorFactory>
+ protocol_handler_interceptor,
+ net::HostResolver* host_resolver) const;
+
// Called when the Profile is destroyed. |context_getters| must include all
// URLRequestContextGetters that refer to the ProfileIOData's
// URLRequestContexts. Triggers destruction of the ProfileIOData and shuts
@@ -380,13 +402,6 @@ class ProfileIOData {
return main_request_context_.get();
}
- // Storage for |main_request_context_|, to allow objects created by subclasses
- // to live until the ProfileIOData destructor is invoked, so it can safely
- // cancel URLRequests.
- net::URLRequestContextStorage* main_request_context_storage() const {
- return main_request_context_storage_.get();
- }
-
bool initialized() const {
return initialized_;
}
@@ -396,9 +411,6 @@ class ProfileIOData {
// URLRequests may be accessing.
void DestroyResourceContext();
- std::unique_ptr<net::HttpNetworkSession> CreateHttpNetworkSession(
- const ProfileParams& profile_params) const;
-
// Creates main network transaction factory.
std::unique_ptr<net::HttpCache> CreateMainHttpFactory(
net::HttpNetworkSession* session,
@@ -448,14 +460,21 @@ class ProfileIOData {
IOThread* io_thread,
std::unique_ptr<ChromeNetworkDelegate> chrome_network_delegate) const;
- // Does the actual initialization of the ProfileIOData subtype. Subtypes
- // should use the static helper functions above to implement this.
+ // Does the initialization of the URLRequestContextBuilder for a ProfileIOData
+ // subclass. Subclasseses should use the static helper functions above to
+ // implement this.
virtual void InitializeInternal(
+ net::URLRequestContextBuilder* builder,
ProfileParams* profile_params,
content::ProtocolHandlerMap* protocol_handlers,
content::URLRequestInterceptorScopedVector request_interceptors)
const = 0;
+ // Called after the main URLRequestContext has been initialized, just after
+ // InitializeInternal().
+ virtual void OnMainRequestContextCreated(
+ ProfileParams* profile_params) const = 0;
+
// Initializes the RequestContext for extensions.
virtual void InitializeExtensionsRequestContext(
ProfileParams* profile_params) const = 0;
@@ -564,19 +583,11 @@ class ProfileIOData {
mutable std::unique_ptr<chromeos::CertificateProvider> certificate_provider_;
#endif
- // Owns the subset of URLRequestContext's elements that are created by
- // subclasses of ProfileImplIOData, to ensure proper destruction ordering.
- // TODO(mmenke): Move ownship of net objects owned by the ProfileIOData
- // itself to this class, to improve destruction ordering.
- mutable std::unique_ptr<net::URLRequestContextStorage>
- main_request_context_storage_;
mutable std::unique_ptr<net::URLRequestContext> main_request_context_;
// Pointed to by the TransportSecurityState (owned by
// URLRequestContextStorage), and must be disconnected from it before it's
// destroyed.
- mutable std::unique_ptr<net::TransportSecurityPersister>
- transport_security_persister_;
mutable std::unique_ptr<net::ReportSender> certificate_report_sender_;
mutable std::unique_ptr<certificate_transparency::CTPolicyManager>
ct_policy_manager_;
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698