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 9ab5fef2530de13b6664a277c92317e6278ad5bc..b56abc65922f3bf0c54e4d2cd02e8e2f0c81e893 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,13 @@ 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); |
+ |
// MessageLoopProxy instance is owned by io_thread. |params| outlives |
// this class instance. |
DataReductionProxyUsageStats( |
@@ -56,12 +65,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); |
@@ -71,6 +78,10 @@ class DataReductionProxyUsageStats |
int net_error); |
private: |
+ friend class DataReductionProxyUsageStatsTest; |
+ FRIEND_TEST_ALL_PREFIXES(DataReductionProxyUsageStatsTest, |
+ RecordMissingViaHeaderBytes); |
+ |
enum BypassedBytesType { |
NOT_BYPASSED = 0, /* Not bypassed. */ |
SSL, /* Bypass due to SSL. */ |
@@ -82,6 +93,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; |