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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
14 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "net/base/cache_type.h" | 16 #include "net/base/cache_type.h" |
17 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
18 #include "net/base/network_delegate_impl.h" | 18 #include "net/base/network_delegate_impl.h" |
| 19 #include "net/base/sdch_manager.h" |
19 #include "net/cert/cert_verifier.h" | 20 #include "net/cert/cert_verifier.h" |
20 #include "net/cookies/cookie_monster.h" | 21 #include "net/cookies/cookie_monster.h" |
21 #include "net/dns/host_resolver.h" | 22 #include "net/dns/host_resolver.h" |
22 #include "net/ftp/ftp_network_layer.h" | 23 #include "net/ftp/ftp_network_layer.h" |
23 #include "net/http/http_auth_handler_factory.h" | 24 #include "net/http/http_auth_handler_factory.h" |
24 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
25 #include "net/http/http_network_layer.h" | 26 #include "net/http/http_network_layer.h" |
26 #include "net/http/http_network_session.h" | 27 #include "net/http/http_network_session.h" |
27 #include "net/http/http_server_properties_impl.h" | 28 #include "net/http/http_server_properties_impl.h" |
28 #include "net/http/transport_security_persister.h" | 29 #include "net/http/transport_security_persister.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 199 |
199 URLRequestContextBuilder::URLRequestContextBuilder() | 200 URLRequestContextBuilder::URLRequestContextBuilder() |
200 : data_enabled_(false), | 201 : data_enabled_(false), |
201 #if !defined(DISABLE_FILE_SUPPORT) | 202 #if !defined(DISABLE_FILE_SUPPORT) |
202 file_enabled_(false), | 203 file_enabled_(false), |
203 #endif | 204 #endif |
204 #if !defined(DISABLE_FTP_SUPPORT) | 205 #if !defined(DISABLE_FTP_SUPPORT) |
205 ftp_enabled_(false), | 206 ftp_enabled_(false), |
206 #endif | 207 #endif |
207 http_cache_enabled_(true), | 208 http_cache_enabled_(true), |
208 throttling_enabled_(false) { | 209 throttling_enabled_(false), |
| 210 sdch_enabled_(false) { |
209 } | 211 } |
210 | 212 |
211 URLRequestContextBuilder::~URLRequestContextBuilder() {} | 213 URLRequestContextBuilder::~URLRequestContextBuilder() {} |
212 | 214 |
213 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { | 215 void URLRequestContextBuilder::EnableHttpCache(const HttpCacheParams& params) { |
214 http_cache_enabled_ = true; | 216 http_cache_enabled_ = true; |
215 http_cache_params_ = params; | 217 http_cache_params_ = params; |
216 } | 218 } |
217 | 219 |
218 void URLRequestContextBuilder::DisableHttpCache() { | 220 void URLRequestContextBuilder::DisableHttpCache() { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 storage->set_cookie_store(cookie_store_.get()); | 303 storage->set_cookie_store(cookie_store_.get()); |
302 storage->set_channel_id_service(channel_id_service_.Pass()); | 304 storage->set_channel_id_service(channel_id_service_.Pass()); |
303 } else { | 305 } else { |
304 storage->set_cookie_store(new CookieMonster(NULL, NULL)); | 306 storage->set_cookie_store(new CookieMonster(NULL, NULL)); |
305 // TODO(mmenke): This always creates a file thread, even when it ends up | 307 // TODO(mmenke): This always creates a file thread, even when it ends up |
306 // not being used. Consider lazily creating the thread. | 308 // not being used. Consider lazily creating the thread. |
307 storage->set_channel_id_service(make_scoped_ptr(new ChannelIDService( | 309 storage->set_channel_id_service(make_scoped_ptr(new ChannelIDService( |
308 new DefaultChannelIDStore(NULL), context->GetFileTaskRunner()))); | 310 new DefaultChannelIDStore(NULL), context->GetFileTaskRunner()))); |
309 } | 311 } |
310 | 312 |
| 313 if (sdch_enabled_) { |
| 314 storage->set_sdch_manager( |
| 315 scoped_ptr<net::SdchManager>(new SdchManager()).Pass()); |
| 316 } |
| 317 |
311 storage->set_transport_security_state(new TransportSecurityState()); | 318 storage->set_transport_security_state(new TransportSecurityState()); |
312 if (!transport_security_persister_path_.empty()) { | 319 if (!transport_security_persister_path_.empty()) { |
313 context->set_transport_security_persister( | 320 context->set_transport_security_persister( |
314 make_scoped_ptr<TransportSecurityPersister>( | 321 make_scoped_ptr<TransportSecurityPersister>( |
315 new TransportSecurityPersister(context->transport_security_state(), | 322 new TransportSecurityPersister(context->transport_security_state(), |
316 transport_security_persister_path_, | 323 transport_security_persister_path_, |
317 context->GetFileTaskRunner(), | 324 context->GetFileTaskRunner(), |
318 false))); | 325 false))); |
319 } | 326 } |
320 | 327 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 #endif // !defined(DISABLE_FTP_SUPPORT) | 409 #endif // !defined(DISABLE_FTP_SUPPORT) |
403 | 410 |
404 storage->set_job_factory(job_factory); | 411 storage->set_job_factory(job_factory); |
405 | 412 |
406 // TODO(willchan): Support sdch. | 413 // TODO(willchan): Support sdch. |
407 | 414 |
408 return context; | 415 return context; |
409 } | 416 } |
410 | 417 |
411 } // namespace net | 418 } // namespace net |
OLD | NEW |