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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 if (proxy_info) { | 351 if (proxy_info) { |
352 proxy_info->proxy_servers.first = ssl_origin(); | 352 proxy_info->proxy_servers.first = ssl_origin(); |
353 proxy_info->proxy_servers.second = GURL(); | 353 proxy_info->proxy_servers.second = GURL(); |
354 proxy_info->is_ssl = true; | 354 proxy_info->is_ssl = true; |
355 } | 355 } |
356 return true; | 356 return true; |
357 } | 357 } |
358 return false; | 358 return false; |
359 } | 359 } |
360 | 360 |
361 // TODO(kundaji): Check that the request will actually be sent through the | |
362 // proxy. | |
363 bool DataReductionProxyParams::IsDataReductionProxyEligible( | |
364 const net::URLRequest* request) { | |
365 DCHECK(request); | |
366 DCHECK(request->context()); | |
367 DCHECK(request->context()->proxy_service()); | |
368 net::ProxyInfo result; | |
369 request->context()->proxy_service()->config().proxy_rules().Apply( | |
370 request->url(), &result); | |
371 if (!result.proxy_server().is_valid()) | |
372 return false; | |
373 if (result.proxy_server().is_direct()) | |
374 return false; | |
375 return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL); | |
376 } | |
377 | |
378 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules( | 361 bool DataReductionProxyParams::IsBypassedByDataReductionProxyLocalRules( |
379 const net::URLRequest& request, | 362 const net::URLRequest& request, |
380 const net::ProxyConfig& data_reduction_proxy_config) const { | 363 const net::ProxyConfig& data_reduction_proxy_config) const { |
381 DCHECK(request.context()); | 364 DCHECK(request.context()); |
382 DCHECK(request.context()->proxy_service()); | 365 DCHECK(request.context()->proxy_service()); |
383 net::ProxyInfo result; | 366 net::ProxyInfo result; |
384 data_reduction_proxy_config.proxy_rules().Apply( | 367 data_reduction_proxy_config.proxy_rules().Apply( |
385 request.url(), &result); | 368 request.url(), &result); |
386 if (!result.proxy_server().is_valid()) | 369 if (!result.proxy_server().is_valid()) |
387 return true; | 370 return true; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 529 } |
547 | 530 |
548 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { | 531 std::string DataReductionProxyParams::GetDefaultWarmupURL() const { |
549 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) | 532 #if defined(DATA_REDUCTION_PROXY_WARMUP_URL) |
550 return DATA_REDUCTION_PROXY_WARMUP_URL; | 533 return DATA_REDUCTION_PROXY_WARMUP_URL; |
551 #endif | 534 #endif |
552 return std::string(); | 535 return std::string(); |
553 } | 536 } |
554 | 537 |
555 } // namespace data_reduction_proxy | 538 } // namespace data_reduction_proxy |
OLD | NEW |