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" |
17 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
18 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
19 #include "content/public/browser/cookie_store_factory.h" | 21 #include "content/public/browser/cookie_store_factory.h" |
20 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
21 #include "content/public/common/url_constants.h" | 23 #include "content/public/common/url_constants.h" |
22 #include "net/cert/cert_verifier.h" | 24 #include "net/cert/cert_verifier.h" |
23 #include "net/cert/ct_policy_enforcer.h" | 25 #include "net/cert/ct_policy_enforcer.h" |
24 #include "net/cert/ct_policy_status.h" | 26 #include "net/cert/ct_policy_status.h" |
25 #include "net/cert/do_nothing_ct_verifier.h" | 27 #include "net/cert/do_nothing_ct_verifier.h" |
26 #include "net/cert_net/nss_ocsp.h" | 28 #include "net/cert_net/nss_ocsp.h" |
27 #include "net/cookies/cookie_store.h" | 29 #include "net/cookies/cookie_store.h" |
28 #include "net/dns/host_resolver.h" | 30 #include "net/dns/host_resolver.h" |
29 #include "net/http/http_auth_handler_factory.h" | 31 #include "net/http/http_auth_handler_factory.h" |
30 #include "net/http/http_network_layer.h" | 32 #include "net/http/http_network_layer.h" |
31 #include "net/http/http_server_properties_impl.h" | 33 #include "net/http/http_server_properties_impl.h" |
32 #include "net/http/http_stream_factory.h" | 34 #include "net/http/http_stream_factory.h" |
| 35 #include "net/proxy/proxy_config_service_fixed.h" |
33 #include "net/proxy/proxy_service.h" | 36 #include "net/proxy/proxy_service.h" |
34 #include "net/ssl/channel_id_service.h" | 37 #include "net/ssl/channel_id_service.h" |
35 #include "net/ssl/default_channel_id_store.h" | 38 #include "net/ssl/default_channel_id_store.h" |
36 #include "net/ssl/ssl_config_service_defaults.h" | 39 #include "net/ssl/ssl_config_service_defaults.h" |
37 #include "net/url_request/data_protocol_handler.h" | 40 #include "net/url_request/data_protocol_handler.h" |
38 #include "net/url_request/file_protocol_handler.h" | 41 #include "net/url_request/file_protocol_handler.h" |
39 #include "net/url_request/url_request_context.h" | 42 #include "net/url_request/url_request_context.h" |
40 #include "net/url_request/url_request_context_getter.h" | 43 #include "net/url_request/url_request_context_getter.h" |
41 #include "net/url_request/url_request_intercepting_job_factory.h" | 44 #include "net/url_request/url_request_intercepting_job_factory.h" |
42 #include "net/url_request/url_request_job_factory_impl.h" | 45 #include "net/url_request/url_request_job_factory_impl.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 176 |
174 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { | 177 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
175 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 178 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
176 // Cast http user agent settings must be initialized in UI thread | 179 // Cast http user agent settings must be initialized in UI thread |
177 // because it registers itself to pref notification observer which is not | 180 // because it registers itself to pref notification observer which is not |
178 // thread safe. | 181 // thread safe. |
179 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); | 182 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); |
180 | 183 |
181 // Proxy config service should be initialized in UI thread, since | 184 // Proxy config service should be initialized in UI thread, since |
182 // ProxyConfigServiceDelegate on Android expects UI thread. | 185 // ProxyConfigServiceDelegate on Android expects UI thread. |
183 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 186 proxy_config_service_ = base::MakeUnique<net::ProxyConfigServiceFixed>( |
184 content::BrowserThread::GetTaskRunnerForThread( | 187 *CastBrowserProcess::GetInstance()->proxy_config()); |
185 content::BrowserThread::IO), | |
186 content::BrowserThread::GetTaskRunnerForThread( | |
187 content::BrowserThread::FILE)); | |
188 | |
189 net_log_ = net_log; | 188 net_log_ = net_log; |
190 } | 189 } |
191 | 190 |
192 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( | 191 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( |
193 content::BrowserContext* browser_context, | 192 content::BrowserContext* browser_context, |
194 content::ProtocolHandlerMap* protocol_handlers, | 193 content::ProtocolHandlerMap* protocol_handlers, |
195 content::URLRequestInterceptorScopedVector request_interceptors) { | 194 content::URLRequestInterceptorScopedVector request_interceptors) { |
196 DCHECK(!main_getter_.get()) | 195 DCHECK(!main_getter_.get()) |
197 << "Main URLRequestContextGetter already initialized"; | 196 << "Main URLRequestContextGetter already initialized"; |
198 main_getter_ = | 197 main_getter_ = |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 423 |
425 void URLRequestContextFactory::InitializeNetworkDelegates() { | 424 void URLRequestContextFactory::InitializeNetworkDelegates() { |
426 app_network_delegate_->Initialize(false); | 425 app_network_delegate_->Initialize(false); |
427 LOG(INFO) << "Initialized app network delegate."; | 426 LOG(INFO) << "Initialized app network delegate."; |
428 system_network_delegate_->Initialize(false); | 427 system_network_delegate_->Initialize(false); |
429 LOG(INFO) << "Initialized system network delegate."; | 428 LOG(INFO) << "Initialized system network delegate."; |
430 } | 429 } |
431 | 430 |
432 } // namespace shell | 431 } // namespace shell |
433 } // namespace chromecast | 432 } // namespace chromecast |
OLD | NEW |