Index: android_webview/browser/net/aw_url_request_context_getter.cc |
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc |
index ce39602ab0c1c3c309326865b6da38a1687e0178..48b616096e9555bf8c5fa4a36f82b425d51f9d52 100644 |
--- a/android_webview/browser/net/aw_url_request_context_getter.cc |
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc |
@@ -20,6 +20,7 @@ |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_auth_request_handler.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_interceptor.h" |
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h" |
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/content_browser_client.h" |
@@ -195,8 +196,37 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() { |
net::URLRequestContextBuilder builder; |
builder.set_user_agent(GetUserAgent()); |
- AwNetworkDelegate* aw_network_delegate = new AwNetworkDelegate(); |
- builder.set_network_delegate(aw_network_delegate); |
+ scoped_ptr<AwNetworkDelegate> aw_network_delegate(new AwNetworkDelegate()); |
+ |
+ AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
+ DCHECK(browser_context); |
+ |
+ // Compression statistics are not gathered for WebView, so |
+ // DataReductionProxyStatisticsPrefs is not instantiated and passed to the |
+ // network delegate. |
+ DataReductionProxySettings* data_reduction_proxy_settings = |
+ browser_context->GetDataReductionProxySettings(); |
+ DCHECK(data_reduction_proxy_settings); |
+ data_reduction_proxy_auth_request_handler_.reset( |
+ new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
+ data_reduction_proxy::Client::WEBVIEW_ANDROID, |
+ data_reduction_proxy_settings->params(), |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
+ |
+ data_reduction_proxy::DataReductionProxyNetworkDelegate* |
+ data_reduction_proxy_network_delegate = |
+ new data_reduction_proxy::DataReductionProxyNetworkDelegate( |
+ aw_network_delegate.Pass()); |
+ data_reduction_proxy_network_delegate->Init( |
+ NULL, NULL, NULL, |
bengr
2014/12/02 17:20:00
I don't understand this Init call. If you need to
megjablon
2014/12/02 22:33:21
Moved all to constructor.
|
+ data_reduction_proxy_settings->params(), NULL, |
+ data_reduction_proxy_auth_request_handler_.get(), NULL, |
bengr
2014/12/02 17:20:00
Who needs this besides the data_reduction_proxy_ne
megjablon
2014/12/02 22:33:21
It is used by SetKeyOnIO
|
+ data_reduction_proxy::DataReductionProxyNetworkDelegate:: |
+ OnResolveProxyHandler(), |
+ data_reduction_proxy::DataReductionProxyNetworkDelegate:: |
+ ProxyConfigGetter()); |
+ |
+ builder.set_network_delegate(data_reduction_proxy_network_delegate); |
#if !defined(DISABLE_FTP_SUPPORT) |
builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. |
#endif |
@@ -230,25 +260,6 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() { |
20 * 1024 * 1024, // 20M |
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); |
- AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); |
- DCHECK(browser_context); |
- DataReductionProxySettings* data_reduction_proxy_settings = |
- browser_context->GetDataReductionProxySettings(); |
- DCHECK(data_reduction_proxy_settings); |
- data_reduction_proxy_auth_request_handler_.reset( |
- new data_reduction_proxy::DataReductionProxyAuthRequestHandler( |
- data_reduction_proxy::Client::WEBVIEW_ANDROID, |
- data_reduction_proxy_settings->params(), |
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); |
- |
- // Compression statistics are not gathered for WebView, so |
- // DataReductionProxyStatisticsPrefs is not instantiated and passed to the |
- // network delegate. |
- aw_network_delegate->set_data_reduction_proxy_params( |
- data_reduction_proxy_settings->params()); |
- aw_network_delegate->set_data_reduction_proxy_auth_request_handler( |
- data_reduction_proxy_auth_request_handler_.get()); |
- |
main_http_factory_.reset(main_cache); |
url_request_context_->set_http_transaction_factory(main_cache); |
url_request_context_->set_cookie_store(cookie_store_.get()); |