Chromium Code Reviews| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 : ignore_certificate_errors(false), | 177 : ignore_certificate_errors(false), |
| 178 host_mapping_rules(NULL), | 178 host_mapping_rules(NULL), |
| 179 http_pipelining_enabled(false), | 179 http_pipelining_enabled(false), |
| 180 testing_fixed_http_port(0), | 180 testing_fixed_http_port(0), |
| 181 testing_fixed_https_port(0), | 181 testing_fixed_https_port(0), |
| 182 trusted_spdy_proxy() {} | 182 trusted_spdy_proxy() {} |
| 183 | 183 |
| 184 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() | 184 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams() |
| 185 {} | 185 {} |
| 186 | 186 |
| 187 URLRequestContextBuilder::URLRequestContextBuilder() | 187 URLRequestContextBuilder::URLRequestContextBuilder( |
| 188 const scoped_refptr<base::TaskRunner>& task_runner) | |
|
akalin
2013/08/15 17:43:05
don't think you need this parameter -- see context
| |
| 188 : data_enabled_(false), | 189 : data_enabled_(false), |
| 189 file_enabled_(false), | 190 file_enabled_(false), |
| 190 #if !defined(DISABLE_FTP_SUPPORT) | 191 #if !defined(DISABLE_FTP_SUPPORT) |
| 191 ftp_enabled_(false), | 192 ftp_enabled_(false), |
| 192 #endif | 193 #endif |
| 193 http_cache_enabled_(true) {} | 194 http_cache_enabled_(true), |
| 195 task_runner_(task_runner) { | |
| 196 } | |
| 197 | |
| 194 URLRequestContextBuilder::~URLRequestContextBuilder() {} | 198 URLRequestContextBuilder::~URLRequestContextBuilder() {} |
| 195 | 199 |
| 196 #if defined(OS_LINUX) || defined(OS_ANDROID) | 200 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 197 void URLRequestContextBuilder::set_proxy_config_service( | 201 void URLRequestContextBuilder::set_proxy_config_service( |
| 198 ProxyConfigService* proxy_config_service) { | 202 ProxyConfigService* proxy_config_service) { |
| 199 proxy_config_service_.reset(proxy_config_service); | 203 proxy_config_service_.reset(proxy_config_service); |
| 200 } | 204 } |
| 201 #endif // defined(OS_LINUX) || defined(OS_ANDROID) | 205 #endif // defined(OS_LINUX) || defined(OS_ANDROID) |
| 202 | 206 |
| 203 URLRequestContext* URLRequestContextBuilder::Build() { | 207 URLRequestContext* URLRequestContextBuilder::Build() { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 294 new net::HttpNetworkSession(network_session_params)); | 298 new net::HttpNetworkSession(network_session_params)); |
| 295 | 299 |
| 296 http_transaction_factory = new HttpNetworkLayer(network_session.get()); | 300 http_transaction_factory = new HttpNetworkLayer(network_session.get()); |
| 297 } | 301 } |
| 298 storage->set_http_transaction_factory(http_transaction_factory); | 302 storage->set_http_transaction_factory(http_transaction_factory); |
| 299 | 303 |
| 300 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; | 304 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; |
| 301 if (data_enabled_) | 305 if (data_enabled_) |
| 302 job_factory->SetProtocolHandler("data", new DataProtocolHandler); | 306 job_factory->SetProtocolHandler("data", new DataProtocolHandler); |
| 303 if (file_enabled_) | 307 if (file_enabled_) |
| 304 job_factory->SetProtocolHandler("file", new FileProtocolHandler); | 308 job_factory->SetProtocolHandler("file", |
| 309 new FileProtocolHandler(task_runner_)); | |
| 305 #if !defined(DISABLE_FTP_SUPPORT) | 310 #if !defined(DISABLE_FTP_SUPPORT) |
| 306 if (ftp_enabled_) { | 311 if (ftp_enabled_) { |
| 307 ftp_transaction_factory_.reset( | 312 ftp_transaction_factory_.reset( |
| 308 new FtpNetworkLayer(context->host_resolver())); | 313 new FtpNetworkLayer(context->host_resolver())); |
| 309 job_factory->SetProtocolHandler("ftp", | 314 job_factory->SetProtocolHandler("ftp", |
| 310 new FtpProtocolHandler(ftp_transaction_factory_.get())); | 315 new FtpProtocolHandler(ftp_transaction_factory_.get())); |
| 311 } | 316 } |
| 312 #endif | 317 #endif |
| 313 storage->set_job_factory(job_factory); | 318 storage->set_job_factory(job_factory); |
| 314 | 319 |
| 315 // TODO(willchan): Support sdch. | 320 // TODO(willchan): Support sdch. |
| 316 | 321 |
| 317 return context; | 322 return context; |
| 318 } | 323 } |
| 319 | 324 |
| 320 } // namespace net | 325 } // namespace net |
| OLD | NEW |