diff options
author | kundaji@chromium.org <kundaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 04:36:20 +0000 |
---|---|---|
committer | kundaji@chromium.org <kundaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-25 04:36:20 +0000 |
commit | bceab7f54c854090b4264ba128bf8f70d0476912 (patch) | |
tree | d789f6702bec91598268b342dd37c04019f3c8f2 /components/data_reduction_proxy/browser/data_reduction_proxy_params.cc | |
parent | 9c388be0afa0ec9d7d177f54faaab9e77deda954 (diff) | |
download | chromium_src-bceab7f54c854090b4264ba128bf8f70d0476912.zip chromium_src-bceab7f54c854090b4264ba128bf8f70d0476912.tar.gz chromium_src-bceab7f54c854090b4264ba128bf8f70d0476912.tar.bz2 |
Display an error message on usage settings page when proxy cannot be contacted.
Add data_reduction_proxy_usage_stats which keeps track of number of requests
completed through data reduction proxy vs number of requests eligible to use
data reduction proxy. Instantiate and set on io thread globals so that we can
pass it to chrome network delegate. Expose isDataReductionProxyUnreachable()
method to Android code through DataReductionProxySettings where it will be
used to decide whether to display the unreachable proxy message.
BUG=380195
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=279222
Review URL: https://codereview.chromium.org/338273003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/data_reduction_proxy/browser/data_reduction_proxy_params.cc')
-rw-r--r-- | components/data_reduction_proxy/browser/data_reduction_proxy_params.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc index ce69157..708f0fd 100644 --- a/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_params.cc @@ -7,7 +7,10 @@ #include "base/command_line.h" #include "base/metrics/field_trial.h" #include "components/data_reduction_proxy/common/data_reduction_proxy_switches.h" +#include "net/proxy/proxy_info.h" +#include "net/proxy/proxy_service.h" #include "net/url_request/url_request.h" +#include "net/url_request/url_request_context.h" using base::FieldTrialList; @@ -277,6 +280,23 @@ bool DataReductionProxyParams::IsDataReductionProxy( return false; } +// TODO(kundaji): Check that the request will actually be sent through the +// proxy. +bool DataReductionProxyParams::IsDataReductionProxyEligible( + const net::URLRequest* request) { + DCHECK(request); + DCHECK(request->context()); + DCHECK(request->context()->proxy_service()); + net::ProxyInfo result; + request->context()->proxy_service()->config().proxy_rules().Apply( + request->url(), &result); + if (!result.proxy_server().is_valid()) + return false; + if (result.proxy_server().is_direct()) + return false; + return IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL); +} + std::string DataReductionProxyParams::GetDefaultKey() const { #if defined(SPDY_PROXY_AUTH_VALUE) return SPDY_PROXY_AUTH_VALUE; |