Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1897)

Side by Side Diff: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h

Issue 510353004: Fixing DataReductionProxy.BypassedBytes.LocalBypassRules (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed bengr comments Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS _H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS _H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS _H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS _H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/prefs/pref_member.h" 10 #include "base/prefs/pref_member.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 // Callback intended to be called from |ChromeNetworkDelegate| when a 49 // Callback intended to be called from |ChromeNetworkDelegate| when a
50 // request completes. This method is used to gather usage stats. 50 // request completes. This method is used to gather usage stats.
51 void OnUrlRequestCompleted(const net::URLRequest* request, bool started); 51 void OnUrlRequestCompleted(const net::URLRequest* request, bool started);
52 52
53 // Records the last bypass reason to |bypass_type_| and sets 53 // Records the last bypass reason to |bypass_type_| and sets
54 // |triggering_request_| to true. A triggering request is the first request to 54 // |triggering_request_| to true. A triggering request is the first request to
55 // cause the current bypass. 55 // cause the current bypass.
56 void SetBypassType(DataReductionProxyBypassType type); 56 void SetBypassType(DataReductionProxyBypassType type);
57 57
58 // Given the |content_length| and associated |request|, records the 58 // Given the |content_length|, associated |request|, and the
59 // number of bypassed bytes for that |request| into UMAs based on bypass type. 59 // |data_reduction_proxy_config| records the number of bypassed bytes for that
60 // |data_reduction_proxy_enabled| tells us the state of the 60 // |request| into UMAs based on bypass type. |data_reduction_proxy_enabled|
61 // kDataReductionProxyEnabled preference. 61 // tells us the state of the kDataReductionProxyEnabled preference.
62 void RecordBypassedBytesHistograms( 62 void RecordBypassedBytesHistograms(
63 net::URLRequest& request, 63 net::URLRequest& request,
64 const BooleanPrefMember& data_reduction_proxy_enabled); 64 const BooleanPrefMember& data_reduction_proxy_enabled,
65 const net::ProxyConfig& data_reduction_proxy_config);
65 66
66 void RecordBypassEventHistograms(const net::ProxyServer& bypassed_proxy, 67 void RecordBypassEventHistograms(const net::ProxyServer& bypassed_proxy,
67 int net_error) const; 68 int net_error) const;
68 69
69 private: 70 private:
70 enum BypassedBytesType { 71 enum BypassedBytesType {
71 NOT_BYPASSED = 0, /* Not bypassed. */ 72 NOT_BYPASSED = 0, /* Not bypassed. */
72 SSL, /* Bypass due to SSL. */ 73 SSL, /* Bypass due to SSL. */
73 LOCAL_BYPASS_RULES, /* Bypass due to client-side bypass rules. */ 74 LOCAL_BYPASS_RULES, /* Bypass due to client-side bypass rules. */
75 MANAGED_PROXY_CONFIG, /* Bypass due to managed config. */
bengr 2014/09/02 05:11:38 indent of comment.
megjablon 2014/09/02 21:00:16 Done.
74 AUDIO_VIDEO, /* Audio/Video bypass. */ 76 AUDIO_VIDEO, /* Audio/Video bypass. */
75 TRIGGERING_REQUEST, /* Triggering request bypass. */ 77 TRIGGERING_REQUEST, /* Triggering request bypass. */
76 NETWORK_ERROR, /* Network error. */ 78 NETWORK_ERROR, /* Network error. */
77 BYPASSED_BYTES_TYPE_MAX /* This must always be last.*/ 79 BYPASSED_BYTES_TYPE_MAX /* This must always be last.*/
78 }; 80 };
79 81
80 // NetworkChangeNotifier::NetworkChangeObserver: 82 // NetworkChangeNotifier::NetworkChangeObserver:
81 virtual void OnNetworkChanged( 83 virtual void OnNetworkChanged(
82 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 84 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
83 85
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 131
130 // Called when the unavailability status has changed. Runs on the UI thread. 132 // Called when the unavailability status has changed. Runs on the UI thread.
131 base::Callback<void(bool)> unavailable_callback_; 133 base::Callback<void(bool)> unavailable_callback_;
132 134
133 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); 135 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats);
134 }; 136 };
135 137
136 } // namespace data_reduction_proxy 138 } // namespace data_reduction_proxy
137 139
138 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_ST ATS_H_ 140 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_ST ATS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698