OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/url_request/url_request_context_builder.h" | 5 #include "net/url_request/url_request_context_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "net/ftp/ftp_network_layer.h" | 21 #include "net/ftp/ftp_network_layer.h" |
22 #include "net/http/http_auth_handler_factory.h" | 22 #include "net/http/http_auth_handler_factory.h" |
23 #include "net/http/http_cache.h" | 23 #include "net/http/http_cache.h" |
24 #include "net/http/http_network_layer.h" | 24 #include "net/http/http_network_layer.h" |
25 #include "net/http/http_network_session.h" | 25 #include "net/http/http_network_session.h" |
26 #include "net/http/http_server_properties_impl.h" | 26 #include "net/http/http_server_properties_impl.h" |
27 #include "net/http/transport_security_state.h" | 27 #include "net/http/transport_security_state.h" |
28 #include "net/proxy/proxy_service.h" | 28 #include "net/proxy/proxy_service.h" |
29 #include "net/ssl/ssl_config_service_defaults.h" | 29 #include "net/ssl/ssl_config_service_defaults.h" |
30 #include "net/url_request/data_protocol_handler.h" | 30 #include "net/url_request/data_protocol_handler.h" |
31 #include "net/url_request/file_protocol_handler.h" | |
32 #include "net/url_request/ftp_protocol_handler.h" | |
33 #include "net/url_request/static_http_user_agent_settings.h" | 31 #include "net/url_request/static_http_user_agent_settings.h" |
34 #include "net/url_request/url_request_context.h" | 32 #include "net/url_request/url_request_context.h" |
35 #include "net/url_request/url_request_context_storage.h" | 33 #include "net/url_request/url_request_context_storage.h" |
36 #include "net/url_request/url_request_job_factory_impl.h" | 34 #include "net/url_request/url_request_job_factory_impl.h" |
37 | 35 |
| 36 #if !defined(DISABLE_FILE_SUPPORT) |
| 37 #include "net/url_request/file_protocol_handler.h" |
| 38 #endif |
| 39 |
| 40 #if !defined(DISABLE_FTP_SUPPORT) |
| 41 #include "net/url_request/ftp_protocol_handler.h" |
| 42 #endif |
| 43 |
38 namespace net { | 44 namespace net { |
39 | 45 |
40 namespace { | 46 namespace { |
41 | 47 |
42 class BasicNetworkDelegate : public NetworkDelegate { | 48 class BasicNetworkDelegate : public NetworkDelegate { |
43 public: | 49 public: |
44 BasicNetworkDelegate() {} | 50 BasicNetworkDelegate() {} |
45 virtual ~BasicNetworkDelegate() {} | 51 virtual ~BasicNetworkDelegate() {} |
46 | 52 |
47 private: | 53 private: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 http_pipelining_enabled(false), | 177 http_pipelining_enabled(false), |
172 testing_fixed_http_port(0), | 178 testing_fixed_http_port(0), |
173 testing_fixed_https_port(0), | 179 testing_fixed_https_port(0), |
174 trusted_spdy_proxy() {} | 180 trusted_spdy_proxy() {} |
175 | 181 |
176 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() | 182 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() |
177 {} | 183 {} |
178 | 184 |
179 URLRequestContextBuilder::URLRequestContextBuilder() | 185 URLRequestContextBuilder::URLRequestContextBuilder() |
180 : data_enabled_(false), | 186 : data_enabled_(false), |
| 187 #if !defined(DISABLE_FILE_SUPPORT) |
181 file_enabled_(false), | 188 file_enabled_(false), |
| 189 #endif |
182 #if !defined(DISABLE_FTP_SUPPORT) | 190 #if !defined(DISABLE_FTP_SUPPORT) |
183 ftp_enabled_(false), | 191 ftp_enabled_(false), |
184 #endif | 192 #endif |
185 http_cache_enabled_(true) { | 193 http_cache_enabled_(true) { |
186 } | 194 } |
187 | 195 |
188 URLRequestContextBuilder::~URLRequestContextBuilder() {} | 196 URLRequestContextBuilder::~URLRequestContextBuilder() {} |
189 | 197 |
190 void URLRequestContextBuilder::set_proxy_config_service( | 198 void URLRequestContextBuilder::set_proxy_config_service( |
191 ProxyConfigService* proxy_config_service) { | 199 ProxyConfigService* proxy_config_service) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 scoped_refptr<net::HttpNetworkSession> network_session( | 299 scoped_refptr<net::HttpNetworkSession> network_session( |
292 new net::HttpNetworkSession(network_session_params)); | 300 new net::HttpNetworkSession(network_session_params)); |
293 | 301 |
294 http_transaction_factory = new HttpNetworkLayer(network_session.get()); | 302 http_transaction_factory = new HttpNetworkLayer(network_session.get()); |
295 } | 303 } |
296 storage->set_http_transaction_factory(http_transaction_factory); | 304 storage->set_http_transaction_factory(http_transaction_factory); |
297 | 305 |
298 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; | 306 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; |
299 if (data_enabled_) | 307 if (data_enabled_) |
300 job_factory->SetProtocolHandler("data", new DataProtocolHandler); | 308 job_factory->SetProtocolHandler("data", new DataProtocolHandler); |
| 309 |
| 310 #if !defined(DISABLE_FILE_SUPPORT) |
301 if (file_enabled_) { | 311 if (file_enabled_) { |
302 job_factory->SetProtocolHandler( | 312 job_factory->SetProtocolHandler( |
303 "file", | 313 "file", |
304 new FileProtocolHandler(context->GetFileThread()->message_loop_proxy())); | 314 new FileProtocolHandler(context->GetFileThread()->message_loop_proxy())); |
305 } | 315 } |
| 316 #endif // !defined(DISABLE_FILE_SUPPORT) |
| 317 |
306 #if !defined(DISABLE_FTP_SUPPORT) | 318 #if !defined(DISABLE_FTP_SUPPORT) |
307 if (ftp_enabled_) { | 319 if (ftp_enabled_) { |
308 ftp_transaction_factory_.reset( | 320 ftp_transaction_factory_.reset( |
309 new FtpNetworkLayer(context->host_resolver())); | 321 new FtpNetworkLayer(context->host_resolver())); |
310 job_factory->SetProtocolHandler("ftp", | 322 job_factory->SetProtocolHandler("ftp", |
311 new FtpProtocolHandler(ftp_transaction_factory_.get())); | 323 new FtpProtocolHandler(ftp_transaction_factory_.get())); |
312 } | 324 } |
313 #endif | 325 #endif // !defined(DISABLE_FTP_SUPPORT) |
| 326 |
314 storage->set_job_factory(job_factory); | 327 storage->set_job_factory(job_factory); |
315 | 328 |
316 // TODO(willchan): Support sdch. | 329 // TODO(willchan): Support sdch. |
317 | 330 |
318 return context; | 331 return context; |
319 } | 332 } |
320 | 333 |
321 } // namespace net | 334 } // namespace net |
OLD | NEW |