| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (proxy_info) { | 345 if (proxy_info) { |
| 346 proxy_info->proxy_servers.first = ssl_origin(); | 346 proxy_info->proxy_servers.first = ssl_origin(); |
| 347 proxy_info->proxy_servers.second = GURL(); | 347 proxy_info->proxy_servers.second = GURL(); |
| 348 proxy_info->is_ssl = true; | 348 proxy_info->is_ssl = true; |
| 349 } | 349 } |
| 350 return true; | 350 return true; |
| 351 } | 351 } |
| 352 return false; | 352 return false; |
| 353 } | 353 } |
| 354 | 354 |
| 355 // TODO(kundaji): Check that the request will actually be sent through the | |
| 356 // proxy. | |
| 357 bool DataReductionProxyParams::IsDataReductionProxyEligible( | |
| 358 const net::URLRequest* request) { | |
| 359 DCHECK(request); | |
| 360 DCHECK(request->context()); | |
| 361 DCHECK(request->context()->proxy_service()); | |
| 362 net::ProxyInfo result; | |
| 363 request->context()->proxy_service()->config().proxy_rules().Apply( | |
| 364 request->url(), &result); | |
| 365 if (!result.proxy_server().is_valid()) | |
| 366 return false; | |
| 367 if (result.proxy_server().is_direct()) | |
| 368 return false; | |
| 369 return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL); | |
| 370 } | |
| 371 | |
| 372 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules( | 355 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules( |
| 373 const net::URLRequest& request, | 356 const net::URLRequest& request, |
| 374 const net::ProxyConfig& data_reduction_proxy_config) const { | 357 const net::ProxyConfig& data_reduction_proxy_config) const { |
| 375 DCHECK(request.context()); | 358 DCHECK(request.context()); |
| 376 DCHECK(request.context()->proxy_service()); | 359 DCHECK(request.context()->proxy_service()); |
| 377 net::ProxyInfo result; | 360 net::ProxyInfo result; |
| 378 data_reduction_proxy_config.proxy_rules().Apply( | 361 data_reduction_proxy_config.proxy_rules().Apply( |
| 379 request.url(), &result); | 362 request.url(), &result); |
| 380 if (!result.proxy_server().is_valid()) | 363 if (!result.proxy_server().is_valid()) |
| 381 return true; | 364 return true; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 } | 523 } |
| 541 | 524 |
| 542 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 525 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
| 543 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 526 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) |
| 544 return DATA_REDUCTION_PROXY_WARMUP_URL; | 527 return DATA_REDUCTION_PROXY_WARMUP_URL; |
| 545 #endif | 528 #endif |
| 546 return std::string(); | 529 return std::string(); |
| 547 } | 530 } |
| 548 | 531 |
| 549 } // namespace data_reduction_proxy | 532 } // namespace data_reduction_proxy |
| OLD | NEW |