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 "android_webview/browser/net/aw_url_request_context_getter.h" | 5 #include "android_webview/browser/net/aw_url_request_context_getter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" |
9 #include "android_webview/browser/aw_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
10 #include "android_webview/browser/aw_request_interceptor.h" | 11 #include "android_webview/browser/aw_request_interceptor.h" |
11 #include "android_webview/browser/net/aw_network_delegate.h" | 12 #include "android_webview/browser/net/aw_network_delegate.h" |
12 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 13 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
13 #include "android_webview/browser/net/init_native_callback.h" | 14 #include "android_webview/browser/net/init_native_callback.h" |
14 #include "android_webview/common/aw_content_client.h" | 15 #include "android_webview/common/aw_content_client.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/strings/string_number_conversions.h" | 17 #include "base/strings/string_number_conversions.h" |
17 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
18 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" | 19 #include "components/data_reduction_proxy/browser/data_reduction_proxy_config_se
rvice.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 209 |
209 net::HttpCache* main_cache = new net::HttpCache( | 210 net::HttpCache* main_cache = new net::HttpCache( |
210 network_session_params, | 211 network_session_params, |
211 new net::HttpCache::DefaultBackend( | 212 new net::HttpCache::DefaultBackend( |
212 net::DISK_CACHE, | 213 net::DISK_CACHE, |
213 net::CACHE_BACKEND_SIMPLE, | 214 net::CACHE_BACKEND_SIMPLE, |
214 partition_path_.Append(FILE_PATH_LITERAL("Cache")), | 215 partition_path_.Append(FILE_PATH_LITERAL("Cache")), |
215 20 * 1024 * 1024, // 20M | 216 20 * 1024 * 1024, // 20M |
216 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); | 217 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); |
217 | 218 |
| 219 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
| 220 DCHECK(browser_context); |
| 221 DataReductionProxySettings* drp_settings = |
| 222 browser_context->GetDataReductionProxySettings(); |
| 223 DCHECK(drp_settings); |
| 224 std::string drp_key = drp_settings->key(); |
| 225 // Only precache credentials if a key is available at URLRequestContext |
| 226 // initialization. |
| 227 if (!drp_key.empty()) { |
218 DataReductionProxySettings::InitDataReductionProxySession( | 228 DataReductionProxySettings::InitDataReductionProxySession( |
219 main_cache->GetSession()); | 229 main_cache->GetSession(), drp_settings->key()); |
| 230 } |
220 | 231 |
221 main_http_factory_.reset(main_cache); | 232 main_http_factory_.reset(main_cache); |
222 url_request_context_->set_http_transaction_factory(main_cache); | 233 url_request_context_->set_http_transaction_factory(main_cache); |
223 url_request_context_->set_cookie_store(cookie_store_); | 234 url_request_context_->set_cookie_store(cookie_store_); |
224 | 235 |
225 job_factory_ = CreateJobFactory(&protocol_handlers_); | 236 job_factory_ = CreateJobFactory(&protocol_handlers_); |
226 url_request_context_->set_job_factory(job_factory_.get()); | 237 url_request_context_->set_job_factory(job_factory_.get()); |
227 | 238 |
228 // TODO(sgurun) remove once crbug.com/329681 is fixed. Should be | 239 // TODO(sgurun) remove once crbug.com/329681 is fixed. Should be |
229 // called only once. | 240 // called only once. |
(...skipping 18 matching lines...) Expand all Loading... |
248 std::swap(protocol_handlers_, *protocol_handlers); | 259 std::swap(protocol_handlers_, *protocol_handlers); |
249 } | 260 } |
250 | 261 |
251 DataReductionProxyConfigService* | 262 DataReductionProxyConfigService* |
252 AwURLRequestContextGetter::proxy_config_service() { | 263 AwURLRequestContextGetter::proxy_config_service() { |
253 // TODO(bengr): return system config if data reduction proxy is disabled. | 264 // TODO(bengr): return system config if data reduction proxy is disabled. |
254 return proxy_config_service_.get(); | 265 return proxy_config_service_.get(); |
255 } | 266 } |
256 | 267 |
257 } // namespace android_webview | 268 } // namespace android_webview |
OLD | NEW |