Chromium Code Reviews| Index: android_webview/browser/aw_browser_context.cc |
| diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc |
| index d113d74e23d3dac2ebfdae2bfcf399f3ac6bad4a..ed219e7555f7220db7b91d726ed86080275c2a58 100644 |
| --- a/android_webview/browser/aw_browser_context.cc |
| +++ b/android_webview/browser/aw_browser_context.cc |
| @@ -21,6 +21,8 @@ |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h" |
| +#include "components/data_reduction_proxy/core/browser/data_saver_service.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| #include "components/user_prefs/user_prefs.h" |
| #include "components/visitedlink/browser/visitedlink_master.h" |
| @@ -156,24 +158,20 @@ void AwBrowserContext::PreMainMessageLoopRun() { |
| cache_path, cookie_store_.get(), |
| make_scoped_ptr(CreateProxyConfigService()).Pass()); |
| - data_reduction_proxy_settings_.reset( |
| - new data_reduction_proxy::DataReductionProxySettings( |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyParams>( |
| - new data_reduction_proxy::DataReductionProxyParams( |
| - data_reduction_proxy::DataReductionProxyParams::kAllowed)) |
| - .Pass())); |
| data_reduction_proxy_io_data_.reset( |
| new data_reduction_proxy::DataReductionProxyIOData( |
| data_reduction_proxy::Client::WEBVIEW_ANDROID, |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), |
| - data_reduction_proxy_settings_.get(), |
| + data_reduction_proxy::DataReductionProxyParams::kAllowed, |
| url_request_context_getter_->GetNetLog(), |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| - BrowserThread::GetMessageLoopProxyForThread( |
| - BrowserThread::UI))); |
| - data_reduction_proxy_io_data_->Init(); |
| - data_reduction_proxy_settings_->SetProxyConfigurator( |
| - data_reduction_proxy_io_data_->configurator()); |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); |
| + data_reduction_proxy_settings_.reset( |
| + new data_reduction_proxy::DataReductionProxySettings()); |
| + data_saver_service_.reset(new data_reduction_proxy::DataSaverService( |
| + scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), |
| + data_reduction_proxy_settings_.get(), GetAwURLRequestContext())); |
| + data_reduction_proxy_io_data_->SetDataSaverService( |
| + data_saver_service_->GetWeakPtr()); |
| visitedlink_master_.reset( |
| new visitedlink::VisitedLinkMaster(this, this, false)); |
| @@ -233,11 +231,6 @@ AwBrowserContext::GetDataReductionProxyIOData() { |
| return data_reduction_proxy_io_data_.get(); |
| } |
| -data_reduction_proxy::DataReductionProxyConfigurator* |
| -AwBrowserContext::GetDataReductionProxyConfigurator() { |
| - return data_reduction_proxy_io_data_->configurator(); |
| -} |
| - |
| AwURLRequestContextGetter* AwBrowserContext::GetAwURLRequestContext() { |
| return url_request_context_getter_.get(); |
| } |
| @@ -276,11 +269,8 @@ void AwBrowserContext::CreateUserPrefServiceIfNecessary() { |
| if (data_reduction_proxy_settings_) { |
| data_reduction_proxy_settings_->InitDataReductionProxySettings( |
| - user_pref_service_.get(), |
| - scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>(), |
| - GetRequestContext(), |
| - GetAwURLRequestContext()->GetNetLog(), |
| - data_reduction_proxy_io_data_->event_store()); |
| + user_pref_service_.get(), data_reduction_proxy_io_data_.get(), |
| + data_saver_service_.Pass()); |
| data_reduction_proxy_settings_->MaybeActivateDataReductionProxy(true); |
| SetDataReductionProxyEnabled(data_reduction_proxy_enabled_); |
| @@ -375,16 +365,16 @@ void AwBrowserContext::RebuildTable( |
| void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { |
| DCHECK(user_pref_service_.get()); |
| DCHECK(GetDataReductionProxySettings()); |
| - if (GetDataReductionProxySettings()->statistics_prefs()) |
| + DCHECK(GetDataReductionProxySettings()->SaverService()); |
|
bengr
2015/02/17 18:10:24
Cute, but I'd still call this "DataSaverService()
jeremyim
2015/02/19 21:03:43
Done.
|
| + if (GetDataReductionProxySettings()->SaverService()->statistics_prefs()) |
| return; |
| // We don't care about commit_delay for now. It is just a dummy value. |
| base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| - GetDataReductionProxySettings()->EnableCompressionStatisticsLogging( |
| - user_pref_service_.get(), |
| - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| - commit_delay); |
| - GetDataReductionProxyIOData()->SetDataReductionProxyStatisticsPrefs( |
| - GetDataReductionProxySettings()->statistics_prefs()); |
| + GetDataReductionProxySettings()->SaverService()-> |
| + EnableCompressionStatisticsLogging( |
| + user_pref_service_.get(), |
| + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| + commit_delay); |
| } |
| } // namespace android_webview |