| OLD | NEW |
| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 } | 110 } |
| 111 | 111 |
| 112 DataReductionProxyParams::~DataReductionProxyParams() { | 112 DataReductionProxyParams::~DataReductionProxyParams() { |
| 113 } | 113 } |
| 114 | 114 |
| 115 DataReductionProxyParams::DataReductionProxyList | 115 DataReductionProxyParams::DataReductionProxyList |
| 116 DataReductionProxyParams::GetAllowedProxies() const { | 116 DataReductionProxyParams::GetAllowedProxies() const { |
| 117 DataReductionProxyList list; | 117 DataReductionProxyList list; |
| 118 if (allowed_) { | 118 if (allowed_) { |
| 119 list.push_back(origin_); | 119 list.push_back(origin_); |
| 120 // TODO(bolian): revert this once the proxy PAC fix is ready. | |
| 121 if (GURL(GetDefaultDevOrigin()) == origin()) { | |
| 122 list.push_back(GURL(GetDefaultOrigin())); | |
| 123 } | |
| 124 } | 120 } |
| 125 if (allowed_ && fallback_allowed_) | 121 if (allowed_ && fallback_allowed_) |
| 126 list.push_back(fallback_origin_); | 122 list.push_back(fallback_origin_); |
| 127 if (alt_allowed_) { | 123 if (alt_allowed_) { |
| 128 list.push_back(alt_origin_); | 124 list.push_back(alt_origin_); |
| 129 list.push_back(ssl_origin_); | 125 list.push_back(ssl_origin_); |
| 130 } | 126 } |
| 131 if (alt_allowed_ && fallback_allowed_) | 127 if (alt_allowed_ && fallback_allowed_) |
| 132 list.push_back(alt_fallback_origin_); | 128 list.push_back(alt_fallback_origin_); |
| 133 return list; | 129 return list; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 DataReductionProxyTypeInfo* proxy_info) const { | 285 DataReductionProxyTypeInfo* proxy_info) const { |
| 290 if (net::HostPortPair::FromURL(origin()).Equals(host_port_pair)) { | 286 if (net::HostPortPair::FromURL(origin()).Equals(host_port_pair)) { |
| 291 if (proxy_info) { | 287 if (proxy_info) { |
| 292 proxy_info->proxy_servers.first = origin(); | 288 proxy_info->proxy_servers.first = origin(); |
| 293 if (fallback_allowed()) | 289 if (fallback_allowed()) |
| 294 proxy_info->proxy_servers.second = fallback_origin(); | 290 proxy_info->proxy_servers.second = fallback_origin(); |
| 295 } | 291 } |
| 296 return true; | 292 return true; |
| 297 } | 293 } |
| 298 | 294 |
| 299 // TODO(bolian): revert this once the proxy PAC fix is ready. | |
| 300 // | |
| 301 // If dev host is configured as the primary proxy, we treat the default | |
| 302 // origin as a valid data reduction proxy to workaround PAC script. | |
| 303 if (GURL(GetDefaultDevOrigin()) == origin()) { | |
| 304 const GURL& default_origin = GURL(GetDefaultOrigin()); | |
| 305 if (net::HostPortPair::FromURL(default_origin).Equals(host_port_pair)) { | |
| 306 if (proxy_info) { | |
| 307 proxy_info->proxy_servers.first = default_origin; | |
| 308 if (fallback_allowed()) | |
| 309 proxy_info->proxy_servers.second = fallback_origin(); | |
| 310 } | |
| 311 return true; | |
| 312 } | |
| 313 } | |
| 314 | |
| 315 if (fallback_allowed() && | 295 if (fallback_allowed() && |
| 316 net::HostPortPair::FromURL(fallback_origin()).Equals(host_port_pair)) { | 296 net::HostPortPair::FromURL(fallback_origin()).Equals(host_port_pair)) { |
| 317 if (proxy_info) { | 297 if (proxy_info) { |
| 318 proxy_info->proxy_servers.first = fallback_origin(); | 298 proxy_info->proxy_servers.first = fallback_origin(); |
| 319 proxy_info->proxy_servers.second = GURL(); | 299 proxy_info->proxy_servers.second = GURL(); |
| 320 proxy_info->is_fallback = true; | 300 proxy_info->is_fallback = true; |
| 321 } | 301 } |
| 322 return true; | 302 return true; |
| 323 } | 303 } |
| 324 if (net::HostPortPair::FromURL(alt_origin()).Equals(host_port_pair)) { | 304 if (net::HostPortPair::FromURL(alt_origin()).Equals(host_port_pair)) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 } | 520 } |
| 541 | 521 |
| 542 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 522 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
| 543 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 523 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) |
| 544 return DATA_REDUCTION_PROXY_WARMUP_URL; | 524 return DATA_REDUCTION_PROXY_WARMUP_URL; |
| 545 #endif | 525 #endif |
| 546 return std::string(); | 526 return std::string(); |
| 547 } | 527 } |
| 548 | 528 |
| 549 } // namespace data_reduction_proxy | 529 } // namespace data_reduction_proxy |
| OLD | NEW |