summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfeng@chromium.org <feng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 04:01:34 +0000
committerfeng@chromium.org <feng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-18 04:01:34 +0000
commit5b92d4e11edd153eb9f4c4d79bd3c060cb022c37 (patch)
treef401b61c431d2299048fda4e97f2e07cf8a61a68
parent41faeb3e715d747537097d4357b658a56d4544fb (diff)
downloadchromium_src-5b92d4e11edd153eb9f4c4d79bd3c060cb022c37.zip
chromium_src-5b92d4e11edd153eb9f4c4d79bd3c060cb022c37.tar.gz
chromium_src-5b92d4e11edd153eb9f4c4d79bd3c060cb022c37.tar.bz2
[Android] Enable SB protection when --enable-spdy-proxy-auth is on.
The flag is used for testing purpose, and was left out. Flywheel protection is on when flag is on or setting is on. BUG=381896 Review URL: https://codereview.chromium.org/398853003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284002 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/profiles/profile_io_data.cc11
-rw-r--r--chrome/browser/profiles/profile_io_data.h12
-rw-r--r--chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc2
3 files changed, 24 insertions, 1 deletions
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index ead635a..6b6c086 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -97,6 +97,7 @@
#if defined(OS_ANDROID)
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_android.h"
+#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
#endif // defined(OS_ANDROID)
#if defined(OS_CHROMEOS)
@@ -839,6 +840,14 @@ bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const {
#endif // defined(OS_CHROMEOS)
}
+#if defined(OS_ANDROID)
+bool ProfileIOData::IsDataReductionProxyEnabled() const {
+ return data_reduction_proxy_enabled_.GetValue() ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ data_reduction_proxy::switches::kEnableDataReductionProxy);
+}
+#endif
+
base::WeakPtr<net::HttpServerProperties>
ProfileIOData::http_server_properties() const {
return http_server_properties_->GetWeakPtr();
@@ -1175,7 +1184,9 @@ void ProfileIOData::ShutdownOnUIThread() {
enable_metrics_.Destroy();
#endif
safe_browsing_enabled_.Destroy();
+#if defined(OS_ANDROID)
data_reduction_proxy_enabled_.Destroy();
+#endif
printing_enabled_.Destroy();
sync_disabled_.Destroy();
signin_allowed_.Destroy();
diff --git a/chrome/browser/profiles/profile_io_data.h b/chrome/browser/profiles/profile_io_data.h
index 690c609..ffd1d79 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -170,9 +170,13 @@ class ProfileIOData {
return &safe_browsing_enabled_;
}
+#if defined(OS_ANDROID)
+ // TODO(feng): move the function to protected area.
+ // IsDataReductionProxyEnabled() should be used as public API.
BooleanPrefMember* data_reduction_proxy_enabled() const {
return &data_reduction_proxy_enabled_;
}
+#endif
BooleanPrefMember* printing_enabled() const {
return &printing_enabled_;
@@ -242,6 +246,12 @@ class ProfileIOData {
// should only be called from there.
bool GetMetricsEnabledStateOnIOThread() const;
+#if defined(OS_ANDROID)
+ // Returns whether or not data reduction proxy is enabled in the browser
+ // instance on which this profile resides.
+ bool IsDataReductionProxyEnabled() const;
+#endif
+
void set_client_cert_store_factory_for_testing(
const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) {
client_cert_store_factory_ = factory;
@@ -534,7 +544,9 @@ class ProfileIOData {
mutable BooleanPrefMember enable_do_not_track_;
mutable BooleanPrefMember force_safesearch_;
mutable BooleanPrefMember safe_browsing_enabled_;
+#if defined(OS_ANDROID)
mutable BooleanPrefMember data_reduction_proxy_enabled_;
+#endif
mutable BooleanPrefMember printing_enabled_;
mutable BooleanPrefMember sync_disabled_;
mutable BooleanPrefMember signin_allowed_;
diff --git a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
index feccac2..6719df1 100644
--- a/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.cc
@@ -490,7 +490,7 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
// policies first.
if (io_data->safe_browsing_enabled()->GetValue()
#if defined(OS_ANDROID)
- || io_data->data_reduction_proxy_enabled()->GetValue()
+ || io_data->IsDataReductionProxyEnabled()
#endif
) {
bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME;