Chromium Code Reviews| Index: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
| diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
| index 33fd29e560fa2f533fa044f1c3be60a83537c599..daeafb68673275572bb7e58c18a3b3ba93f1a0b5 100644 |
| --- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
| +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
| @@ -16,6 +16,8 @@ |
| #include "net/url_request/url_request.h" |
| namespace net { |
| +class HttpResponseHeaders; |
| +class ProxyConfig; |
| class ProxyServer; |
| } |
| @@ -33,6 +35,12 @@ class DataReductionProxyUsageStats |
| const net::ProxyServer& proxy_server, |
| DataReductionProxyBypassType bypass_type); |
| + // For the given response |headers| that are expected to include the data |
| + // reduction proxy via header, records response code UMA if the data reduction |
| + // proxy via header is not present. |
| + static void DetectAndRecordMissingViaHeaderResponseCode( |
| + bool is_primary, const net::HttpResponseHeaders* headers); |
|
Alexei Svitkine (slow)
2014/09/23 15:12:13
Nit: 1 param per line if first one is wrapped.
sclittle
2014/09/23 18:13:41
Done.
|
| + |
| // MessageLoopProxy instance is owned by io_thread. |params| outlives |
| // this class instance. |
| DataReductionProxyUsageStats(DataReductionProxyParams* params, |
| @@ -55,12 +63,10 @@ class DataReductionProxyUsageStats |
| // cause the current bypass. |
| void SetBypassType(DataReductionProxyBypassType type); |
| - // Given |data_reduction_proxy_enabled|, a |request|, and the |
| - // |data_reduction_proxy_config| records the number of bypassed bytes for that |
| - // |request| into UMAs based on bypass type. |data_reduction_proxy_enabled| |
| - // tells us the state of the kDataReductionProxyEnabled preference. |
| - void RecordBypassedBytesHistograms( |
| - net::URLRequest& request, |
| + // Records all the data reduction proxy bytes-related histograms for the |
| + // completed URLRequest |request|. |
| + void RecordBytesHistograms( |
| + net::URLRequest* request, |
| const BooleanPrefMember& data_reduction_proxy_enabled, |
| const net::ProxyConfig& data_reduction_proxy_config); |
| @@ -68,6 +74,10 @@ class DataReductionProxyUsageStats |
| int net_error) const; |
| private: |
| + friend class DataReductionProxyUsageStatsTest; |
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyUsageStatsTest, |
| + RecordMissingViaHeaderBytes); |
| + |
| enum BypassedBytesType { |
| NOT_BYPASSED = 0, /* Not bypassed. */ |
| SSL, /* Bypass due to SSL. */ |
| @@ -79,6 +89,20 @@ class DataReductionProxyUsageStats |
| BYPASSED_BYTES_TYPE_MAX /* This must always be last.*/ |
| }; |
| + // Given |data_reduction_proxy_enabled|, a |request|, and the |
| + // |data_reduction_proxy_config| records the number of bypassed bytes for that |
| + // |request| into UMAs based on bypass type. |data_reduction_proxy_enabled| |
| + // tells us the state of the kDataReductionProxyEnabled preference. |
| + void RecordBypassedBytesHistograms( |
| + net::URLRequest* request, |
| + const BooleanPrefMember& data_reduction_proxy_enabled, |
| + const net::ProxyConfig& data_reduction_proxy_config); |
| + |
| + // Records UMA of the number of response bytes of responses that are expected |
| + // to have the data reduction proxy via header, but where the data reduction |
| + // proxy via header is not present. |
| + void RecordMissingViaHeaderBytes(net::URLRequest* request); |
| + |
| // NetworkChangeNotifier::NetworkChangeObserver: |
| virtual void OnNetworkChanged( |
| net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |