Chromium Code Reviews| Index: chromecast/shell/browser/url_request_context_factory.h |
| diff --git a/chromecast/shell/browser/url_request_context_factory.h b/chromecast/shell/browser/url_request_context_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..bf546fddc6e638d047d663defd156920df70dc6f |
| --- /dev/null |
| +++ b/chromecast/shell/browser/url_request_context_factory.h |
| @@ -0,0 +1,109 @@ |
| +// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ |
| +#define CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ |
| + |
| +#include "content/public/browser/content_browser_client.h" |
| +#include "net/http/http_network_session.h" |
| + |
| +namespace net { |
| +class CertVerifier; |
| +class HostResolver; |
| +class HttpAuthHandlerFactory; |
| +class HttpServerProperties; |
| +class HttpTransactionFactory; |
| +class HttpUserAgentSettings; |
| +class ProxyService; |
| +class ServerBoundCertService; |
| +class SSLConfigService; |
| +class URLRequestContext; |
| +class URLRequestContextGetter; |
| +class URLRequestJobFactoryImpl; |
| +} // namespace net |
|
jam
2014/07/01 21:56:10
don't need most (or all) of these
lcwu1
2014/07/02 23:30:33
Done.
|
| + |
| +namespace chromecast { |
| +namespace shell { |
| + |
| +class URLRequestContextFactory { |
| + public: |
| + URLRequestContextFactory(); |
| + ~URLRequestContextFactory(); |
| + |
| + // Some members must be initialized on UI thread. |
| + void InitializeOnUIThread(); |
| + |
| + // Since main context requires a bunch of input params, if these get called |
| + // multiple times, we would either need to manage multiple main contexts or |
| + // make sure that the input params are the same as before. So to be safe, |
| + // the CreateMainGetter function currently DCHECK to make sure it is not |
| + // called more than once. |
| + // The media and system getters however, do not need input, so it is actually |
| + // safe to call these multiple times. The impl create only 1 getter of each |
| + // type and return the same instance each time the methods are called, thus |
| + // the name difference. |
| + net::URLRequestContextGetter* GetSystemGetter(); |
| + net::URLRequestContextGetter* CreateMainGetter( |
| + content::BrowserContext* browser_context, |
| + content::ProtocolHandlerMap* protocol_handlers); |
| + net::URLRequestContextGetter* GetMainGetter(); |
| + net::URLRequestContextGetter* GetMediaGetter(); |
| + |
| + private: |
| + class URLRequestContextGetter; |
| + class MainURLRequestContextGetter; |
| + friend class URLRequestContextGetter; |
| + friend class MainURLRequestContextGetter; |
| + |
| + void InitializeSystemContextDependencies(); |
| + void InitializeMainContextDependencies( |
| + net::HttpTransactionFactory* factory, |
| + content::ProtocolHandlerMap* protocol_handlers); |
| + void InitializeMediaContextDependencies(net::HttpTransactionFactory* factory); |
| + |
| + void PopulateNetworkSessionParams(bool ignore_certificate_errors, |
| + net::HttpNetworkSession::Params* params); |
| + |
| + // These are called by the RequestContextGetters to create each |
| + // RequestContext. |
| + // They must be called on the IO thread. |
| + net::URLRequestContext* CreateSystemRequestContext(); |
| + net::URLRequestContext* CreateMediaRequestContext(); |
| + net::URLRequestContext* CreateMainRequestContext( |
| + content::BrowserContext* browser_context, |
| + content::ProtocolHandlerMap* protocol_handlers); |
| + |
| + scoped_refptr<net::URLRequestContextGetter> system_getter_; |
| + scoped_refptr<net::URLRequestContextGetter> media_getter_; |
| + scoped_refptr<net::URLRequestContextGetter> main_getter_; |
| + |
| + // Shared objects for all contexts |
| + // We do not use the URLRequestContextStorage class as owner to these objects |
| + // since they are shared between the different URLRequestContexts. |
| + // The URLRequestContextStorage class manages dependent resources for a single |
| + // instance of URLRequestContext only. |
| + bool system_dependencies_initialized_; |
| + scoped_ptr<net::HostResolver> host_resolver_; |
| + scoped_ptr<net::ServerBoundCertService> server_bound_cert_service_; |
| + scoped_ptr<net::CertVerifier> cert_verifier_; |
| + scoped_refptr<net::SSLConfigService> ssl_config_service_; |
| + scoped_ptr<net::TransportSecurityState> transport_security_state_; |
| + scoped_ptr<net::ProxyService> proxy_service_; |
| + scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_; |
| + scoped_ptr<net::HttpServerProperties> http_server_properties_; |
| + scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_; |
| + scoped_ptr<net::HttpTransactionFactory> system_transaction_factory_; |
| + |
| + bool main_dependencies_initialized_; |
| + scoped_ptr<net::HttpTransactionFactory> main_transaction_factory_; |
| + scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory_; |
| + |
| + bool media_dependencies_initialized_; |
| + scoped_ptr<net::HttpTransactionFactory> media_transaction_factory_; |
| +}; |
| + |
| +} // namespace shell |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_ |