| 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 e4a2a1d08a700ae9d93eb84d36710a02014a3059..248ade1d2d3dd8506354167950bd43057e21adc2 100644
|
| --- a/android_webview/browser/aw_browser_context.cc
|
| +++ b/android_webview/browser/aw_browser_context.cc
|
| @@ -41,6 +41,9 @@ AwBrowserContext* g_browser_context = NULL;
|
|
|
| } // namespace
|
|
|
| +// Data reduction proxy is disabled by default.
|
| +bool AwBrowserContext::data_reduction_proxy_enabled_ = false;
|
| +
|
| AwBrowserContext::AwBrowserContext(
|
| const FilePath path,
|
| JniDependencyFactory* native_factory)
|
| @@ -73,6 +76,22 @@ AwBrowserContext* AwBrowserContext::FromWebContents(
|
| return static_cast<AwBrowserContext*>(web_contents->GetBrowserContext());
|
| }
|
|
|
| +// static
|
| +void AwBrowserContext::SetDataReductionProxyEnabled(bool enabled) {
|
| + // Cache the setting value. It is possible that data reduction proxy is
|
| + // not created yet.
|
| + data_reduction_proxy_enabled_ = enabled;
|
| + AwBrowserContext* context = AwBrowserContext::GetDefault();
|
| + // Can't enable Data reduction proxy if user pref service is not ready.
|
| + if (context == NULL || context->user_pref_service_.get() == NULL)
|
| + return;
|
| + DataReductionProxySettings* proxy_settings =
|
| + context->GetDataReductionProxySettings();
|
| + if (proxy_settings == NULL)
|
| + return;
|
| + proxy_settings->SetDataReductionProxyEnabled(data_reduction_proxy_enabled_);
|
| +}
|
| +
|
| void AwBrowserContext::PreMainMessageLoopRun() {
|
| cookie_store_ = CreateCookieStore(this);
|
| DataReductionProxySettings::SetAllowed(true);
|
| @@ -169,9 +188,8 @@ void AwBrowserContext::CreateUserPrefServiceIfNecessary() {
|
| user_pref_service_.get(),
|
| GetRequestContext());
|
|
|
| - //TODO(sgurun): Attach this to the API. It is currently hard coded in a
|
| - // disabled state.
|
| - data_reduction_proxy_settings_->SetDataReductionProxyEnabled(false);
|
| + data_reduction_proxy_settings_->SetDataReductionProxyEnabled(
|
| + data_reduction_proxy_enabled_);
|
| }
|
|
|
| base::FilePath AwBrowserContext::GetPath() const {
|
|
|