| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h
|
| similarity index 81%
|
| rename from components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h
|
| rename to components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h
|
| index e65fedbb6ef67b8f04a1294b8fcffdad1f6e0f2b..0073bcf37e0d79d42113b377491bf6b3c91176ee 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_
|
| -#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_
|
| +#ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_STATS_H_
|
| +#define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_STATS_H_
|
|
|
| #include "base/callback.h"
|
| #include "base/prefs/pref_member.h"
|
| @@ -24,8 +24,7 @@ namespace data_reduction_proxy {
|
|
|
| class DataReductionProxyConfig;
|
|
|
| -// TODO(bengr): Rename as DataReductionProxyBypassStats.
|
| -class DataReductionProxyUsageStats
|
| +class DataReductionProxyBypassStats
|
| : public net::NetworkChangeNotifier::NetworkChangeObserver {
|
| public:
|
| typedef base::Callback<void(bool /* unreachable */)> UnreachableCallback;
|
| @@ -50,15 +49,15 @@ class DataReductionProxyUsageStats
|
| // hook to inform the user that the Data Reduction Proxy is unreachable, which
|
| // occurs on the UI thread, hence the |ui_task_runner|.
|
| // |config| must not be null.
|
| - DataReductionProxyUsageStats(
|
| + DataReductionProxyBypassStats(
|
| DataReductionProxyConfig* config,
|
| UnreachableCallback unreachable_callback,
|
| const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner);
|
|
|
| - ~DataReductionProxyUsageStats() override;
|
| + ~DataReductionProxyBypassStats() override;
|
|
|
| // Callback intended to be called from |DataReductionProxyNetworkDelegate|
|
| - // when a request completes. This method is used to gather usage stats.
|
| + // when a request completes. This method is used to gather bypass stats.
|
| void OnUrlRequestCompleted(const net::URLRequest* request, bool started);
|
|
|
| // Records the last bypass reason to |bypass_type_| and sets
|
| @@ -78,28 +77,26 @@ class DataReductionProxyUsageStats
|
|
|
| // Called by |ChromeNetworkDelegate| when a proxy is put into the bad proxy
|
| // list. Used to track when the data reduction proxy falls back.
|
| - void OnProxyFallback(const net::ProxyServer& bypassed_proxy,
|
| - int net_error);
|
| + void OnProxyFallback(const net::ProxyServer& bypassed_proxy, int net_error);
|
|
|
| // Called by |ChromeNetworkDelegate| when an HTTP connect has been called.
|
| // Used to track proxy connection failures.
|
| - void OnConnectComplete(const net::HostPortPair& proxy_server,
|
| - int net_error);
|
| + void OnConnectComplete(const net::HostPortPair& proxy_server, int net_error);
|
|
|
| private:
|
| - friend class DataReductionProxyUsageStatsTest;
|
| - FRIEND_TEST_ALL_PREFIXES(DataReductionProxyUsageStatsTest,
|
| + friend class DataReductionProxyBypassStatsTest;
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyBypassStatsTest,
|
| RecordMissingViaHeaderBytes);
|
|
|
| enum BypassedBytesType {
|
| - NOT_BYPASSED = 0, /* Not bypassed. */
|
| - SSL, /* Bypass due to SSL. */
|
| - LOCAL_BYPASS_RULES, /* Bypass due to client-side bypass rules. */
|
| - PROXY_OVERRIDDEN, /* Bypass due to a proxy taking precedence. */
|
| - AUDIO_VIDEO, /* Audio/Video bypass. */
|
| - TRIGGERING_REQUEST, /* Triggering request bypass. */
|
| - NETWORK_ERROR, /* Network error. */
|
| - BYPASSED_BYTES_TYPE_MAX /* This must always be last.*/
|
| + NOT_BYPASSED = 0, /* Not bypassed. */
|
| + SSL, /* Bypass due to SSL. */
|
| + LOCAL_BYPASS_RULES, /* Bypass due to client-side bypass rules. */
|
| + PROXY_OVERRIDDEN, /* Bypass due to a proxy taking precedence. */
|
| + AUDIO_VIDEO, /* Audio/Video bypass. */
|
| + TRIGGERING_REQUEST, /* Triggering request bypass. */
|
| + NETWORK_ERROR, /* Network error. */
|
| + BYPASSED_BYTES_TYPE_MAX /* This must always be last.*/
|
| };
|
|
|
| // Given |data_reduction_proxy_enabled|, a |request|, and the
|
| @@ -131,10 +128,9 @@ class DataReductionProxyUsageStats
|
| void NotifyUnavailabilityIfChanged();
|
| void NotifyUnavailabilityOnUIThread(bool unavailable);
|
|
|
| - void RecordBypassedBytes(
|
| - DataReductionProxyBypassType bypass_type,
|
| - BypassedBytesType bypassed_bytes_type,
|
| - int64 content_length);
|
| + void RecordBypassedBytes(DataReductionProxyBypassType bypass_type,
|
| + BypassedBytesType bypassed_bytes_type,
|
| + int64 content_length);
|
|
|
| DataReductionProxyConfig* data_reduction_proxy_config_;
|
|
|
| @@ -165,9 +161,9 @@ class DataReductionProxyUsageStats
|
|
|
| base::ThreadChecker thread_checker_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats);
|
| + DISALLOW_COPY_AND_ASSIGN(DataReductionProxyBypassStats);
|
| };
|
|
|
| } // namespace data_reduction_proxy
|
|
|
| -#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_
|
| +#endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_BYPASS_STATS_H_
|
|
|