OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromecast/browser/url_request_context_factory.h" | 5 #include "chromecast/browser/url_request_context_factory.h" |
6 | 6 |
7 #include <algorithm> | |
7 #include <utility> | 8 #include <utility> |
8 | 9 |
9 #include "base/command_line.h" | 10 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
13 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
14 #include "chromecast/base/chromecast_switches.h" | 15 #include "chromecast/base/chromecast_switches.h" |
16 #include "chromecast/browser/cast_browser_process.h" | |
15 #include "chromecast/browser/cast_http_user_agent_settings.h" | 17 #include "chromecast/browser/cast_http_user_agent_settings.h" |
16 #include "chromecast/browser/cast_network_delegate.h" | 18 #include "chromecast/browser/cast_network_delegate.h" |
19 #include "components/proxy_config/pref_proxy_config_tracker.h" | |
17 #include "content/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
18 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/cookie_store_factory.h" | 22 #include "content/public/browser/cookie_store_factory.h" |
20 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
21 #include "content/public/common/url_constants.h" | 24 #include "content/public/common/url_constants.h" |
22 #include "net/cert/cert_verifier.h" | 25 #include "net/cert/cert_verifier.h" |
23 #include "net/cert/ct_policy_enforcer.h" | 26 #include "net/cert/ct_policy_enforcer.h" |
24 #include "net/cert/ct_policy_status.h" | 27 #include "net/cert/ct_policy_status.h" |
25 #include "net/cert/do_nothing_ct_verifier.h" | 28 #include "net/cert/do_nothing_ct_verifier.h" |
26 #include "net/cert_net/nss_ocsp.h" | 29 #include "net/cert_net/nss_ocsp.h" |
27 #include "net/cookies/cookie_store.h" | 30 #include "net/cookies/cookie_store.h" |
28 #include "net/dns/host_resolver.h" | 31 #include "net/dns/host_resolver.h" |
29 #include "net/http/http_auth_handler_factory.h" | 32 #include "net/http/http_auth_handler_factory.h" |
30 #include "net/http/http_network_layer.h" | 33 #include "net/http/http_network_layer.h" |
31 #include "net/http/http_server_properties_impl.h" | 34 #include "net/http/http_server_properties_impl.h" |
32 #include "net/http/http_stream_factory.h" | 35 #include "net/http/http_stream_factory.h" |
36 #include "net/proxy/proxy_config_service_fixed.h" | |
wzhong
2017/01/27 23:37:17
Needed?
almasrymina
2017/02/06 22:38:34
Done.
| |
33 #include "net/proxy/proxy_service.h" | 37 #include "net/proxy/proxy_service.h" |
34 #include "net/ssl/channel_id_service.h" | 38 #include "net/ssl/channel_id_service.h" |
35 #include "net/ssl/default_channel_id_store.h" | 39 #include "net/ssl/default_channel_id_store.h" |
36 #include "net/ssl/ssl_config_service_defaults.h" | 40 #include "net/ssl/ssl_config_service_defaults.h" |
37 #include "net/url_request/data_protocol_handler.h" | 41 #include "net/url_request/data_protocol_handler.h" |
38 #include "net/url_request/file_protocol_handler.h" | 42 #include "net/url_request/file_protocol_handler.h" |
39 #include "net/url_request/url_request_context.h" | 43 #include "net/url_request/url_request_context.h" |
40 #include "net/url_request/url_request_context_getter.h" | 44 #include "net/url_request/url_request_context_getter.h" |
41 #include "net/url_request/url_request_intercepting_job_factory.h" | 45 #include "net/url_request/url_request_intercepting_job_factory.h" |
42 #include "net/url_request/url_request_job_factory_impl.h" | 46 #include "net/url_request/url_request_job_factory_impl.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 | 177 |
174 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { | 178 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 179 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
176 // Cast http user agent settings must be initialized in UI thread | 180 // Cast http user agent settings must be initialized in UI thread |
177 // because it registers itself to pref notification observer which is not | 181 // because it registers itself to pref notification observer which is not |
178 // thread safe. | 182 // thread safe. |
179 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); | 183 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); |
180 | 184 |
181 // Proxy config service should be initialized in UI thread, since | 185 // Proxy config service should be initialized in UI thread, since |
182 // ProxyConfigServiceDelegate on Android expects UI thread. | 186 // ProxyConfigServiceDelegate on Android expects UI thread. |
183 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 187 proxy_config_service_ = CastBrowserProcess::GetInstance() |
184 content::BrowserThread::GetTaskRunnerForThread( | 188 ->pref_proxy_config_tracker() |
185 content::BrowserThread::IO), | 189 ->CreateTrackingProxyConfigService(nullptr); |
186 content::BrowserThread::GetTaskRunnerForThread( | |
187 content::BrowserThread::FILE)); | |
188 | |
189 net_log_ = net_log; | 190 net_log_ = net_log; |
190 } | 191 } |
191 | 192 |
192 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( | 193 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( |
193 content::BrowserContext* browser_context, | 194 content::BrowserContext* browser_context, |
194 content::ProtocolHandlerMap* protocol_handlers, | 195 content::ProtocolHandlerMap* protocol_handlers, |
195 content::URLRequestInterceptorScopedVector request_interceptors) { | 196 content::URLRequestInterceptorScopedVector request_interceptors) { |
196 DCHECK(!main_getter_.get()) | 197 DCHECK(!main_getter_.get()) |
197 << "Main URLRequestContextGetter already initialized"; | 198 << "Main URLRequestContextGetter already initialized"; |
198 main_getter_ = | 199 main_getter_ = |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 | 423 |
423 void URLRequestContextFactory::InitializeNetworkDelegates() { | 424 void URLRequestContextFactory::InitializeNetworkDelegates() { |
424 app_network_delegate_->Initialize(false); | 425 app_network_delegate_->Initialize(false); |
425 LOG(INFO) << "Initialized app network delegate."; | 426 LOG(INFO) << "Initialized app network delegate."; |
426 system_network_delegate_->Initialize(false); | 427 system_network_delegate_->Initialize(false); |
427 LOG(INFO) << "Initialized system network delegate."; | 428 LOG(INFO) << "Initialized system network delegate."; |
428 } | 429 } |
429 | 430 |
430 } // namespace shell | 431 } // namespace shell |
431 } // namespace chromecast | 432 } // namespace chromecast |
OLD | NEW |