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) | |
bengr
2013/12/19 23:11:15
Add curly braces.
bolian
2013/12/19 23:35:26
Done.
| |
268 return DATA_REDUCTION_DEV_HOST; | |
269 #endif | |
263 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 270 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
264 return SPDY_PROXY_AUTH_ORIGIN; | 271 return SPDY_PROXY_AUTH_ORIGIN; |
265 #else | 272 #else |
266 return std::string(); | 273 return std::string(); |
267 #endif | 274 #endif |
268 } | 275 } |
269 | 276 |
270 // static | 277 // static |
271 std::string DataReductionProxySettings::GetDataReductionProxyFallback() { | 278 std::string DataReductionProxySettings::GetDataReductionProxyFallback() { |
272 // Regardless of what else is defined, only return a value if the main proxy | 279 // 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 } | 684 } |
678 | 685 |
679 void | 686 void |
680 DataReductionProxySettings::ProbeWhetherDataReductionProxyIsAvailable() { | 687 DataReductionProxySettings::ProbeWhetherDataReductionProxyIsAvailable() { |
681 net::URLFetcher* fetcher = GetURLFetcher(); | 688 net::URLFetcher* fetcher = GetURLFetcher(); |
682 if (!fetcher) | 689 if (!fetcher) |
683 return; | 690 return; |
684 fetcher_.reset(fetcher); | 691 fetcher_.reset(fetcher); |
685 fetcher_->Start(); | 692 fetcher_->Start(); |
686 } | 693 } |
OLD | NEW |