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

Side by Side Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h

Issue 956223002: Rename DataReductionProxyUsageStats to DataReductionProxyBypassStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 8 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_CORE_BROWSER_DATA_REDUCTION_PROXY_NETWOR K_DELEGATE_H_ 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NETWOR K_DELEGATE_H_
6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NETWOR K_DELEGATE_H_ 6 #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NETWOR K_DELEGATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/gtest_prod_util.h" 9 #include "base/gtest_prod_util.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 25 matching lines...) Expand all
36 class ProxyService; 36 class ProxyService;
37 class URLRequest; 37 class URLRequest;
38 } 38 }
39 39
40 namespace data_reduction_proxy { 40 namespace data_reduction_proxy {
41 41
42 class DataReductionProxyConfig; 42 class DataReductionProxyConfig;
43 class DataReductionProxyConfigurator; 43 class DataReductionProxyConfigurator;
44 class DataReductionProxyIOData; 44 class DataReductionProxyIOData;
45 class DataReductionProxyRequestOptions; 45 class DataReductionProxyRequestOptions;
46 class DataReductionProxyUsageStats; 46 class DataReductionProxyBypassStats;
47 47
48 // DataReductionProxyNetworkDelegate is a LayeredNetworkDelegate that wraps a 48 // DataReductionProxyNetworkDelegate is a LayeredNetworkDelegate that wraps a
49 // NetworkDelegate and adds Data Reduction Proxy specific logic. 49 // NetworkDelegate and adds Data Reduction Proxy specific logic.
50 class DataReductionProxyNetworkDelegate : public net::LayeredNetworkDelegate { 50 class DataReductionProxyNetworkDelegate : public net::LayeredNetworkDelegate {
51 public: 51 public:
52 // Provides an additional proxy configuration that can be consulted after 52 // Provides an additional proxy configuration that can be consulted after
53 // proxy resolution. Used to get the Data Reduction Proxy config and give it 53 // proxy resolution. Used to get the Data Reduction Proxy config and give it
54 // to the OnResolveProxyHandler and RecordBytesHistograms. 54 // to the OnResolveProxyHandler and RecordBytesHistograms.
55 typedef base::Callback<const net::ProxyConfig&()> ProxyConfigGetter; 55 typedef base::Callback<const net::ProxyConfig&()> ProxyConfigGetter;
56 56
57 // Constructs a DataReductionProxyNetworkdelegate object with the given 57 // Constructs a DataReductionProxyNetworkdelegate object with the given
58 // |network_delegate|, |config|, |handler|, and |getter|. Takes ownership of 58 // |network_delegate|, |config|, |handler|, and |getter|. Takes ownership of
59 // and wraps the |network_delegate|, calling an internal implementation for 59 // and wraps the |network_delegate|, calling an internal implementation for
60 // each delegate method. For example, the implementation of 60 // each delegate method. For example, the implementation of
61 // OnHeadersReceived() calls OnHeadersReceivedInternal(). 61 // OnHeadersReceived() calls OnHeadersReceivedInternal().
62 DataReductionProxyNetworkDelegate( 62 DataReductionProxyNetworkDelegate(
63 scoped_ptr<net::NetworkDelegate> network_delegate, 63 scoped_ptr<net::NetworkDelegate> network_delegate,
64 DataReductionProxyConfig* config, 64 DataReductionProxyConfig* config,
65 DataReductionProxyRequestOptions* handler, 65 DataReductionProxyRequestOptions* handler,
66 const DataReductionProxyConfigurator* configurator); 66 const DataReductionProxyConfigurator* configurator);
67 ~DataReductionProxyNetworkDelegate() override; 67 ~DataReductionProxyNetworkDelegate() override;
68 68
69 // Initializes member variables to record data reduction proxy prefs and 69 // Initializes member variables to record data reduction proxy prefs and
70 // report UMA. 70 // report UMA.
71 void InitIODataAndUMA( 71 void InitIODataAndUMA(
72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 72 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
73 DataReductionProxyIOData* io_data, 73 DataReductionProxyIOData* io_data,
74 BooleanPrefMember* data_reduction_proxy_enabled, 74 BooleanPrefMember* data_reduction_proxy_enabled,
75 DataReductionProxyUsageStats* usage_stats); 75 DataReductionProxyBypassStats* bypass_stats);
76 76
77 // Creates a |Value| summary of the state of the network session. The caller 77 // Creates a |Value| summary of the state of the network session. The caller
78 // is responsible for deleting the returned value. 78 // is responsible for deleting the returned value.
79 base::Value* SessionNetworkStatsInfoToValue() const; 79 base::Value* SessionNetworkStatsInfoToValue() const;
80 80
81 private: 81 private:
82 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyNetworkDelegateTest, TotalLengths); 82 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyNetworkDelegateTest, TotalLengths);
83 83
84 // Called as the proxy is being resolved for |url|. Allows the delegate to 84 // Called as the proxy is being resolved for |url|. Allows the delegate to
85 // override the proxy resolution decision made by ProxyService. The delegate 85 // override the proxy resolution decision made by ProxyService. The delegate
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 // Total original size of all content before it was transferred. 133 // Total original size of all content before it was transferred.
134 int64 original_content_length_; 134 int64 original_content_length_;
135 135
136 // Weak, owned by our owner. 136 // Weak, owned by our owner.
137 BooleanPrefMember* data_reduction_proxy_enabled_; 137 BooleanPrefMember* data_reduction_proxy_enabled_;
138 138
139 // All raw Data Reduction Proxy pointers must outlive |this|. 139 // All raw Data Reduction Proxy pointers must outlive |this|.
140 DataReductionProxyConfig* data_reduction_proxy_config_; 140 DataReductionProxyConfig* data_reduction_proxy_config_;
141 141
142 DataReductionProxyUsageStats* data_reduction_proxy_usage_stats_; 142 DataReductionProxyBypassStats* data_reduction_proxy_bypass_stats_;
143 143
144 DataReductionProxyRequestOptions* data_reduction_proxy_request_options_; 144 DataReductionProxyRequestOptions* data_reduction_proxy_request_options_;
145 145
146 DataReductionProxyIOData* data_reduction_proxy_io_data_; 146 DataReductionProxyIOData* data_reduction_proxy_io_data_;
147 147
148 const DataReductionProxyConfigurator* configurator_; 148 const DataReductionProxyConfigurator* configurator_;
149 149
150 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyNetworkDelegate); 150 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyNetworkDelegate);
151 }; 151 };
152 152
153 // Adds data reduction proxies to |result|, where applicable, if result 153 // Adds data reduction proxies to |result|, where applicable, if result
154 // otherwise uses a direct connection for |url|, and the data reduction proxy is 154 // otherwise uses a direct connection for |url|, and the data reduction proxy is
155 // not bypassed. Also, configures |result| to proceed directly to the origin if 155 // not bypassed. Also, configures |result| to proceed directly to the origin if
156 // |result|'s current proxy is the data reduction proxy, the 156 // |result|'s current proxy is the data reduction proxy, the
157 // |net::LOAD_BYPASS_DATA_REDUCTION_PROXY| |load_flag| is set, and the 157 // |net::LOAD_BYPASS_DATA_REDUCTION_PROXY| |load_flag| is set, and the
158 // DataCompressionProxyCriticalBypass Finch trial is set. 158 // DataCompressionProxyCriticalBypass Finch trial is set.
159 void OnResolveProxyHandler(const GURL& url, 159 void OnResolveProxyHandler(const GURL& url,
160 int load_flags, 160 int load_flags,
161 const net::ProxyConfig& data_reduction_proxy_config, 161 const net::ProxyConfig& data_reduction_proxy_config,
162 const net::ProxyRetryInfoMap& proxy_retry_info, 162 const net::ProxyRetryInfoMap& proxy_retry_info,
163 const DataReductionProxyConfig* config, 163 const DataReductionProxyConfig* config,
164 net::ProxyInfo* result); 164 net::ProxyInfo* result);
165 165
166 } // namespace data_reduction_proxy 166 } // namespace data_reduction_proxy
167 167
168 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NET WORK_DELEGATE_H_ 168 #endif // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_NET WORK_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698