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 "ios/web/shell/shell_url_request_context_getter.h" | 5 #include "ios/web/shell/shell_url_request_context_getter.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 url_request_context_->http_server_properties(); | 128 url_request_context_->http_server_properties(); |
129 network_session_params.host_resolver = | 129 network_session_params.host_resolver = |
130 url_request_context_->host_resolver(); | 130 url_request_context_->host_resolver(); |
131 | 131 |
132 base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); | 132 base::FilePath cache_path = base_path_.Append(FILE_PATH_LITERAL("Cache")); |
133 net::HttpCache::DefaultBackend* main_backend = | 133 net::HttpCache::DefaultBackend* main_backend = |
134 new net::HttpCache::DefaultBackend(net::DISK_CACHE, | 134 new net::HttpCache::DefaultBackend(net::DISK_CACHE, |
135 net::CACHE_BACKEND_DEFAULT, | 135 net::CACHE_BACKEND_DEFAULT, |
136 cache_path, 0, cache_task_runner_); | 136 cache_path, 0, cache_task_runner_); |
137 | 137 |
| 138 storage_->set_http_network_session( |
| 139 make_scoped_ptr(new net::HttpNetworkSession(network_session_params))); |
138 storage_->set_http_transaction_factory(make_scoped_ptr( | 140 storage_->set_http_transaction_factory(make_scoped_ptr( |
139 new net::HttpCache(network_session_params, main_backend))); | 141 new net::HttpCache(storage_->http_network_session(), main_backend, |
| 142 true /* set_up_quic_server_info */))); |
140 | 143 |
141 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( | 144 scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( |
142 new net::URLRequestJobFactoryImpl()); | 145 new net::URLRequestJobFactoryImpl()); |
143 bool set_protocol = job_factory->SetProtocolHandler( | 146 bool set_protocol = job_factory->SetProtocolHandler( |
144 "data", make_scoped_ptr(new net::DataProtocolHandler)); | 147 "data", make_scoped_ptr(new net::DataProtocolHandler)); |
145 DCHECK(set_protocol); | 148 DCHECK(set_protocol); |
146 | 149 |
147 storage_->set_job_factory(job_factory.Pass()); | 150 storage_->set_job_factory(job_factory.Pass()); |
148 } | 151 } |
149 | 152 |
150 return url_request_context_.get(); | 153 return url_request_context_.get(); |
151 } | 154 } |
152 | 155 |
153 scoped_refptr<base::SingleThreadTaskRunner> | 156 scoped_refptr<base::SingleThreadTaskRunner> |
154 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { | 157 ShellURLRequestContextGetter::GetNetworkTaskRunner() const { |
155 return network_task_runner_; | 158 return network_task_runner_; |
156 } | 159 } |
157 | 160 |
158 } // namespace web | 161 } // namespace web |
OLD | NEW |