OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/data_reduction_proxy_conf
ig.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 } | 637 } |
638 } | 638 } |
639 | 639 |
640 void DataReductionProxyConfig::HandleSecureProxyCheckResponse( | 640 void DataReductionProxyConfig::HandleSecureProxyCheckResponse( |
641 const std::string& response, | 641 const std::string& response, |
642 const net::URLRequestStatus& status, | 642 const net::URLRequestStatus& status, |
643 int http_response_code) { | 643 int http_response_code) { |
644 bool success_response = | 644 bool success_response = |
645 base::StartsWith(response, "OK", base::CompareCase::SENSITIVE); | 645 base::StartsWith(response, "OK", base::CompareCase::SENSITIVE); |
646 if (event_creator_) | 646 if (event_creator_) |
647 event_creator_->EndSecureProxyCheck(bound_net_log_, status.error(), | 647 event_creator_->EndSecureProxyCheck(net_log_with_source_, status.error(), |
648 http_response_code, success_response); | 648 http_response_code, success_response); |
649 | 649 |
650 if (!status.is_success()) { | 650 if (!status.is_success()) { |
651 if (status.error() == net::ERR_INTERNET_DISCONNECTED) { | 651 if (status.error() == net::ERR_INTERNET_DISCONNECTED) { |
652 RecordSecureProxyCheckFetchResult(INTERNET_DISCONNECTED); | 652 RecordSecureProxyCheckFetchResult(INTERNET_DISCONNECTED); |
653 return; | 653 return; |
654 } | 654 } |
655 // TODO(bengr): Remove once we understand the reasons secure proxy checks | 655 // TODO(bengr): Remove once we understand the reasons secure proxy checks |
656 // are failing. Secure proxy check errors are either due to fetcher-level | 656 // are failing. Secure proxy check errors are either due to fetcher-level |
657 // errors or modified responses. This only tracks the former. | 657 // errors or modified responses. This only tracks the former. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 | 747 |
748 void DataReductionProxyConfig::RecordSecureProxyCheckFetchResult( | 748 void DataReductionProxyConfig::RecordSecureProxyCheckFetchResult( |
749 SecureProxyCheckFetchResult result) { | 749 SecureProxyCheckFetchResult result) { |
750 UMA_HISTOGRAM_ENUMERATION(kUMAProxyProbeURL, result, | 750 UMA_HISTOGRAM_ENUMERATION(kUMAProxyProbeURL, result, |
751 SECURE_PROXY_CHECK_FETCH_RESULT_COUNT); | 751 SECURE_PROXY_CHECK_FETCH_RESULT_COUNT); |
752 } | 752 } |
753 | 753 |
754 void DataReductionProxyConfig::SecureProxyCheck( | 754 void DataReductionProxyConfig::SecureProxyCheck( |
755 const GURL& secure_proxy_check_url, | 755 const GURL& secure_proxy_check_url, |
756 FetcherResponseCallback fetcher_callback) { | 756 FetcherResponseCallback fetcher_callback) { |
757 bound_net_log_ = net::BoundNetLog::Make( | 757 net_log_with_source_ = net::NetLogWithSource::Make( |
758 net_log_, net::NetLogSourceType::DATA_REDUCTION_PROXY); | 758 net_log_, net::NetLogSourceType::DATA_REDUCTION_PROXY); |
759 if (event_creator_) { | 759 if (event_creator_) { |
760 event_creator_->BeginSecureProxyCheck( | 760 event_creator_->BeginSecureProxyCheck( |
761 bound_net_log_, config_values_->secure_proxy_check_url()); | 761 net_log_with_source_, config_values_->secure_proxy_check_url()); |
762 } | 762 } |
763 | 763 |
764 secure_proxy_checker_->CheckIfSecureProxyIsAllowed(secure_proxy_check_url, | 764 secure_proxy_checker_->CheckIfSecureProxyIsAllowed(secure_proxy_check_url, |
765 fetcher_callback); | 765 fetcher_callback); |
766 } | 766 } |
767 | 767 |
768 void DataReductionProxyConfig::SetLoFiModeOff() { | 768 void DataReductionProxyConfig::SetLoFiModeOff() { |
769 DCHECK(thread_checker_.CalledOnValidThread()); | 769 DCHECK(thread_checker_.CalledOnValidThread()); |
770 lofi_off_ = true; | 770 lofi_off_ = true; |
771 } | 771 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 net::ProxyConfig DataReductionProxyConfig::ProxyConfigIgnoringHoldback() const { | 934 net::ProxyConfig DataReductionProxyConfig::ProxyConfigIgnoringHoldback() const { |
935 std::vector<net::ProxyServer> proxies_for_http = | 935 std::vector<net::ProxyServer> proxies_for_http = |
936 config_values_->proxies_for_http(); | 936 config_values_->proxies_for_http(); |
937 if (!enabled_by_user_ || proxies_for_http.empty()) | 937 if (!enabled_by_user_ || proxies_for_http.empty()) |
938 return net::ProxyConfig::CreateDirect(); | 938 return net::ProxyConfig::CreateDirect(); |
939 return configurator_->CreateProxyConfig(!secure_proxy_allowed_, | 939 return configurator_->CreateProxyConfig(!secure_proxy_allowed_, |
940 proxies_for_http); | 940 proxies_for_http); |
941 } | 941 } |
942 | 942 |
943 } // namespace data_reduction_proxy | 943 } // namespace data_reduction_proxy |
OLD | NEW |