summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/browser/aw_browser_context.cc2
-rw-r--r--android_webview/browser/net/aw_url_request_context_getter.cc2
-rw-r--r--chrome/browser/android/intercept_download_resource_throttle.cc4
-rw-r--r--chrome/browser/chrome_browser_field_trials_mobile.cc17
-rw-r--r--chrome/browser/io_thread.cc88
-rw-r--r--chrome/browser/io_thread.h19
-rw-r--r--chrome/browser/net/chrome_network_delegate.cc15
-rw-r--r--chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc9
-rw-r--r--chrome/browser/profiles/off_the_record_profile_io_data.cc4
-rw-r--r--chrome/browser/profiles/profile.cc4
-rw-r--r--chrome/browser/profiles/profile_impl.cc16
-rw-r--r--chrome/browser/profiles/profile_impl_io_data.cc24
-rw-r--r--chrome/browser/profiles/profile_io_data.cc16
-rw-r--r--chrome/browser/profiles/profile_io_data.h15
-rw-r--r--components/data_reduction_proxy/browser/BUILD.gn2
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc22
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h4
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_metrics_unittest.cc12
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_params.cc69
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_params.h4
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc2
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc1
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc2
-rw-r--r--components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h7
-rw-r--r--components/precache/content/precache_manager.cc4
-rw-r--r--net/http/http_log_util.cc23
-rw-r--r--net/http/http_log_util_unittest.cc16
-rw-r--r--net/http/http_network_transaction.cc6
-rw-r--r--net/http/http_proxy_client_socket_pool.cc9
-rw-r--r--net/proxy/proxy_server.cc3
-rw-r--r--net/socket/ssl_client_socket_pool.cc12
-rw-r--r--net/spdy/spdy_session.cc5
-rw-r--r--tools/metrics/histograms/histograms.xml6
33 files changed, 151 insertions, 293 deletions
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index ab84266..098ce73ea 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -99,12 +99,10 @@ void AwBrowserContext::SetDataReductionProxyEnabled(bool enabled) {
void AwBrowserContext::PreMainMessageLoopRun() {
cookie_store_ = CreateCookieStore(this);
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
data_reduction_proxy_settings_.reset(
new DataReductionProxySettings(
new data_reduction_proxy::DataReductionProxyParams(
data_reduction_proxy::DataReductionProxyParams::kAllowed)));
-#endif
scoped_ptr<DataReductionProxyConfigService>
data_reduction_proxy_config_service(
new DataReductionProxyConfigService(
diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc
index 7e8b767..1adda3d 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -226,7 +226,6 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
20 * 1024 * 1024, // 20M
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)));
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
AwBrowserContext* browser_context = AwBrowserContext::GetDefault();
DCHECK(browser_context);
DataReductionProxySettings* data_reduction_proxy_settings =
@@ -245,7 +244,6 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
data_reduction_proxy_settings->params());
aw_network_delegate->set_data_reduction_proxy_auth_request_handler(
data_reduction_proxy_auth_request_handler_.get());
-#endif
main_http_factory_.reset(main_cache);
url_request_context_->set_http_transaction_factory(main_cache);
diff --git a/chrome/browser/android/intercept_download_resource_throttle.cc b/chrome/browser/android/intercept_download_resource_throttle.cc
index 87dbdab..c64dc7b 100644
--- a/chrome/browser/android/intercept_download_resource_throttle.cc
+++ b/chrome/browser/android/intercept_download_resource_throttle.cc
@@ -55,16 +55,12 @@ void InterceptDownloadResourceThrottle::ProcessDownloadRequest() {
// exception is a request that is fetched via the Chrome Proxy and does not
// authenticate with the origin.
if (request_->response_info().did_use_http_auth) {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
if (headers.HasHeader(net::HttpRequestHeaders::kAuthorization) ||
!(request_->response_info().headers &&
data_reduction_proxy::HasDataReductionProxyViaHeader(
request_->response_info().headers, NULL))) {
return;
}
-#else
- return;
-#endif
}
content::DownloadControllerAndroid::Get()->CreateGETDownload(
diff --git a/chrome/browser/chrome_browser_field_trials_mobile.cc b/chrome/browser/chrome_browser_field_trials_mobile.cc
index 3bc52cb..86be716 100644
--- a/chrome/browser/chrome_browser_field_trials_mobile.cc
+++ b/chrome/browser/chrome_browser_field_trials_mobile.cc
@@ -44,23 +44,14 @@ void DataCompressionProxyBaseFieldTrial(
kDisabled, 2015, 1, 1, base::FieldTrial::ONE_TIME_RANDOMIZED, NULL));
// Non-stable channels will run with probability 1.
- const int kEnabledGroup = trial->AppendGroup(
+ trial->AppendGroup(
kEnabled,
kIsStableChannel ? enabled_group_probability : total_probability);
- const int v = trial->group();
- VLOG(1) << trial_name << " enabled group id: " << kEnabledGroup
- << ". Selected group id: " << v;
+ trial->group();
}
-void DataCompressionProxyFieldTrials() {
- // Governs the rollout of the compression proxy for Chrome on mobile
- // platforms. In all channels, the percentage will be controlled from the
- // server, and is configured to be 100% = 1000 / 1000 until overridden by the
- // server.
- DataCompressionProxyBaseFieldTrial(
- "DataCompressionProxyRollout", 1000, 1000);
-
+void SetupDataCompressionProxyFieldTrials() {
// Governs the rollout of the _promo_ for the compression proxy
// independently from the rollout of compression proxy. The enabled
// percentage is configured to be 10% = 100 / 1000 until overridden by the
@@ -73,7 +64,7 @@ void DataCompressionProxyFieldTrials() {
} // namespace
void SetupMobileFieldTrials(const CommandLine& parsed_command_line) {
- DataCompressionProxyFieldTrials();
+ SetupDataCompressionProxyFieldTrials();
#if defined(OS_ANDROID)
prerender::ConfigurePrerender(parsed_command_line);
#endif
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index e403d0f..5ce6ca7 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -35,11 +35,17 @@
#include "chrome/browser/net/pref_proxy_config_tracker.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_delegate.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_prefs.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
#include "components/policy/core/common/policy_service.h"
#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
@@ -94,14 +100,6 @@
#include "net/ocsp/nss_ocsp.h"
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_delegate.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
-
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
#include "chromeos/network/host_resolver_impl_chromeos.h"
@@ -630,40 +628,7 @@ void IOThread::InitAsync() {
globals_->ssl_config_service = GetSSLConfigService();
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- int drp_flags = 0;
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInFieldTrial()) {
- drp_flags |=
- (data_reduction_proxy::DataReductionProxyParams::kAllowed |
- data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed |
- data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed);
- }
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInPromoFieldTrial())
- drp_flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
- if (data_reduction_proxy::DataReductionProxyParams::
- IsIncludedInHoldbackFieldTrial())
- drp_flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
- globals_->data_reduction_proxy_params.reset(
- new data_reduction_proxy::DataReductionProxyParams(drp_flags));
- globals_->data_reduction_proxy_auth_request_handler.reset(
- new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
- DataReductionProxyChromeSettings::GetClient(),
- globals_->data_reduction_proxy_params.get(),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
- globals_->data_reduction_proxy_delegate.reset(
- new data_reduction_proxy::DataReductionProxyDelegate(
- globals_->data_reduction_proxy_auth_request_handler.get()));
- // This is the same as in ProfileImplIOData except that we do not collect
- // usage stats.
- network_delegate->set_data_reduction_proxy_params(
- globals_->data_reduction_proxy_params.get());
- network_delegate->set_data_reduction_proxy_auth_request_handler(
- globals_->data_reduction_proxy_auth_request_handler.get());
- network_delegate->set_on_resolve_proxy_handler(
- base::Bind(data_reduction_proxy::OnResolveProxyHandler));
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
+ SetupDataReductionProxy(network_delegate);
globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
globals_->host_resolver.get()));
@@ -1068,9 +1033,7 @@ void IOThread::InitializeNetworkSessionParamsFromGlobals(
&params->origin_to_force_quic_on);
params->enable_user_alternate_protocol_ports =
globals.enable_user_alternate_protocol_ports;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
params->proxy_delegate = globals.data_reduction_proxy_delegate.get();
-#endif
}
base::TimeTicks IOThread::creation_time() const {
@@ -1123,6 +1086,7 @@ void IOThread::InitSystemRequestContextOnIOThread() {
system_proxy_config_service_.release(),
command_line,
quick_check_enabled_.GetValue()));
+ DCHECK(globals_->data_reduction_proxy_params);
net::HttpNetworkSession::Params system_params;
InitializeNetworkSessionParams(&system_params);
@@ -1160,6 +1124,42 @@ void IOThread::ConfigureQuic(const CommandLine& command_line) {
ConfigureQuicGlobals(command_line, group, params, globals_);
}
+void IOThread::SetupDataReductionProxy(
+ ChromeNetworkDelegate* network_delegate) {
+ // TODO(kundaji): Move flags initialization to DataReductionProxyParams and
+ // merge with flag initialization in
+ // data_reduction_proxy_chrome_settings_factory.cc.
+ int flags = data_reduction_proxy::DataReductionProxyParams::kAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kFallbackAllowed |
+ data_reduction_proxy::DataReductionProxyParams::kAlternativeAllowed;
+ if (data_reduction_proxy::DataReductionProxyParams::
+ IsIncludedInPromoFieldTrial()) {
+ flags |= data_reduction_proxy::DataReductionProxyParams::kPromoAllowed;
+ }
+ if (data_reduction_proxy::DataReductionProxyParams::
+ IsIncludedInHoldbackFieldTrial()) {
+ flags |= data_reduction_proxy::DataReductionProxyParams::kHoldback;
+ }
+ globals_->data_reduction_proxy_params.reset(
+ new data_reduction_proxy::DataReductionProxyParams(flags));
+ globals_->data_reduction_proxy_auth_request_handler.reset(
+ new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
+ DataReductionProxyChromeSettings::GetClient(),
+ globals_->data_reduction_proxy_params.get(),
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)));
+ globals_->data_reduction_proxy_delegate.reset(
+ new data_reduction_proxy::DataReductionProxyDelegate(
+ globals_->data_reduction_proxy_auth_request_handler.get()));
+ // This is the same as in ProfileImplIOData except that we do not collect
+ // usage stats.
+ network_delegate->set_data_reduction_proxy_params(
+ globals_->data_reduction_proxy_params.get());
+ network_delegate->set_data_reduction_proxy_auth_request_handler(
+ globals_->data_reduction_proxy_auth_request_handler.get());
+ network_delegate->set_on_resolve_proxy_handler(
+ base::Bind(data_reduction_proxy::OnResolveProxyHandler));
+}
+
// static
void IOThread::ConfigureQuicGlobals(
const base::CommandLine& command_line,
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 66e5772..801d48d 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -37,13 +37,11 @@ namespace chrome_browser_net {
class DnsProbeService;
}
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
namespace data_reduction_proxy {
class DataReductionProxyAuthRequestHandler;
class DataReductionProxyDelegate;
class DataReductionProxyParams;
}
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
namespace extensions {
class EventRouterForwarder;
@@ -201,14 +199,12 @@ class IOThread : public content::BrowserThreadDelegate {
// main frame load fails with a DNS error in order to provide more useful
// information to the renderer so it can show a more specific error page.
scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
- data_reduction_proxy_params;
- scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
- data_reduction_proxy_auth_request_handler;
- scoped_ptr<data_reduction_proxy::DataReductionProxyDelegate>
- data_reduction_proxy_delegate;
-#endif
+ scoped_ptr<data_reduction_proxy::DataReductionProxyParams>
+ data_reduction_proxy_params;
+ scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
+ data_reduction_proxy_auth_request_handler;
+ scoped_ptr<data_reduction_proxy::DataReductionProxyDelegate>
+ data_reduction_proxy_delegate;
};
// |net_log| must either outlive the IOThread or be NULL.
@@ -319,6 +315,9 @@ class IOThread : public content::BrowserThreadDelegate {
// well as the QUIC field trial group.
void ConfigureQuic(const base::CommandLine& command_line);
+ // Set up data reduction proxy related objects on IO thread globals.
+ void SetupDataReductionProxy(ChromeNetworkDelegate* network_delegate);
+
extensions::EventRouterForwarder* extension_event_router_forwarder() {
#if defined(ENABLE_EXTENSIONS)
return extension_event_router_forwarder_;
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 42b7463..765d1d0 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -132,22 +132,11 @@ void UpdateContentLengthPrefs(
profile->IsOffTheRecord()) {
return;
}
-#if defined(OS_ANDROID) && defined(SPDY_PROXY_AUTH_ORIGIN)
- // If Android ever goes multi profile, the profile should be passed so that
- // the browser preference will be taken.
- bool with_data_reduction_proxy_enabled =
- ProfileManager::GetActiveUserProfile()->GetPrefs()->GetBoolean(
- data_reduction_proxy::prefs::kDataReductionProxyEnabled);
-#else
- bool with_data_reduction_proxy_enabled = false;
-#endif
-
data_reduction_proxy::UpdateContentLengthPrefs(
received_content_length,
original_content_length,
- with_data_reduction_proxy_enabled,
- request_type,
- statistics_prefs);
+ profile->GetPrefs(),
+ request_type, statistics_prefs);
}
void StoreAccumulatedContentLength(
diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc
index 93e126a..c2d14e5 100644
--- a/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc
+++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.cc
@@ -52,12 +52,9 @@ DataReductionProxyChromeSettingsFactory::
KeyedService* DataReductionProxyChromeSettingsFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
- int flags = 0;
- if (DataReductionProxyParams::IsIncludedInFieldTrial()) {
- flags |= (DataReductionProxyParams::kAllowed |
- DataReductionProxyParams::kFallbackAllowed |
- DataReductionProxyParams::kAlternativeAllowed);
- }
+ int flags = DataReductionProxyParams::kAllowed |
+ DataReductionProxyParams::kFallbackAllowed |
+ DataReductionProxyParams::kAlternativeAllowed;
if (DataReductionProxyParams::IsIncludedInPromoFieldTrial())
flags |= DataReductionProxyParams::kPromoAllowed;
if (DataReductionProxyParams::IsIncludedInHoldbackFieldTrial())
diff --git a/chrome/browser/profiles/off_the_record_profile_io_data.cc b/chrome/browser/profiles/off_the_record_profile_io_data.cc
index d79660d..837dfe6 100644
--- a/chrome/browser/profiles/off_the_record_profile_io_data.cc
+++ b/chrome/browser/profiles/off_the_record_profile_io_data.cc
@@ -163,13 +163,13 @@ void OffTheRecordProfileIOData::Handle::LazyInitialize() const {
io_data_->safe_browsing_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
+ // TODO(kundaji): Remove data_reduction_proxy_enabled pref for incognito.
+ // Bug http://crbug/412873.
io_data_->data_reduction_proxy_enabled()->Init(
data_reduction_proxy::prefs::kDataReductionProxyEnabled,
profile_->GetPrefs());
io_data_->data_reduction_proxy_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
-#endif
io_data_->InitializeOnUIThread(profile_);
}
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index 17f3723..86326aa 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -185,9 +185,9 @@ void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
false,
user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
+
data_reduction_proxy::RegisterSyncableProfilePrefs(registry);
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
+
#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) && !defined(OS_IOS)
// Preferences related to the avatar bubble and user manager tutorials.
registry->RegisterIntegerPref(
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index adf8ee4d..967919e 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -47,6 +47,7 @@
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/plugins/plugin_prefs.h"
@@ -81,6 +82,9 @@
#include "chrome/common/url_constants.h"
#include "chrome/grit/chromium_strings.h"
#include "components/bookmarks/browser/bookmark_model.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/dom_distiller/content/dom_distiller_viewer_source.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/domain_reliability/monitor.h"
@@ -115,13 +119,6 @@
#include "components/user_manager/user_manager.h"
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_factory.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
-#endif
-
#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/policy/schema_registry_service.h"
#include "chrome/browser/policy/schema_registry_service_factory.h"
@@ -653,7 +650,6 @@ void ProfileImpl::DoFinalInit() {
scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator;
scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>
data_reduction_proxy_statistics_prefs;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings =
DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this);
data_reduction_proxy_params =
@@ -692,7 +688,6 @@ void ProfileImpl::DoFinalInit() {
commit_delay));
data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs(
data_reduction_proxy_statistics_prefs.get());
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
// Make sure we initialize the ProfileIOData after everything else has been
// initialized that we might be reading from the IO thread.
@@ -706,14 +701,11 @@ void ProfileImpl::DoFinalInit() {
chrome_configurator.Pass(),
data_reduction_proxy_params.Pass(),
data_reduction_proxy_statistics_prefs.Pass());
-
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
data_reduction_proxy_chrome_settings->InitDataReductionProxySettings(
data_reduction_proxy_chrome_configurator,
prefs_.get(),
g_browser_process->local_state(),
GetRequestContext());
-#endif
#if defined(ENABLE_PLUGINS)
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
diff --git a/chrome/browser/profiles/profile_impl_io_data.cc b/chrome/browser/profiles/profile_impl_io_data.cc
index 74f76ad..dd61413 100644
--- a/chrome/browser/profiles/profile_impl_io_data.cc
+++ b/chrome/browser/profiles/profile_impl_io_data.cc
@@ -28,12 +28,17 @@
#include "chrome/browser/net/predictor.h"
#include "chrome/browser/net/quota_policy_channel_id_store.h"
#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h"
+#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
#include "components/domain_reliability/monitor.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/cookie_store_factory.h"
@@ -52,14 +57,6 @@
#include "net/url_request/url_request_job_factory_impl.h"
#include "storage/browser/quota/special_storage_policy.h"
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_protocol.h"
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h"
-#include "components/data_reduction_proxy/common/data_reduction_proxy_pref_names.h"
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
-
namespace {
net::BackendType ChooseCacheBackendType() {
@@ -88,9 +85,7 @@ net::BackendType ChooseCacheBackendType() {
} // namespace
using content::BrowserThread;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
using data_reduction_proxy::DataReductionProxyParams;
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
ProfileImplIOData::Handle::Handle(Profile* profile)
: io_data_(new ProfileImplIOData),
@@ -102,9 +97,7 @@ ProfileImplIOData::Handle::Handle(Profile* profile)
ProfileImplIOData::Handle::~Handle() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
io_data_->data_reduction_proxy_statistics_prefs()->WritePrefs();
-#endif
if (io_data_->predictor_ != NULL) {
// io_data_->predictor_ might be NULL if Init() was never called
@@ -181,7 +174,6 @@ void ProfileImplIOData::Handle::Init(
if (io_data_->domain_reliability_monitor_)
io_data_->domain_reliability_monitor_->MoveToNetworkThread();
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
io_data_->set_data_reduction_proxy_unavailable_callback(
data_reduction_proxy_unavailable);
io_data_->set_data_reduction_proxy_chrome_configurator(
@@ -189,7 +181,6 @@ void ProfileImplIOData::Handle::Init(
io_data_->set_data_reduction_proxy_params(data_reduction_proxy_params.Pass());
io_data_->set_data_reduction_proxy_statistics_prefs(
data_reduction_proxy_statistics_prefs.Pass());
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
}
content::ResourceContext*
@@ -368,12 +359,10 @@ void ProfileImplIOData::Handle::LazyInitialize() const {
io_data_->safe_browsing_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
#endif
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
io_data_->data_reduction_proxy_enabled()->Init(
data_reduction_proxy::prefs::kDataReductionProxyEnabled, pref_service);
io_data_->data_reduction_proxy_enabled()->MoveToThread(
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
io_data_->InitializeOnUIThread(profile_);
}
@@ -437,7 +426,6 @@ void ProfileImplIOData::InitializeInternal(
IOThread* const io_thread = profile_params->io_thread;
IOThread::Globals* const io_thread_globals = io_thread->globals();
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
set_data_reduction_proxy_auth_request_handler(
scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
(new data_reduction_proxy::DataReductionProxyAuthRequestHandler(
@@ -467,8 +455,6 @@ void ProfileImplIOData::InitializeInternal(
base::Bind(
&DataReductionProxyChromeConfigurator::GetProxyConfigOnIO,
base::Unretained(data_reduction_proxy_chrome_configurator())));
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
-
network_delegate()->set_predictor(predictor_.get());
// Initialize context members.
diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc
index ff0fc7e..552658c 100644
--- a/chrome/browser/profiles/profile_io_data.cc
+++ b/chrome/browser/profiles/profile_io_data.cc
@@ -42,6 +42,7 @@
#include "chrome/browser/net/cookie_store_util.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/net/resource_prefetch_predictor_observer.h"
+#include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.h"
#include "chrome/browser/predictors/resource_prefetch_predictor.h"
#include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
#include "chrome/browser/profiles/profile.h"
@@ -52,6 +53,10 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/content_settings/core/browser/content_settings_provider.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_config_service.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_configurator.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
+#include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h"
#include "components/dom_distiller/core/url_constants.h"
#include "components/startup_metric_utils/startup_metric_utils.h"
#include "components/sync_driver/pref_names.h"
@@ -858,17 +863,11 @@ bool ProfileIOData::GetMetricsEnabledStateOnIOThread() const {
#endif // defined(OS_CHROMEOS)
}
-#if defined(OS_ANDROID)
bool ProfileIOData::IsDataReductionProxyEnabled() const {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
return data_reduction_proxy_enabled_.GetValue() ||
CommandLine::ForCurrentProcess()->HasSwitch(
data_reduction_proxy::switches::kEnableDataReductionProxy);
-#else
- return false;
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
}
-#endif
base::WeakPtr<net::HttpServerProperties>
ProfileIOData::http_server_properties() const {
@@ -1024,10 +1023,8 @@ void ProfileIOData::Init(
network_delegate->set_cookie_settings(profile_params_->cookie_settings.get());
network_delegate->set_enable_do_not_track(&enable_do_not_track_);
network_delegate->set_force_google_safe_search(&force_safesearch_);
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
network_delegate->set_data_reduction_proxy_enabled_pref(
&data_reduction_proxy_enabled_);
-#endif
network_delegate->set_prerender_tracker(profile_params_->prerender_tracker);
network_delegate_.reset(network_delegate);
@@ -1045,7 +1042,6 @@ void ProfileIOData::Init(
profile_params_->proxy_config_service.release(),
command_line,
quick_check_enabled_.GetValue()));
-
transport_security_state_.reset(new net::TransportSecurityState());
transport_security_persister_.reset(
new net::TransportSecurityPersister(
@@ -1206,9 +1202,7 @@ void ProfileIOData::ShutdownOnUIThread(
enable_metrics_.Destroy();
#endif
safe_browsing_enabled_.Destroy();
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
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 81f588c..6bf1a30 100644
--- a/chrome/browser/profiles/profile_io_data.h
+++ b/chrome/browser/profiles/profile_io_data.h
@@ -23,6 +23,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/storage_partition_descriptor.h"
#include "components/content_settings/core/common/content_settings_types.h"
+#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h"
#include "content/public/browser/content_browser_client.h"
@@ -33,10 +34,6 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_job_factory.h"
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include "components/data_reduction_proxy/browser/data_reduction_proxy_auth_request_handler.h"
-#endif // SPDY_PROXY_AUTH_ORIGIN
-
class ChromeHttpUserAgentSettings;
class ChromeNetworkDelegate;
class ChromeURLRequestContextGetter;
@@ -186,13 +183,11 @@ class ProfileIOData {
return &safe_browsing_enabled_;
}
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
// 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_;
@@ -264,11 +259,9 @@ 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) {
@@ -383,7 +376,6 @@ class ProfileIOData {
void set_channel_id_service(
net::ChannelIDService* channel_id_service) const;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params()
const {
return data_reduction_proxy_params_.get();
@@ -451,7 +443,6 @@ class ProfileIOData {
data_reduction_proxy_auth_request_handler_ =
data_reduction_proxy_auth_request_handler.Pass();
}
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
ChromeNetworkDelegate* network_delegate() const {
return network_delegate_.get();
@@ -623,9 +614,7 @@ class ProfileIOData {
mutable BooleanPrefMember enable_do_not_track_;
mutable BooleanPrefMember force_safesearch_;
mutable BooleanPrefMember safe_browsing_enabled_;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
mutable BooleanPrefMember data_reduction_proxy_enabled_;
-#endif
mutable BooleanPrefMember printing_enabled_;
mutable BooleanPrefMember sync_disabled_;
mutable BooleanPrefMember signin_allowed_;
@@ -656,7 +645,6 @@ class ProfileIOData {
#endif
mutable scoped_ptr<net::ChannelIDService> channel_id_service_;
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
// data_reduction_proxy_* classes must be declared before |network_delegate_|.
// The data_reduction_proxy_* classes are passed in to |network_delegate_|,
// so this ordering ensures that the |network_delegate_| never references
@@ -672,7 +660,6 @@ class ProfileIOData {
data_reduction_proxy_chrome_configurator_;
mutable scoped_ptr<data_reduction_proxy::DataReductionProxyAuthRequestHandler>
data_reduction_proxy_auth_request_handler_;
-#endif // defined(SPDY_PROXY_AUTH_ORIGIN)
mutable scoped_ptr<ChromeNetworkDelegate> network_delegate_;
mutable scoped_ptr<net::FraudulentCertificateReporter>
diff --git a/components/data_reduction_proxy/browser/BUILD.gn b/components/data_reduction_proxy/browser/BUILD.gn
index 96e5b25..48f1342 100644
--- a/components/data_reduction_proxy/browser/BUILD.gn
+++ b/components/data_reduction_proxy/browser/BUILD.gn
@@ -9,6 +9,8 @@ static_library("browser") {
"data_reduction_proxy_config_service.cc",
"data_reduction_proxy_config_service.h",
"data_reduction_proxy_configurator.h",
+ "data_reduction_proxy_delegate.cc",
+ "data_reduction_proxy_delegate.h",
"data_reduction_proxy_metrics.cc",
"data_reduction_proxy_metrics.h",
"data_reduction_proxy_params.cc",
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
index 25eae61..d59d0b9 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc
@@ -5,6 +5,7 @@
#include "components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h"
#include "base/metrics/histogram.h"
+#include "base/prefs/pref_service.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "components/data_reduction_proxy/browser/data_reduction_proxy_settings.h"
@@ -21,10 +22,8 @@ namespace data_reduction_proxy {
namespace {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
// A bypass delay more than this is treated as a long delay.
const int kLongBypassDelayInSeconds = 30 * 60;
-#endif
// Increments an int64, stored as a string, in a ListPref at the specified
// index. The value must already exist and be a string representation of a
@@ -299,7 +298,6 @@ DataReductionProxyRequestType GetDataReductionProxyRequestType(
NOTREACHED();
return UNKNOWN_TYPE;
}
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
DataReductionProxyParams params(
DataReductionProxyParams::kAllowed |
DataReductionProxyParams::kFallbackAllowed |
@@ -310,7 +308,6 @@ DataReductionProxyRequestType GetDataReductionProxyRequestType(
return LONG_BYPASS;
return SHORT_BYPASS;
}
-#endif
if (request->response_info().headers.get() &&
HasDataReductionProxyViaHeader(request->response_info().headers.get(),
NULL)) {
@@ -470,7 +467,7 @@ void UpdateContentLengthPrefsForDataReductionProxy(
void UpdateContentLengthPrefs(int received_content_length,
int original_content_length,
- bool with_data_reduction_proxy_enabled,
+ PrefService* profile_prefs,
DataReductionProxyRequestType request_type,
DataReductionProxyStatisticsPrefs* prefs) {
int64 total_received = prefs->GetInt64(
@@ -479,11 +476,16 @@ void UpdateContentLengthPrefs(int received_content_length,
data_reduction_proxy::prefs::kHttpOriginalContentLength);
total_received += received_content_length;
total_original += original_content_length;
- prefs->SetInt64(data_reduction_proxy::prefs::kHttpReceivedContentLength,
- total_received);
- prefs->SetInt64(data_reduction_proxy::prefs::kHttpOriginalContentLength,
- total_original);
-
+ prefs->SetInt64(
+ data_reduction_proxy::prefs::kHttpReceivedContentLength,
+ total_received);
+ prefs->SetInt64(
+ data_reduction_proxy::prefs::kHttpOriginalContentLength,
+ total_original);
+
+ bool with_data_reduction_proxy_enabled =
+ profile_prefs->GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled);
UpdateContentLengthPrefsForDataReductionProxy(
received_content_length,
original_content_length,
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
index 68fdb21..3fe17dc 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.h
@@ -11,6 +11,8 @@ namespace net {
class URLRequest;
}
+class PrefService;
+
namespace data_reduction_proxy {
class DataReductionProxyStatisticsPrefs;
@@ -53,7 +55,7 @@ void UpdateContentLengthPrefsForDataReductionProxy(
void UpdateContentLengthPrefs(
int received_content_length,
int original_content_length,
- bool with_data_reduction_proxy_enabled,
+ PrefService* profile_prefs,
DataReductionProxyRequestType request_type,
DataReductionProxyStatisticsPrefs* prefs);
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics_unittest.cc
index 0d24766..26c0791 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics_unittest.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics_unittest.cc
@@ -83,6 +83,8 @@ class ChromeNetworkDataSavingMetricsTest : public testing::Test {
registry->RegisterInt64Pref(
data_reduction_proxy::prefs::
kDailyHttpContentLengthLastUpdateDate, 0L);
+ registry->RegisterBooleanPref(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled, false);
}
TestingPrefServiceSimple pref_service_;
@@ -95,10 +97,13 @@ TEST_F(ChromeNetworkDataSavingMetricsTest, TotalLengths) {
UpdateContentLengthPrefs(
kReceivedLength, kOriginalLength,
- false, UNKNOWN_TYPE, statistics_prefs_.get());
+ &pref_service_, UNKNOWN_TYPE, statistics_prefs_.get());
+
EXPECT_EQ(kReceivedLength,
statistics_prefs_->GetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength));
+ EXPECT_FALSE(pref_service_.GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled));
EXPECT_EQ(kOriginalLength,
statistics_prefs_->GetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength));
@@ -106,10 +111,13 @@ TEST_F(ChromeNetworkDataSavingMetricsTest, TotalLengths) {
// Record the same numbers again, and total lengths should be doubled.
UpdateContentLengthPrefs(
kReceivedLength, kOriginalLength,
- false, UNKNOWN_TYPE, statistics_prefs_.get());
+ &pref_service_, UNKNOWN_TYPE, statistics_prefs_.get());
+
EXPECT_EQ(kReceivedLength * 2,
statistics_prefs_->GetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength));
+ EXPECT_FALSE(pref_service_.GetBoolean(
+ data_reduction_proxy::prefs::kDataReductionProxyEnabled));
EXPECT_EQ(kOriginalLength * 2,
statistics_prefs_->GetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength));
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc
index f5804d0..47ebda1 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc
@@ -24,18 +24,23 @@
using base::FieldTrialList;
namespace {
+
const char kEnabled[] = "Enabled";
-}
+const char kDefaultOrigin[] = "https://proxy.googlezip.net:443/";
+const char kDevOrigin[] = "http://proxy-dev.googlezip.net:443/";
+const char kDevFallbackOrigin[] = "http://proxy-dev.googlezip.net:80/";
+const char kDefaultFallbackOrigin[] = "http://compress.googlezip.net:80/";
+const char kDefaultSslOrigin[] = "http://ssl.googlezip.net:1043/";
+const char kDefaultAltOrigin[] = "https://proxy.googlezip.net:443/";
+const char kDefaultAltFallbackOrigin[] = "http://compress.googlezip.net:80/";
+const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect";
+const char kDefaultWarmupUrl[] = "http://www.gstatic.com/generate_204";
+
+} // namespace
namespace data_reduction_proxy {
// static
-bool DataReductionProxyParams::IsIncludedInFieldTrial() {
- return base::FieldTrialList::FindFullName(
- "DataCompressionProxyRollout") == kEnabled;
-}
-
-// static
bool DataReductionProxyParams::IsIncludedInAlternativeFieldTrial() {
const std::string group_name = base::FieldTrialList::FindFullName(
"DataCompressionProxyAlternativeConfiguration");
@@ -54,15 +59,13 @@ bool DataReductionProxyParams::IsIncludedInPromoFieldTrial() {
// static
bool DataReductionProxyParams::IsIncludedInPreconnectHintingFieldTrial() {
- return IsIncludedInFieldTrial() &&
- FieldTrialList::FindFullName(
+ return FieldTrialList::FindFullName(
"DataCompressionProxyPreconnectHints") == kEnabled;
}
// static
bool DataReductionProxyParams::IsIncludedInCriticalPathBypassFieldTrial() {
- return IsIncludedInFieldTrial() &&
- FieldTrialList::FindFullName(
+ return FieldTrialList::FindFullName(
"DataCompressionProxyCriticalBypass") == kEnabled;
}
@@ -391,30 +394,26 @@ bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules(
}
std::string DataReductionProxyParams::GetDefaultDevOrigin() const {
-#if defined(DATA_REDUCTION_DEV_HOST)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kDisableDataReductionProxyDev))
return std::string();
if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) ||
(FieldTrialList::FindFullName("DataCompressionProxyDevRollout") ==
kEnabled)) {
- return DATA_REDUCTION_DEV_HOST;
+ return kDevOrigin;
}
-#endif
return std::string();
}
std::string DataReductionProxyParams::GetDefaultDevFallbackOrigin() const {
-#if defined(DATA_REDUCTION_DEV_FALLBACK_HOST)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kDisableDataReductionProxyDev))
return std::string();
if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) ||
(FieldTrialList::FindFullName("DataCompressionProxyDevRollout") ==
kEnabled)) {
- return DATA_REDUCTION_DEV_FALLBACK_HOST;
+ return kDevFallbackOrigin;
}
-#endif
return std::string();
}
@@ -503,53 +502,33 @@ bool DataReductionProxyParams::ArePrimaryAndFallbackBypassed(
return found != retry_map.end();
}
+// TODO(kundaji): Remove tests for macro definitions.
std::string DataReductionProxyParams::GetDefaultOrigin() const {
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- return SPDY_PROXY_AUTH_ORIGIN;
-#endif
- return std::string();
+ return kDefaultOrigin;
}
std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const {
-#if defined(DATA_REDUCTION_FALLBACK_HOST)
- return DATA_REDUCTION_FALLBACK_HOST;
-#endif
- return std::string();
+ return kDefaultFallbackOrigin;
}
std::string DataReductionProxyParams::GetDefaultSSLOrigin() const {
-#if defined(DATA_REDUCTION_PROXY_SSL_ORIGIN)
- return DATA_REDUCTION_PROXY_SSL_ORIGIN;
-#endif
- return std::string();
+ return kDefaultSslOrigin;
}
std::string DataReductionProxyParams::GetDefaultAltOrigin() const {
-#if defined(DATA_REDUCTION_PROXY_ALT_ORIGIN)
- return DATA_REDUCTION_PROXY_ALT_ORIGIN;
-#endif
- return std::string();
+ return kDefaultAltOrigin;
}
std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const {
-#if defined(DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN)
- return DATA_REDUCTION_PROXY_ALT_FALLBACK_ORIGIN;
-#endif
- return std::string();
+ return kDefaultAltFallbackOrigin;
}
std::string DataReductionProxyParams::GetDefaultProbeURL() const {
-#if defined(DATA_REDUCTION_PROXY_PROBE_URL)
- return DATA_REDUCTION_PROXY_PROBE_URL;
-#endif
- return std::string();
+ return kDefaultProbeUrl;
}
std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
-#if defined(DATA_REDUCTION_PROXY_WARMUP_URL)
- return DATA_REDUCTION_PROXY_WARMUP_URL;
-#endif
- return std::string();
+ return kDefaultWarmupUrl;
}
} // namespace data_reduction_proxy
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_params.h b/components/data_reduction_proxy/browser/data_reduction_proxy_params.h
index bea9872..ebefaa3 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_params.h
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params.h
@@ -57,10 +57,6 @@ class DataReductionProxyParams {
typedef std::vector<GURL> DataReductionProxyList;
- // Returns true if this client is part of the data reduction proxy field
- // trial.
- static bool IsIncludedInFieldTrial();
-
// Returns true if this client is part of field trial to use an alternative
// configuration for the data reduction proxy.
static bool IsIncludedInAlternativeFieldTrial();
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
index 77e1568..c4c13ee 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
@@ -890,8 +890,6 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
// With Finch trial set, should only bypass if LOAD flag is set and the
// effective proxy is the data compression proxy.
base::FieldTrialList field_trial_list(new BadEntropyProvider());
- base::FieldTrialList::CreateFieldTrial("DataCompressionProxyRollout",
- "Enabled");
base::FieldTrialList::CreateFieldTrial("DataCompressionProxyCriticalBypass",
"Enabled");
EXPECT_TRUE(
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc
index 6d9eaad..39b737d 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_statistics_prefs.cc
@@ -105,7 +105,6 @@ base::ListValue* DataReductionProxyStatisticsPrefs::GetList(
void DataReductionProxyStatisticsPrefs::WritePrefs() {
if (delay_ == base::TimeDelta())
return;
- DCHECK(delayed_task_posted_);
for (DataReductionProxyPrefMap::iterator iter = pref_map_.begin();
iter != pref_map_.end(); ++iter) {
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc
index 6a35460..cf79fed 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc
@@ -74,7 +74,7 @@ void DataReductionProxyUsageStats::RecordDataReductionProxyBypassInfo(
DataReductionProxyUsageStats::DataReductionProxyUsageStats(
DataReductionProxyParams* params,
- MessageLoopProxy* ui_thread_proxy)
+ const scoped_refptr<MessageLoopProxy>& ui_thread_proxy)
: data_reduction_proxy_params_(params),
last_bypass_type_(BYPASS_EVENT_TYPE_MAX),
triggering_request_(true),
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
index 33fd29e..65e06b1 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h
@@ -35,8 +35,9 @@ class DataReductionProxyUsageStats
// MessageLoopProxy instance is owned by io_thread. |params| outlives
// this class instance.
- DataReductionProxyUsageStats(DataReductionProxyParams* params,
- base::MessageLoopProxy* ui_thread_proxy);
+ DataReductionProxyUsageStats(
+ DataReductionProxyParams* params,
+ const scoped_refptr<base::MessageLoopProxy>& ui_thread_proxy);
virtual ~DataReductionProxyUsageStats();
// Sets the callback to be called on the UI thread when the unavailability
@@ -102,7 +103,7 @@ class DataReductionProxyUsageStats
DataReductionProxyBypassType last_bypass_type_;
// True if the last request triggered the current bypass.
bool triggering_request_;
- base::MessageLoopProxy* ui_thread_proxy_;
+ const scoped_refptr<base::MessageLoopProxy> ui_thread_proxy_;
// The following 2 fields are used to determine if data reduction proxy is
// unreachable. We keep a count of requests which should go through
diff --git a/components/precache/content/precache_manager.cc b/components/precache/content/precache_manager.cc
index f222163..71ce9ea 100644
--- a/components/precache/content/precache_manager.cc
+++ b/components/precache/content/precache_manager.cc
@@ -55,12 +55,8 @@ bool PrecacheManager::IsPrecachingEnabled() {
bool PrecacheManager::IsPrecachingAllowed() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean(
data_reduction_proxy::prefs::kDataReductionProxyEnabled);
-#else
- return false;
-#endif
}
void PrecacheManager::StartPrecaching(
diff --git a/net/http/http_log_util.cc b/net/http/http_log_util.cc
index 4d0e6e9..7e93911 100644
--- a/net/http/http_log_util.cc
+++ b/net/http/http_log_util.cc
@@ -34,34 +34,11 @@ bool ShouldRedactChallenge(HttpAuthChallengeTokenizer* challenge) {
} // namespace
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-void ElideChromeProxyDirective(const std::string& header_value,
- const std::string& directive,
- std::string::const_iterator* redact_begin,
- std::string::const_iterator* redact_end) {
- HttpUtil::ValuesIterator it(header_value.begin(), header_value.end(), ',');
- while (it.GetNext()) {
- if (LowerCaseEqualsASCII(it.value_begin(),
- it.value_begin() + directive.size(),
- directive.c_str())) {
- *redact_begin = it.value_begin();
- *redact_end = it.value_end();
- return;
- }
- }
-}
-#endif
-
std::string ElideHeaderValueForNetLog(NetLog::LogLevel log_level,
const std::string& header,
const std::string& value) {
std::string::const_iterator redact_begin = value.begin();
std::string::const_iterator redact_end = value.begin();
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- if (!base::strcasecmp(header.c_str(), "chrome-proxy")) {
- ElideChromeProxyDirective(value, "sid=", &redact_begin, &redact_end);
- }
-#endif
if (redact_begin == redact_end &&
log_level >= NetLog::LOG_STRIP_PRIVATE_DATA) {
diff --git a/net/http/http_log_util_unittest.cc b/net/http/http_log_util_unittest.cc
index 3c5c826..dd6af69 100644
--- a/net/http/http_log_util_unittest.cc
+++ b/net/http/http_log_util_unittest.cc
@@ -53,22 +53,6 @@ TEST(HttpLogUtilTest, ElideHeaderValueForNetLog) {
// Leave whitespace intact.
EXPECT_EQ("NTLM [4 bytes were stripped] ", ElideHeaderValueForNetLog(
NetLog::LOG_STRIP_PRIVATE_DATA, "WWW-Authenticate", "NTLM 1234 "));
-
- // Extra elisions for SPDY_PROXY_AUTH_ORIGIN.
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- EXPECT_EQ("ps=123, [7 bytes were stripped], c=foo, v=bar",
- ElideHeaderValueForNetLog(
- NetLog::LOG_STRIP_PRIVATE_DATA,
- "Chrome-Proxy", "ps=123, sid=456, c=foo, v=bar"));
- EXPECT_EQ("[7 bytes were stripped], ps=123, c=foo, v=bar",
- ElideHeaderValueForNetLog(
- NetLog::LOG_STRIP_PRIVATE_DATA,
- "Chrome-Proxy", "sid=456, ps=123, c=foo, v=bar"));
- EXPECT_EQ("ps=123, c=foo, v=bar, [7 bytes were stripped]",
- ElideHeaderValueForNetLog(
- NetLog::LOG_STRIP_PRIVATE_DATA,
- "Chrome-Proxy", "ps=123, c=foo, v=bar, sid=456"));
-#endif
}
} // namspace net
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index 1898c18..532f9de 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -63,12 +63,6 @@
#include "url/gurl.h"
#include "url/url_canon.h"
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
-#include <algorithm>
-#include "net/proxy/proxy_server.h"
-#endif
-
-
using base::Time;
using base::TimeDelta;
diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc
index dd56079..213a682 100644
--- a/net/http/http_proxy_client_socket_pool.cc
+++ b/net/http/http_proxy_client_socket_pool.cc
@@ -70,13 +70,14 @@ HttpProxySocketParams::~HttpProxySocketParams() {}
// HttpProxyConnectJobs will time out after this many seconds. Note this is on
// top of the timeout for the transport socket.
-#if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN)
+// TODO(kundaji): Proxy connect timeout should be independent of platform and be
+// based on proxy. Bug http://crbug.com/407446.
+#if defined(OS_ANDROID) || defined(OS_IOS)
static const int kHttpProxyConnectJobTimeoutInSeconds = 10;
#else
static const int kHttpProxyConnectJobTimeoutInSeconds = 30;
#endif
-
HttpProxyConnectJob::HttpProxyConnectJob(
const std::string& group_name,
RequestPriority priority,
@@ -384,7 +385,9 @@ HttpProxyConnectJobFactory::HttpProxyConnectJobFactory(
net_log_(net_log) {
base::TimeDelta max_pool_timeout = base::TimeDelta();
-#if (defined(OS_ANDROID) || defined(OS_IOS)) && defined(SPDY_PROXY_AUTH_ORIGIN)
+// TODO(kundaji): Proxy connect timeout should be independent of platform and be
+// based on proxy. Bug http://crbug.com/407446.
+#if (defined(OS_ANDROID) || defined(OS_IOS))
#else
if (transport_pool_)
max_pool_timeout = transport_pool_->ConnectionTimeout();
diff --git a/net/proxy/proxy_server.cc b/net/proxy/proxy_server.cc
index 09c2538..d74a89f0 100644
--- a/net/proxy/proxy_server.cc
+++ b/net/proxy/proxy_server.cc
@@ -88,7 +88,8 @@ ProxyServer::ProxyServer(Scheme scheme, const HostPortPair& host_port_pair)
const HostPortPair& ProxyServer::host_port_pair() const {
// Doesn't make sense to call this if the URI scheme doesn't
// have concept of a host.
- DCHECK(is_valid() && !is_direct());
+ DCHECK(is_valid());
+ DCHECK(!is_direct());
return host_port_pair_;
}
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc
index 388e3fe..6356783 100644
--- a/net/socket/ssl_client_socket_pool.cc
+++ b/net/socket/ssl_client_socket_pool.cc
@@ -488,18 +488,6 @@ int SSLConnectJob::DoSSLConnectComplete(int result) {
base::TimeDelta::FromMinutes(1),
100);
}
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- bool using_data_reduction_proxy = params_->host_and_port().Equals(
- HostPortPair::FromURL(GURL(SPDY_PROXY_AUTH_ORIGIN)));
- if (using_data_reduction_proxy) {
- UMA_HISTOGRAM_CUSTOM_TIMES(
- "Net.SSL_Connection_Latency_DataReductionProxy",
- connect_duration,
- base::TimeDelta::FromMilliseconds(1),
- base::TimeDelta::FromMinutes(1),
- 100);
- }
-#endif
UMA_HISTOGRAM_CUSTOM_TIMES("Net.SSL_Connection_Latency_2",
connect_duration,
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 62f938d..285bccf 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -743,11 +743,6 @@ void SpdySession::InitializeWithSocket(
"Net.SpdyVersion2",
protocol_ - kProtoSPDYMinimumVersion,
kProtoSPDYMaximumVersion - kProtoSPDYMinimumVersion + 1);
-#if defined(SPDY_PROXY_AUTH_ORIGIN)
- UMA_HISTOGRAM_BOOLEAN("Net.SpdySessions_DataReductionProxy",
- host_port_pair().Equals(HostPortPair::FromURL(
- GURL(SPDY_PROXY_AUTH_ORIGIN))));
-#endif
net_log_.AddEvent(NetLog::TYPE_SPDY_SESSION_INITIALIZED,
base::Bind(&NetLogSpdyInitializedCallback,
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 117d17b..e225050 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -17574,6 +17574,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<histogram name="Net.SpdySessions_DataReductionProxy"
enum="BooleanDataReductionProxy">
+ <obsolete>
+ Deprecated 7/21/2014. No longer tracked.
+ </obsolete>
<owner>bengr@chromium.org</owner>
<owner>bolian@chromium.org</owner>
<owner>rch@chromium.org</owner>
@@ -17736,6 +17739,9 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<histogram name="Net.SSL_Connection_Latency_DataReductionProxy"
units="milliseconds">
+ <obsolete>
+ Deprecated 7/21/2014. No longer tracked.
+ </obsolete>
<owner>bengr@chromium.org</owner>
<owner>bolian@chromium.org</owner>
<summary>