| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h" | 5 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_settings.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void* iter = NULL; | 251 void* iter = NULL; |
| 252 std::string value; | 252 std::string value; |
| 253 while (headers->EnumerateHeader(&iter, "via", &value)) | 253 while (headers->EnumerateHeader(&iter, "via", &value)) |
| 254 if (value == kChromeProxyViaValue) return true; | 254 if (value == kChromeProxyViaValue) return true; |
| 255 return false; | 255 return false; |
| 256 } | 256 } |
| 257 | 257 |
| 258 // static | 258 // static |
| 259 std::string DataReductionProxySettings::GetDataReductionProxyOrigin() { | 259 std::string DataReductionProxySettings::GetDataReductionProxyOrigin() { |
| 260 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 260 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 261 if (command_line.HasSwitch(switches::kSpdyProxyDevAuthOrigin)) |
| 262 return command_line.GetSwitchValueASCII(switches::kSpdyProxyDevAuthOrigin); |
| 261 if (command_line.HasSwitch(switches::kSpdyProxyAuthOrigin)) | 263 if (command_line.HasSwitch(switches::kSpdyProxyAuthOrigin)) |
| 262 return command_line.GetSwitchValueASCII(switches::kSpdyProxyAuthOrigin); | 264 return command_line.GetSwitchValueASCII(switches::kSpdyProxyAuthOrigin); |
| 265 #if defined(DATA_REDUCTION_DEV_HOST) |
| 266 if (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") == |
| 267 kEnabled) { |
| 268 return DATA_REDUCTION_DEV_HOST; |
| 269 } |
| 270 #endif |
| 263 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 271 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| 264 return SPDY_PROXY_AUTH_ORIGIN; | 272 return SPDY_PROXY_AUTH_ORIGIN; |
| 265 #else | 273 #else |
| 266 return std::string(); | 274 return std::string(); |
| 267 #endif | 275 #endif |
| 268 } | 276 } |
| 269 | 277 |
| 270 // static | 278 // static |
| 271 std::string DataReductionProxySettings::GetDataReductionProxyFallback() { | 279 std::string DataReductionProxySettings::GetDataReductionProxyFallback() { |
| 272 // Regardless of what else is defined, only return a value if the main proxy | 280 // Regardless of what else is defined, only return a value if the main proxy |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 685 } |
| 678 | 686 |
| 679 void | 687 void |
| 680 DataReductionProxySettings::ProbeWhetherDataReductionProxyIsAvailable() { | 688 DataReductionProxySettings::ProbeWhetherDataReductionProxyIsAvailable() { |
| 681 net::URLFetcher* fetcher = GetURLFetcher(); | 689 net::URLFetcher* fetcher = GetURLFetcher(); |
| 682 if (!fetcher) | 690 if (!fetcher) |
| 683 return; | 691 return; |
| 684 fetcher_.reset(fetcher); | 692 fetcher_.reset(fetcher); |
| 685 fetcher_->Start(); | 693 fetcher_->Start(); |
| 686 } | 694 } |
| OLD | NEW |