Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_params.cc

Issue 549153003: Dev finch trial of the data reduction proxy overrides both the primary and the fallback hosts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 std::string warmup_url = command_line.GetSwitchValueASCII( 246 std::string warmup_url = command_line.GetSwitchValueASCII(
247 switches::kDataReductionProxyWarmupURL); 247 switches::kDataReductionProxyWarmupURL);
248 248
249 // Set from preprocessor constants those params that are not specified on the 249 // Set from preprocessor constants those params that are not specified on the
250 // command line. 250 // command line.
251 if (origin.empty()) 251 if (origin.empty())
252 origin = GetDefaultDevOrigin(); 252 origin = GetDefaultDevOrigin();
253 if (origin.empty()) 253 if (origin.empty())
254 origin = GetDefaultOrigin(); 254 origin = GetDefaultOrigin();
255 if (fallback_origin.empty()) 255 if (fallback_origin.empty())
256 fallback_origin = GetDefaultDevFallbackOrigin();
257 if (fallback_origin.empty())
256 fallback_origin = GetDefaultFallbackOrigin(); 258 fallback_origin = GetDefaultFallbackOrigin();
257 if (ssl_origin.empty()) 259 if (ssl_origin.empty())
258 ssl_origin = GetDefaultSSLOrigin(); 260 ssl_origin = GetDefaultSSLOrigin();
259 if (alt_origin.empty()) 261 if (alt_origin.empty())
260 alt_origin = GetDefaultAltOrigin(); 262 alt_origin = GetDefaultAltOrigin();
261 if (alt_fallback_origin.empty()) 263 if (alt_fallback_origin.empty())
262 alt_fallback_origin = GetDefaultAltFallbackOrigin(); 264 alt_fallback_origin = GetDefaultAltFallbackOrigin();
263 if (probe_url.empty()) 265 if (probe_url.empty())
264 probe_url = GetDefaultProbeURL(); 266 probe_url = GetDefaultProbeURL();
265 if (warmup_url.empty()) 267 if (warmup_url.empty())
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return std::string(); 391 return std::string();
390 if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) || 392 if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) ||
391 (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") == 393 (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") ==
392 kEnabled)) { 394 kEnabled)) {
393 return DATA_REDUCTION_DEV_HOST; 395 return DATA_REDUCTION_DEV_HOST;
394 } 396 }
395 #endif 397 #endif
396 return std::string(); 398 return std::string();
397 } 399 }
398 400
401 std::string DataReductionProxyParams::GetDefaultDevFallbackOrigin() const {
402 #if defined(DATA_REDUCTION_DEV_FALLBACK_HOST)
403 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
404 if (command_line.HasSwitch(switches::kDisableDataReductionProxyDev))
405 return std::string();
406 if (command_line.HasSwitch(switches::kEnableDataReductionProxyDev) ||
407 (FieldTrialList::FindFullName("DataCompressionProxyDevRollout") ==
408 kEnabled)) {
409 return DATA_REDUCTION_DEV_FALLBACK_HOST;
410 }
411 #endif
412 return std::string();
413 }
414
399 bool DataReductionProxyParams::AreDataReductionProxiesBypassed( 415 bool DataReductionProxyParams::AreDataReductionProxiesBypassed(
400 const net::URLRequest& request, base::TimeDelta* min_retry_delay) const { 416 const net::URLRequest& request, base::TimeDelta* min_retry_delay) const {
401 if (request.context() != NULL && 417 if (request.context() != NULL &&
402 request.context()->proxy_service() != NULL) { 418 request.context()->proxy_service() != NULL) {
403 return AreProxiesBypassed( 419 return AreProxiesBypassed(
404 request.context()->proxy_service()->proxy_retry_info(), 420 request.context()->proxy_service()->proxy_retry_info(),
405 request.url().SchemeIs(url::kHttpsScheme), 421 request.url().SchemeIs(url::kHttpsScheme),
406 min_retry_delay); 422 min_retry_delay);
407 } 423 }
408 424
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 } 540 }
525 541
526 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { 542 std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
527 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) 543 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL)
528 return DATA_REDUCTION_PROXY_WARMUP_URL; 544 return DATA_REDUCTION_PROXY_WARMUP_URL;
529 #endif 545 #endif
530 return std::string(); 546 return std::string();
531 } 547 }
532 548
533 } // namespace data_reduction_proxy 549 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698