| Index: chrome/browser/net/spdyproxy/data_reduction_proxy_settings.cc
|
| diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.cc
|
| index 4318d770545b5b7eb7818aaf49d33ad3db4b43d6..c22869784fe5c96799959629e5d882489073424b 100644
|
| --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.cc
|
| +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_settings.cc
|
| @@ -150,6 +150,21 @@ std::string DataReductionProxySettings::GetDataReductionProxyOrigin() {
|
| #endif
|
| }
|
|
|
| +std::string DataReductionProxySettings::GetDataReductionProxyFallback() {
|
| + // Regardless of what else is defined, only return a value if the main proxy
|
| + // origin is defined.
|
| + if (GetDataReductionProxyOrigin().empty())
|
| + return std::string();
|
| + const CommandLine& command_line = *CommandLine::ForCurrentProcess();
|
| + if (command_line.HasSwitch(switches::kSpdyProxyAuthFallback))
|
| + return command_line.GetSwitchValueASCII(switches::kSpdyProxyAuthFallback);
|
| +#if defined(DATA_REDUCTION_FALLBACK_HOST)
|
| + return DATA_REDUCTION_FALLBACK_HOST;
|
| +#else
|
| + return std::string();
|
| +#endif
|
| +}
|
| +
|
| std::string DataReductionProxySettings::GetDataReductionProxyAuth() {
|
| if (!IsDataReductionProxyAllowed())
|
| return std::string();
|
| @@ -237,17 +252,6 @@ void DataReductionProxySettings::OnURLFetchComplete(
|
| disabled_by_carrier_ = true;
|
| }
|
|
|
| -std::string DataReductionProxySettings::GetDataReductionProxyOriginHostPort() {
|
| - std::string spdy_proxy = GetDataReductionProxyOrigin();
|
| - if (spdy_proxy.empty()) {
|
| - DLOG(ERROR) << "A SPDY proxy has not been set.";
|
| - return spdy_proxy;
|
| - }
|
| - // Remove a trailing slash from the proxy string if one exists as well as
|
| - // leading HTTPS scheme.
|
| - return net::HostPortPair::FromURL(GURL(spdy_proxy)).ToString();
|
| -}
|
| -
|
| void DataReductionProxySettings::OnIPAddressChanged() {
|
| if (enabled_by_user_) {
|
| DCHECK(IsDataReductionProxyAllowed());
|
| @@ -324,12 +328,10 @@ void DataReductionProxySettings::MaybeActivateDataReductionProxy(
|
| ResetDataReductionStatistics();
|
| }
|
|
|
| - std::string spdy_proxy_origin = GetDataReductionProxyOriginHostPort();
|
| -
|
| + std::string proxy = GetDataReductionProxyOrigin();
|
| // Configure use of the data reduction proxy if it is enabled and the proxy
|
| // origin is non-empty.
|
| - enabled_by_user_=
|
| - spdy_proxy_auth_enabled_.GetValue() && !spdy_proxy_origin.empty();
|
| + enabled_by_user_= spdy_proxy_auth_enabled_.GetValue() && !proxy.empty();
|
| SetProxyConfigs(enabled_by_user_ && !disabled_by_carrier_, at_startup);
|
|
|
| // Check if the proxy has been disabled explicitly by the carrier.
|
| @@ -345,8 +347,11 @@ void DataReductionProxySettings::SetProxyConfigs(bool enabled,
|
| DictionaryPrefUpdate update(prefs, prefs::kProxy);
|
| base::DictionaryValue* dict = update.Get();
|
| if (enabled) {
|
| + std::string fallback = GetDataReductionProxyFallback();
|
| std::string proxy_server_config =
|
| - "http=" + GetDataReductionProxyOrigin() + ",direct://;";
|
| + "http=" + GetDataReductionProxyOrigin() +
|
| + (fallback.empty() ? "" : "," + fallback) +
|
| + ",direct://;";
|
| dict->SetString("server", proxy_server_config);
|
| dict->SetString("mode",
|
| ProxyModeToString(ProxyPrefs::MODE_FIXED_SERVERS));
|
|
|