|
20 | 20 | #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_params.h"
|
21 | 21 | #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
|
22 | 22 | #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h"
|
| 23 | +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h" |
23 | 24 | #include "components/user_prefs/user_prefs.h"
|
24 | 25 | #include "components/visitedlink/browser/visitedlink_master.h"
|
25 | 26 | #include "content/public/browser/browser_thread.h"
|
@@ -94,6 +95,10 @@ void AwBrowserContext::SetDataReductionProxyEnabled(bool enabled) {
|
94 | 95 | context->GetDataReductionProxySettings();
|
95 | 96 | if (proxy_settings == NULL)
|
96 | 97 | return;
|
| 98 | + |
| 99 | + context->CreateDataReductionProxyStatisticsIfNecessary(); |
| 100 | + proxy_settings->SetDataReductionProxyStatisticsPrefs( |
| 101 | + context->data_reduction_proxy_statistics_.get()); |
97 | 102 | proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
|
98 | 103 | }
|
99 | 104 |
|
@@ -293,4 +298,19 @@ void AwBrowserContext::RebuildTable(
|
293 | 298 | enumerator->OnComplete(true);
|
294 | 299 | }
|
295 | 300 |
|
| 301 | +void AwBrowserContext::CreateDataReductionProxyStatisticsIfNecessary() { |
| 302 | + DCHECK(user_pref_service_.get()); |
| 303 | + |
| 304 | + if (!data_reduction_proxy_statistics_.get()) { |
| 305 | + // We don't care about commit_delay for now. It is just a dummy value. |
| 306 | + base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
| 307 | + data_reduction_proxy_statistics_ = |
| 308 | + scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>( |
| 309 | + new data_reduction_proxy::DataReductionProxyStatisticsPrefs( |
| 310 | + user_pref_service_.get(), |
| 311 | + base::MessageLoopProxy::current(), |
| 312 | + commit_delay)); |
| 313 | + } |
| 314 | +} |
| 315 | + |
296 | 316 | } // namespace android_webview
|
0 commit comments