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

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

Issue 412143009: Moved data reduction proxy initialization logic to ProfileImplIOData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from willchan and sgurun Created 6 years, 4 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h"
8 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
9 #include "base/time/time.h" 10 #include "base/time/time.h"
10 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h " 11 #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h "
11 #include "net/base/host_port_pair.h" 12 #include "net/base/host_port_pair.h"
12 #include "net/proxy/proxy_info.h" 13 #include "net/proxy/proxy_info.h"
13 #include "net/proxy/proxy_retry_info.h" 14 #include "net/proxy/proxy_retry_info.h"
14 #include "net/proxy/proxy_server.h" 15 #include "net/proxy/proxy_server.h"
15 #include "net/proxy/proxy_service.h" 16 #include "net/proxy/proxy_service.h"
16 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_context.h" 18 #include "net/url_request/url_request_context.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 : allowed_((flags & kAllowed) == kAllowed), 67 : allowed_((flags & kAllowed) == kAllowed),
67 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed), 68 fallback_allowed_((flags & kFallbackAllowed) == kFallbackAllowed),
68 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed), 69 alt_allowed_((flags & kAlternativeAllowed) == kAlternativeAllowed),
69 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed), 70 promo_allowed_((flags & kPromoAllowed) == kPromoAllowed),
70 holdback_((flags & kHoldback) == kHoldback), 71 holdback_((flags & kHoldback) == kHoldback),
71 configured_on_command_line_(false) { 72 configured_on_command_line_(false) {
72 bool result = Init(allowed_, fallback_allowed_, alt_allowed_); 73 bool result = Init(allowed_, fallback_allowed_, alt_allowed_);
73 DCHECK(result); 74 DCHECK(result);
74 } 75 }
75 76
77 scoped_ptr<DataReductionProxyParams> DataReductionProxyParams::Clone() {
78 return scoped_ptr<DataReductionProxyParams>(
79 new DataReductionProxyParams(*this));
80 }
81
82 DataReductionProxyParams::DataReductionProxyParams(
83 const DataReductionProxyParams& other)
84 : origin_(other.origin_),
85 fallback_origin_(other.fallback_origin_),
86 ssl_origin_(other.ssl_origin_),
87 alt_origin_(other.alt_origin_),
88 alt_fallback_origin_(other.alt_fallback_origin_),
89 probe_url_(other.probe_url_),
90 warmup_url_(other.warmup_url_),
91 allowed_(other.allowed_),
92 fallback_allowed_(other.fallback_allowed_),
93 alt_allowed_(other.alt_allowed_),
94 promo_allowed_(other.promo_allowed_),
95 holdback_(other.holdback_),
96 configured_on_command_line_(other.configured_on_command_line_) {
97 }
98
76 DataReductionProxyParams::~DataReductionProxyParams() { 99 DataReductionProxyParams::~DataReductionProxyParams() {
77 } 100 }
78 101
79 DataReductionProxyParams::DataReductionProxyList 102 DataReductionProxyParams::DataReductionProxyList
80 DataReductionProxyParams::GetAllowedProxies() const { 103 DataReductionProxyParams::GetAllowedProxies() const {
81 DataReductionProxyList list; 104 DataReductionProxyList list;
82 if (allowed_) { 105 if (allowed_) {
83 list.push_back(origin_); 106 list.push_back(origin_);
84 // TODO(bolian): revert this once the proxy PAC fix is ready. 107 // TODO(bolian): revert this once the proxy PAC fix is ready.
85 if (GURL(GetDefaultDevOrigin()) == origin()) { 108 if (GURL(GetDefaultDevOrigin()) == origin()) {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 return std::string(); 478 return std::string();
456 } 479 }
457 480
458 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { 481 std::string DataReductionProxyParams::GetDefaultWarmupURL() const {
459 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) 482 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL)
460 return DATA_REDUCTION_PROXY_WARMUP_URL; 483 return DATA_REDUCTION_PROXY_WARMUP_URL;
461 #endif 484 #endif
462 return std::string(); 485 return std::string();
463 } 486 }
464 487
488 DataReductionProxyParams& DataReductionProxyParams::operator=(
willchan no longer on Chromium 2014/08/04 23:13:46 What happens if you don't define this? Does anythi
bengr 2014/08/05 02:35:07 No link error. Interesting. Done.
willchan no longer on Chromium 2014/08/05 03:03:52 DISALLOW_COPY_AND_ASSIGN() just declares the copy
489 const DataReductionProxyParams &params) {
490 if (this != &params) {
491 origin_ = params.origin_;
492 fallback_origin_ = params.fallback_origin_;
493 ssl_origin_ = params.ssl_origin_;
494 alt_origin_ = params.alt_origin_;
495 alt_fallback_origin_ = params.alt_fallback_origin_;
496 probe_url_ = params.probe_url_;
497 warmup_url_ = params.warmup_url_;
498 allowed_ = params.allowed_;
499 fallback_allowed_ = params.fallback_allowed_;
500 alt_allowed_ = params.alt_allowed_;
501 promo_allowed_ = params.promo_allowed_;
502 holdback_ = params.holdback_;
503 configured_on_command_line_ = params.configured_on_command_line_;
504 }
505 return *this;
506 }
507
465 } // namespace data_reduction_proxy 508 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698