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

Side by Side Diff: chromecast/shell/browser/url_request_context_factory.h

Issue 223143003: Initial checkin of chromecast content embedder (cast_shell) and related build scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to the latest Chromium source. Created 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_
6 #define CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_
7
8 #include "content/public/browser/content_browser_client.h"
9 #include "net/http/http_network_session.h"
10
11 namespace net {
12 class HttpTransactionFactory;
13 class HttpUserAgentSettings;
14 class URLRequestJobFactoryImpl;
15 } // namespace net
16
17 namespace chromecast {
18 namespace shell {
19
20 class URLRequestContextFactory {
21 public:
22 URLRequestContextFactory();
23 ~URLRequestContextFactory();
24
25 // Some members must be initialized on UI thread.
26 void InitializeOnUIThread();
27
28 // Since main context requires a bunch of input params, if these get called
29 // multiple times, either multiple main contexts should be supported/managed
30 // or the input params need to be the same as before. So to be safe,
31 // the CreateMainGetter function currently DCHECK to make sure it is not
32 // called more than once.
33 // The media and system getters however, do not need input, so it is actually
34 // safe to call these multiple times. The impl create only 1 getter of each
35 // type and return the same instance each time the methods are called, thus
36 // the name difference.
37 net::URLRequestContextGetter* GetSystemGetter();
38 net::URLRequestContextGetter* CreateMainGetter(
39 content::BrowserContext* browser_context,
40 content::ProtocolHandlerMap* protocol_handlers);
41 net::URLRequestContextGetter* GetMainGetter();
42 net::URLRequestContextGetter* GetMediaGetter();
43
44 private:
45 class URLRequestContextGetter;
46 class MainURLRequestContextGetter;
47 friend class URLRequestContextGetter;
48 friend class MainURLRequestContextGetter;
49
50 void InitializeSystemContextDependencies();
51 void InitializeMainContextDependencies(
52 net::HttpTransactionFactory* factory,
53 content::ProtocolHandlerMap* protocol_handlers);
54 void InitializeMediaContextDependencies(net::HttpTransactionFactory* factory);
55
56 void PopulateNetworkSessionParams(bool ignore_certificate_errors,
57 net::HttpNetworkSession::Params* params);
58
59 // These are called by the RequestContextGetters to create each
60 // RequestContext.
61 // They must be called on the IO thread.
62 net::URLRequestContext* CreateSystemRequestContext();
63 net::URLRequestContext* CreateMediaRequestContext();
64 net::URLRequestContext* CreateMainRequestContext(
65 content::BrowserContext* browser_context,
66 content::ProtocolHandlerMap* protocol_handlers);
67
68 scoped_refptr<net::URLRequestContextGetter> system_getter_;
69 scoped_refptr<net::URLRequestContextGetter> media_getter_;
70 scoped_refptr<net::URLRequestContextGetter> main_getter_;
71
72 // Shared objects for all contexts.
73 // The URLRequestContextStorage class is not used as owner to these objects
74 // since they are shared between the different URLRequestContexts.
75 // The URLRequestContextStorage class manages dependent resources for a single
76 // instance of URLRequestContext only.
77 bool system_dependencies_initialized_;
78 scoped_ptr<net::HostResolver> host_resolver_;
79 scoped_ptr<net::ServerBoundCertService> server_bound_cert_service_;
80 scoped_ptr<net::CertVerifier> cert_verifier_;
81 scoped_refptr<net::SSLConfigService> ssl_config_service_;
82 scoped_ptr<net::TransportSecurityState> transport_security_state_;
83 scoped_ptr<net::ProxyService> proxy_service_;
84 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory_;
85 scoped_ptr<net::HttpServerProperties> http_server_properties_;
86 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings_;
87 scoped_ptr<net::HttpTransactionFactory> system_transaction_factory_;
88
89 bool main_dependencies_initialized_;
90 scoped_ptr<net::HttpTransactionFactory> main_transaction_factory_;
91 scoped_ptr<net::URLRequestJobFactoryImpl> main_job_factory_;
92
93 bool media_dependencies_initialized_;
94 scoped_ptr<net::HttpTransactionFactory> media_transaction_factory_;
95 };
96
97 } // namespace shell
98 } // namespace chromecast
99
100 #endif // CHROMECAST_SHELL_BROWSER_URL_REQUEST_CONTEXT_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698