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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/threading/worker_pool.h" | 10 #include "base/threading/worker_pool.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 145 |
146 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { | 146 void URLRequestContextFactory::InitializeOnUIThread(net::NetLog* net_log) { |
147 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 147 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
148 // Cast http user agent settings must be initialized in UI thread | 148 // Cast http user agent settings must be initialized in UI thread |
149 // because it registers itself to pref notification observer which is not | 149 // because it registers itself to pref notification observer which is not |
150 // thread safe. | 150 // thread safe. |
151 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); | 151 http_user_agent_settings_.reset(new CastHttpUserAgentSettings()); |
152 | 152 |
153 // Proxy config service should be initialized in UI thread, since | 153 // Proxy config service should be initialized in UI thread, since |
154 // ProxyConfigServiceDelegate on Android expects UI thread. | 154 // ProxyConfigServiceDelegate on Android expects UI thread. |
155 proxy_config_service_.reset(net::ProxyService::CreateSystemProxyConfigService( | 155 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
156 content::BrowserThread::GetMessageLoopProxyForThread( | 156 content::BrowserThread::GetMessageLoopProxyForThread( |
157 content::BrowserThread::IO), | 157 content::BrowserThread::IO), |
158 content::BrowserThread::GetMessageLoopProxyForThread( | 158 content::BrowserThread::GetMessageLoopProxyForThread( |
159 content::BrowserThread::FILE))); | 159 content::BrowserThread::FILE)); |
160 | 160 |
161 net_log_ = net_log; | 161 net_log_ = net_log; |
162 } | 162 } |
163 | 163 |
164 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( | 164 net::URLRequestContextGetter* URLRequestContextFactory::CreateMainGetter( |
165 content::BrowserContext* browser_context, | 165 content::BrowserContext* browser_context, |
166 content::ProtocolHandlerMap* protocol_handlers, | 166 content::ProtocolHandlerMap* protocol_handlers, |
167 content::URLRequestInterceptorScopedVector request_interceptors) { | 167 content::URLRequestInterceptorScopedVector request_interceptors) { |
168 DCHECK(!main_getter_.get()) | 168 DCHECK(!main_getter_.get()) |
169 << "Main URLRequestContextGetter already initialized"; | 169 << "Main URLRequestContextGetter already initialized"; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 | 210 |
211 ssl_config_service_ = new net::SSLConfigServiceDefaults; | 211 ssl_config_service_ = new net::SSLConfigServiceDefaults; |
212 | 212 |
213 transport_security_state_.reset(new net::TransportSecurityState()); | 213 transport_security_state_.reset(new net::TransportSecurityState()); |
214 http_auth_handler_factory_ = | 214 http_auth_handler_factory_ = |
215 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get()); | 215 net::HttpAuthHandlerFactory::CreateDefault(host_resolver_.get()); |
216 | 216 |
217 http_server_properties_.reset(new net::HttpServerPropertiesImpl); | 217 http_server_properties_.reset(new net::HttpServerPropertiesImpl); |
218 | 218 |
219 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( | 219 proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( |
220 proxy_config_service_.release(), 0, NULL); | 220 proxy_config_service_.Pass(), 0, NULL); |
221 system_dependencies_initialized_ = true; | 221 system_dependencies_initialized_ = true; |
222 } | 222 } |
223 | 223 |
224 void URLRequestContextFactory::InitializeMainContextDependencies( | 224 void URLRequestContextFactory::InitializeMainContextDependencies( |
225 net::HttpTransactionFactory* transaction_factory, | 225 net::HttpTransactionFactory* transaction_factory, |
226 content::ProtocolHandlerMap* protocol_handlers, | 226 content::ProtocolHandlerMap* protocol_handlers, |
227 content::URLRequestInterceptorScopedVector request_interceptors) { | 227 content::URLRequestInterceptorScopedVector request_interceptors) { |
228 if (main_dependencies_initialized_) | 228 if (main_dependencies_initialized_) |
229 return; | 229 return; |
230 | 230 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 void URLRequestContextFactory::InitializeNetworkDelegates() { | 409 void URLRequestContextFactory::InitializeNetworkDelegates() { |
410 app_network_delegate_->Initialize(false); | 410 app_network_delegate_->Initialize(false); |
411 LOG(INFO) << "Initialized app network delegate."; | 411 LOG(INFO) << "Initialized app network delegate."; |
412 system_network_delegate_->Initialize(false); | 412 system_network_delegate_->Initialize(false); |
413 LOG(INFO) << "Initialized system network delegate."; | 413 LOG(INFO) << "Initialized system network delegate."; |
414 } | 414 } |
415 | 415 |
416 } // namespace shell | 416 } // namespace shell |
417 } // namespace chromecast | 417 } // namespace chromecast |
OLD | NEW |