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

Side by Side Diff: components/data_reduction_proxy/core/common/data_reduction_proxy_params.cc

Issue 903213003: Enable QUIC for proxies based on Finch config and command line switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Followed on what we discussed. Created 5 years, 10 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/core/common/data_reduction_proxy_param s.h" 5 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 12 matching lines...) Expand all
23 #include "net/proxy/proxy_service.h" 23 #include "net/proxy/proxy_service.h"
24 #include "net/url_request/url_request.h" 24 #include "net/url_request/url_request.h"
25 #include "net/url_request/url_request_context.h" 25 #include "net/url_request/url_request_context.h"
26 #include "url/url_constants.h" 26 #include "url/url_constants.h"
27 27
28 using base::FieldTrialList; 28 using base::FieldTrialList;
29 29
30 namespace { 30 namespace {
31 31
32 const char kEnabled[] = "Enabled"; 32 const char kEnabled[] = "Enabled";
33 const char kDefaultOrigin[] = "https://proxy.googlezip.net:443"; 33 const char kDefaultSpdyOrigin[] = "https://proxy.googlezip.net:443";
34 const char kDefaultQuicOrigin[] = "quic://proxy.googlezip.net:443";
34 const char kDevOrigin[] = "https://proxy-dev.googlezip.net:443"; 35 const char kDevOrigin[] = "https://proxy-dev.googlezip.net:443";
35 const char kDevFallbackOrigin[] = "proxy-dev.googlezip.net:80"; 36 const char kDevFallbackOrigin[] = "proxy-dev.googlezip.net:80";
36 const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80"; 37 const char kDefaultFallbackOrigin[] = "compress.googlezip.net:80";
37 // This is for a proxy that supports HTTP CONNECT to tunnel SSL traffic. 38 // This is for a proxy that supports HTTP CONNECT to tunnel SSL traffic.
38 // The proxy listens on port 443, but uses the HTTP protocol to set up 39 // The proxy listens on port 443, but uses the HTTP protocol to set up
39 // the tunnel, not HTTPS. 40 // the tunnel, not HTTPS.
40 const char kDefaultSslOrigin[] = "ssl.googlezip.net:443"; 41 const char kDefaultSslOrigin[] = "ssl.googlezip.net:443";
41 const char kDefaultAltOrigin[] = "ssl.googlezip.net:80"; 42 const char kDefaultAltOrigin[] = "ssl.googlezip.net:80";
42 const char kDefaultAltFallbackOrigin[] = "ssl.googlezip.net:80"; 43 const char kDefaultAltFallbackOrigin[] = "ssl.googlezip.net:80";
43 const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect"; 44 const char kDefaultProbeUrl[] = "http://check.googlezip.net/connect";
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 "DataReductionProxyRemoveMissingViaHeaderOtherBypass") == "Relaxed"; 92 "DataReductionProxyRemoveMissingViaHeaderOtherBypass") == "Relaxed";
92 } 93 }
93 94
94 // static 95 // static
95 bool DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial( 96 bool DataReductionProxyParams::IsIncludedInAndroidOnePromoFieldTrial(
96 const char* build_fingerprint) { 97 const char* build_fingerprint) {
97 base::StringPiece fingerprint(build_fingerprint); 98 base::StringPiece fingerprint(build_fingerprint);
98 return (fingerprint.find(kAndroidOneIdentifier) != std::string::npos); 99 return (fingerprint.find(kAndroidOneIdentifier) != std::string::npos);
99 } 100 }
100 101
102 // static
103 bool DataReductionProxyParams::IsIncludedInUseQUICAsPrimaryOriginFieldTrial() {
104 return FieldTrialList::FindFullName(
105 "DataReductionProxyUseQUICAsPrimaryOrigin") == kEnabled;
Ryan Hamilton 2015/02/08 16:56:36 Hm. It's unfortunate that this file is duplicating
tbansal1 2015/02/10 19:46:04 Done.
106 }
107
101 DataReductionProxyTypeInfo::DataReductionProxyTypeInfo() 108 DataReductionProxyTypeInfo::DataReductionProxyTypeInfo()
102 : proxy_servers(), 109 : proxy_servers(),
103 is_fallback(false), 110 is_fallback(false),
104 is_alternative(false), 111 is_alternative(false),
105 is_ssl(false) { 112 is_ssl(false) {
106 } 113 }
107 114
108 DataReductionProxyTypeInfo::~DataReductionProxyTypeInfo(){ 115 DataReductionProxyTypeInfo::~DataReductionProxyTypeInfo(){
109 } 116 }
110 117
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 command_line.GetSwitchValueASCII(switches::kDataReductionSSLProxy); 274 command_line.GetSwitchValueASCII(switches::kDataReductionSSLProxy);
268 std::string alt_origin = 275 std::string alt_origin =
269 command_line.GetSwitchValueASCII(switches::kDataReductionProxyAlt); 276 command_line.GetSwitchValueASCII(switches::kDataReductionProxyAlt);
270 std::string alt_fallback_origin = command_line.GetSwitchValueASCII( 277 std::string alt_fallback_origin = command_line.GetSwitchValueASCII(
271 switches::kDataReductionProxyAltFallback); 278 switches::kDataReductionProxyAltFallback);
272 279
273 configured_on_command_line_ = 280 configured_on_command_line_ =
274 !(origin.empty() && fallback_origin.empty() && ssl_origin.empty() && 281 !(origin.empty() && fallback_origin.empty() && ssl_origin.empty() &&
275 alt_origin.empty() && alt_fallback_origin.empty()); 282 alt_origin.empty() && alt_fallback_origin.empty());
276 283
284 quic_globally_disabled_ = command_line.HasSwitch("disable-quic");
277 285
278 // Configuring the proxy on the command line overrides the values of 286 // Configuring the proxy on the command line overrides the values of
279 // |allowed_| and |alt_allowed_|. 287 // |allowed_| and |alt_allowed_|.
280 if (configured_on_command_line_) 288 if (configured_on_command_line_)
281 allowed_ = true; 289 allowed_ = true;
282 if (!(ssl_origin.empty() && 290 if (!(ssl_origin.empty() &&
283 alt_origin.empty())) 291 alt_origin.empty()))
284 alt_allowed_ = true; 292 alt_allowed_ = true;
285 293
286 std::string probe_url = command_line.GetSwitchValueASCII( 294 std::string probe_url = command_line.GetSwitchValueASCII(
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 } 521 }
514 522
515 if (retry_delay) 523 if (retry_delay)
516 *retry_delay = found->second.current_delay; 524 *retry_delay = found->second.current_delay;
517 525
518 return true; 526 return true;
519 } 527 }
520 528
521 // TODO(kundaji): Remove tests for macro definitions. 529 // TODO(kundaji): Remove tests for macro definitions.
522 std::string DataReductionProxyParams::GetDefaultOrigin() const { 530 std::string DataReductionProxyParams::GetDefaultOrigin() const {
523 return kDefaultOrigin; 531 return IsIncludedInUseQUICAsPrimaryOriginFieldTrial() &&
532 !quic_globally_disabled_ ? kDefaultQuicOrigin: kDefaultSpdyOrigin;
524 } 533 }
525 534
526 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const { 535 std::string DataReductionProxyParams::GetDefaultFallbackOrigin() const {
527 return kDefaultFallbackOrigin; 536 return kDefaultFallbackOrigin;
528 } 537 }
529 538
530 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const { 539 std::string DataReductionProxyParams::GetDefaultSSLOrigin() const {
531 return kDefaultSslOrigin; 540 return kDefaultSslOrigin;
532 } 541 }
533 542
534 std::string DataReductionProxyParams::GetDefaultAltOrigin() const { 543 std::string DataReductionProxyParams::GetDefaultAltOrigin() const {
535 return kDefaultAltOrigin; 544 return kDefaultAltOrigin;
536 } 545 }
537 546
538 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const { 547 std::string DataReductionProxyParams::GetDefaultAltFallbackOrigin() const {
539 return kDefaultAltFallbackOrigin; 548 return kDefaultAltFallbackOrigin;
540 } 549 }
541 550
542 std::string DataReductionProxyParams::GetDefaultProbeURL() const { 551 std::string DataReductionProxyParams::GetDefaultProbeURL() const {
543 return kDefaultProbeUrl; 552 return kDefaultProbeUrl;
544 } 553 }
545 554
546 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { 555 std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
547 return kDefaultWarmupUrl; 556 return kDefaultWarmupUrl;
548 } 557 }
549 558
550 } // namespace data_reduction_proxy 559 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698