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/shell/browser/url_request_context_factory.h" | 5 #include "chromecast/shell/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/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "net/http/http_network_layer.h" | 23 #include "net/http/http_network_layer.h" |
24 #include "net/http/http_server_properties_impl.h" | 24 #include "net/http/http_server_properties_impl.h" |
25 #include "net/http/http_stream_factory.h" | 25 #include "net/http/http_stream_factory.h" |
26 #include "net/ocsp/nss_ocsp.h" | 26 #include "net/ocsp/nss_ocsp.h" |
27 #include "net/proxy/proxy_service.h" | 27 #include "net/proxy/proxy_service.h" |
28 #include "net/socket/next_proto.h" | 28 #include "net/socket/next_proto.h" |
29 #include "net/ssl/channel_id_service.h" | 29 #include "net/ssl/channel_id_service.h" |
30 #include "net/ssl/default_channel_id_store.h" | 30 #include "net/ssl/default_channel_id_store.h" |
31 #include "net/ssl/ssl_config_service_defaults.h" | 31 #include "net/ssl/ssl_config_service_defaults.h" |
32 #include "net/url_request/data_protocol_handler.h" | 32 #include "net/url_request/data_protocol_handler.h" |
| 33 #include "net/url_request/file_protocol_handler.h" |
33 #include "net/url_request/url_request_context.h" | 34 #include "net/url_request/url_request_context.h" |
34 #include "net/url_request/url_request_context_getter.h" | 35 #include "net/url_request/url_request_context_getter.h" |
35 #include "net/url_request/url_request_intercepting_job_factory.h" | 36 #include "net/url_request/url_request_intercepting_job_factory.h" |
36 #include "net/url_request/url_request_job_factory_impl.h" | 37 #include "net/url_request/url_request_job_factory_impl.h" |
37 | 38 |
38 namespace chromecast { | 39 namespace chromecast { |
39 namespace shell { | 40 namespace shell { |
40 | 41 |
41 namespace { | 42 namespace { |
42 | 43 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 it != protocol_handlers->end(); | 234 it != protocol_handlers->end(); |
234 ++it) { | 235 ++it) { |
235 set_protocol = job_factory->SetProtocolHandler( | 236 set_protocol = job_factory->SetProtocolHandler( |
236 it->first, it->second.release()); | 237 it->first, it->second.release()); |
237 DCHECK(set_protocol); | 238 DCHECK(set_protocol); |
238 } | 239 } |
239 set_protocol = job_factory->SetProtocolHandler( | 240 set_protocol = job_factory->SetProtocolHandler( |
240 url::kDataScheme, | 241 url::kDataScheme, |
241 new net::DataProtocolHandler); | 242 new net::DataProtocolHandler); |
242 DCHECK(set_protocol); | 243 DCHECK(set_protocol); |
| 244 #if defined(OS_ANDROID) |
| 245 set_protocol = job_factory->SetProtocolHandler( |
| 246 url::kFileScheme, |
| 247 new net::FileProtocolHandler( |
| 248 content::BrowserThread::GetBlockingPool()-> |
| 249 GetTaskRunnerWithShutdownBehavior( |
| 250 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); |
| 251 DCHECK(set_protocol); |
| 252 #endif // defined(OS_ANDROID) |
243 | 253 |
244 // Set up interceptors in the reverse order. | 254 // Set up interceptors in the reverse order. |
245 scoped_ptr<net::URLRequestJobFactory> top_job_factory = | 255 scoped_ptr<net::URLRequestJobFactory> top_job_factory = |
246 job_factory.PassAs<net::URLRequestJobFactory>(); | 256 job_factory.PassAs<net::URLRequestJobFactory>(); |
247 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = | 257 for (content::URLRequestInterceptorScopedVector::reverse_iterator i = |
248 request_interceptors.rbegin(); | 258 request_interceptors.rbegin(); |
249 i != request_interceptors.rend(); | 259 i != request_interceptors.rend(); |
250 ++i) { | 260 ++i) { |
251 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( | 261 top_job_factory.reset(new net::URLRequestInterceptingJobFactory( |
252 top_job_factory.Pass(), make_scoped_ptr(*i))); | 262 top_job_factory.Pass(), make_scoped_ptr(*i))); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 http_user_agent_settings_.get()); | 392 http_user_agent_settings_.get()); |
383 | 393 |
384 main_context->set_http_transaction_factory( | 394 main_context->set_http_transaction_factory( |
385 main_transaction_factory_.get()); | 395 main_transaction_factory_.get()); |
386 main_context->set_job_factory(main_job_factory_.get()); | 396 main_context->set_job_factory(main_job_factory_.get()); |
387 return main_context; | 397 return main_context; |
388 } | 398 } |
389 | 399 |
390 } // namespace shell | 400 } // namespace shell |
391 } // namespace chromecast | 401 } // namespace chromecast |
OLD | NEW |