Chromium Code Reviews| Index: net/http/http_cache.cc |
| diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc |
| index 5c31568c53b4ef94fe265d9a27cffe1555779fbf..397d405b99c6d3361fa47ae614ba40198199acb1 100644 |
| --- a/net/http/http_cache.cc |
| +++ b/net/http/http_cache.cc |
| @@ -19,6 +19,7 @@ |
| #include "base/format_macros.h" |
| #include "base/location.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
|
wtc
2014/01/15 19:08:59
Remove this. This is already included by net/http/
ramant (doing other things)
2014/01/18 00:21:56
Done.
|
| #include "base/message_loop/message_loop.h" |
| #include "base/metrics/field_trial.h" |
| #include "base/pickle.h" |
| @@ -33,6 +34,7 @@ |
| #include "net/base/net_errors.h" |
| #include "net/base/upload_data_stream.h" |
| #include "net/disk_cache/disk_cache.h" |
| +#include "net/http/disk_cache_based_ssl_host_info.h" |
| #include "net/http/http_cache_transaction.h" |
| #include "net/http/http_network_layer.h" |
| #include "net/http/http_network_session.h" |
| @@ -40,6 +42,7 @@ |
| #include "net/http/http_response_headers.h" |
| #include "net/http/http_response_info.h" |
| #include "net/http/http_util.h" |
| +#include "net/socket/ssl_host_info.h" |
| namespace { |
| @@ -267,13 +270,35 @@ void HttpCache::MetadataWriter::OnIOComplete(int result) { |
| //----------------------------------------------------------------------------- |
| +class HttpCache::SSLHostInfoFactoryAdaptor : public SSLHostInfoFactory { |
| + public: |
| + SSLHostInfoFactoryAdaptor(CertVerifier* cert_verifier, HttpCache* http_cache) |
| + : cert_verifier_(cert_verifier), |
| + http_cache_(http_cache) { |
| + } |
| + |
| + virtual SSLHostInfo* GetForHost(const std::string& hostname, |
| + const SSLConfig& ssl_config) OVERRIDE { |
| + return new DiskCacheBasedSSLHostInfo( |
| + hostname, ssl_config, cert_verifier_, http_cache_); |
| + } |
| + |
| + private: |
| + CertVerifier* const cert_verifier_; |
| + HttpCache* const http_cache_; |
| +}; |
| + |
| +//----------------------------------------------------------------------------- |
| HttpCache::HttpCache(const net::HttpNetworkSession::Params& params, |
| BackendFactory* backend_factory) |
| : net_log_(params.net_log), |
| backend_factory_(backend_factory), |
| building_backend_(false), |
| - mode_(NORMAL), |
| - network_layer_(new HttpNetworkLayer(new HttpNetworkSession(params))) { |
| + mode_(NORMAL) { |
| + HttpNetworkSession* session = new HttpNetworkSession(params); |
| + ssl_host_info_factory_.reset(new SSLHostInfoFactoryAdaptor( |
| + session->cert_verifier(), this)); |
| + network_layer_.reset(new HttpNetworkLayer(session)); |
|
wtc
2014/01/15 19:08:59
Please change this back to using the initializer l
ramant (doing other things)
2014/01/18 00:21:56
Done.
|
| } |
| @@ -283,6 +308,8 @@ HttpCache::HttpCache(HttpNetworkSession* session, |
| backend_factory_(backend_factory), |
| building_backend_(false), |
| mode_(NORMAL), |
| + ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor( |
| + session->cert_verifier(), this)), |
| network_layer_(new HttpNetworkLayer(session)) { |
| } |