Commit 5b92d4e1 authored by feng@chromium.org's avatar feng@chromium.org

[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
parent 41faeb3e
...@@ -97,6 +97,7 @@ ...@@ -97,6 +97,7 @@
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h" #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_android.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings_factory_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) #endif // defined(OS_ANDROID)
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
...@@ -839,6 +840,14 @@ bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const { ...@@ -839,6 +840,14 @@ bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const {
#endif // defined(OS_CHROMEOS) #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> base::WeakPtr<net::HttpServerProperties>
ProfileIOData::http_server_properties() const { ProfileIOData::http_server_properties() const {
return http_server_properties_->GetWeakPtr(); return http_server_properties_->GetWeakPtr();
...@@ -1175,7 +1184,9 @@ void ProfileIOData::ShutdownOnUIThread() { ...@@ -1175,7 +1184,9 @@ void ProfileIOData::ShutdownOnUIThread() {
enable_metrics_.Destroy(); enable_metrics_.Destroy();
#endif #endif
safe_browsing_enabled_.Destroy(); safe_browsing_enabled_.Destroy();
#if defined(OS_ANDROID)
data_reduction_proxy_enabled_.Destroy(); data_reduction_proxy_enabled_.Destroy();
#endif
printing_enabled_.Destroy(); printing_enabled_.Destroy();
sync_disabled_.Destroy(); sync_disabled_.Destroy();
signin_allowed_.Destroy(); signin_allowed_.Destroy();
......
...@@ -170,9 +170,13 @@ class ProfileIOData { ...@@ -170,9 +170,13 @@ class ProfileIOData {
return &safe_browsing_enabled_; 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 { BooleanPrefMember* data_reduction_proxy_enabled() const {
return &data_reduction_proxy_enabled_; return &data_reduction_proxy_enabled_;
} }
#endif
BooleanPrefMember* printing_enabled() const { BooleanPrefMember* printing_enabled() const {
return &printing_enabled_; return &printing_enabled_;
...@@ -242,6 +246,12 @@ class ProfileIOData { ...@@ -242,6 +246,12 @@ class ProfileIOData {
// should only be called from there. // should only be called from there.
bool GetMetricsEnabledStateOnIOThread() const; 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( void set_client_cert_store_factory_for_testing(
const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) { const base::Callback<scoped_ptr<net::ClientCertStore>()>& factory) {
client_cert_store_factory_ = factory; client_cert_store_factory_ = factory;
...@@ -534,7 +544,9 @@ class ProfileIOData { ...@@ -534,7 +544,9 @@ class ProfileIOData {
mutable BooleanPrefMember enable_do_not_track_; mutable BooleanPrefMember enable_do_not_track_;
mutable BooleanPrefMember force_safesearch_; mutable BooleanPrefMember force_safesearch_;
mutable BooleanPrefMember safe_browsing_enabled_; mutable BooleanPrefMember safe_browsing_enabled_;
#if defined(OS_ANDROID)
mutable BooleanPrefMember data_reduction_proxy_enabled_; mutable BooleanPrefMember data_reduction_proxy_enabled_;
#endif
mutable BooleanPrefMember printing_enabled_; mutable BooleanPrefMember printing_enabled_;
mutable BooleanPrefMember sync_disabled_; mutable BooleanPrefMember sync_disabled_;
mutable BooleanPrefMember signin_allowed_; mutable BooleanPrefMember signin_allowed_;
......
...@@ -490,7 +490,7 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles( ...@@ -490,7 +490,7 @@ void ChromeResourceDispatcherHostDelegate::AppendStandardResourceThrottles(
// policies first. // policies first.
if (io_data->safe_browsing_enabled()->GetValue() if (io_data->safe_browsing_enabled()->GetValue()
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
|| io_data->data_reduction_proxy_enabled()->GetValue() || io_data->IsDataReductionProxyEnabled()
#endif #endif
) { ) {
bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME; bool is_subresource_request = resource_type != ResourceType::MAIN_FRAME;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment