Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 data_reduction_proxy_usage_stats_ = usage_stats; | 135 data_reduction_proxy_usage_stats_ = usage_stats; |
| 136 } | 136 } |
| 137 | 137 |
| 138 // |data_reduction_proxy_auth_request_handler_| must outlive this | 138 // |data_reduction_proxy_auth_request_handler_| must outlive this |
| 139 // ChromeNetworkDelegate. | 139 // ChromeNetworkDelegate. |
| 140 void set_data_reduction_proxy_auth_request_handler( | 140 void set_data_reduction_proxy_auth_request_handler( |
| 141 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) { | 141 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) { |
| 142 data_reduction_proxy_auth_request_handler_ = handler; | 142 data_reduction_proxy_auth_request_handler_ = handler; |
| 143 } | 143 } |
| 144 | 144 |
| 145 // Provides an opportunity to interpose on proxy resolution. Called before | |
| 146 // ProxyService.ResolveProxy() returns. |proxy_info| contains information | |
| 147 // about the proxy being used, and may be modified by this callback. | |
| 148 typedef base::Callback<void( | |
| 149 const GURL& url, | |
| 150 int load_flags, | |
| 151 const data_reduction_proxy::DataReductionProxyParams* params, | |
| 152 net::ProxyInfo* result)> OnResolveProxyHandler; | |
|
mmenke
2014/07/07 20:21:59
nit: Per Google style guide, typedefs (and enums)
rcs
2014/07/07 22:08:49
Done.
| |
| 153 | |
| 154 void set_on_resolve_proxy_handler(OnResolveProxyHandler* handler) { | |
| 155 on_resolve_proxy_handler_ = handler; | |
| 156 } | |
| 157 | |
| 145 // Adds the Client Hints header to HTTP requests. | 158 // Adds the Client Hints header to HTTP requests. |
| 146 void SetEnableClientHints(); | 159 void SetEnableClientHints(); |
| 147 | 160 |
| 148 // Causes |OnCanThrottleRequest| to always return false, for all | 161 // Causes |OnCanThrottleRequest| to always return false, for all |
| 149 // instances of this object. | 162 // instances of this object. |
| 150 static void NeverThrottleRequests(); | 163 static void NeverThrottleRequests(); |
| 151 | 164 |
| 152 // Binds the pref members to |pref_service| and moves them to the IO thread. | 165 // Binds the pref members to |pref_service| and moves them to the IO thread. |
| 153 // |enable_referrers| cannot be NULL, the others can. | 166 // |enable_referrers| cannot be NULL, the others can. |
| 154 // This method should be called on the UI thread. | 167 // This method should be called on the UI thread. |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 171 // responsible for deleting the returned value. | 184 // responsible for deleting the returned value. |
| 172 base::Value* SessionNetworkStatsInfoToValue() const; | 185 base::Value* SessionNetworkStatsInfoToValue() const; |
| 173 | 186 |
| 174 private: | 187 private: |
| 175 friend class ChromeNetworkDelegateTest; | 188 friend class ChromeNetworkDelegateTest; |
| 176 | 189 |
| 177 // NetworkDelegate implementation. | 190 // NetworkDelegate implementation. |
| 178 virtual int OnBeforeURLRequest(net::URLRequest* request, | 191 virtual int OnBeforeURLRequest(net::URLRequest* request, |
| 179 const net::CompletionCallback& callback, | 192 const net::CompletionCallback& callback, |
| 180 GURL* new_url) OVERRIDE; | 193 GURL* new_url) OVERRIDE; |
| 194 virtual void OnResolveProxy( | |
| 195 const GURL& url, int load_flags, net::ProxyInfo* result) OVERRIDE; | |
| 181 virtual int OnBeforeSendHeaders(net::URLRequest* request, | 196 virtual int OnBeforeSendHeaders(net::URLRequest* request, |
| 182 const net::CompletionCallback& callback, | 197 const net::CompletionCallback& callback, |
| 183 net::HttpRequestHeaders* headers) OVERRIDE; | 198 net::HttpRequestHeaders* headers) OVERRIDE; |
| 184 virtual void OnBeforeSendProxyHeaders( | 199 virtual void OnBeforeSendProxyHeaders( |
| 185 net::URLRequest* request, | 200 net::URLRequest* request, |
| 186 const net::ProxyInfo& proxy_info, | 201 const net::ProxyInfo& proxy_info, |
| 187 net::HttpRequestHeaders* headers) OVERRIDE; | 202 net::HttpRequestHeaders* headers) OVERRIDE; |
| 188 virtual void OnSendHeaders(net::URLRequest* request, | 203 virtual void OnSendHeaders(net::URLRequest* request, |
| 189 const net::HttpRequestHeaders& headers) OVERRIDE; | 204 const net::HttpRequestHeaders& headers) OVERRIDE; |
| 190 virtual int OnHeadersReceived( | 205 virtual int OnHeadersReceived( |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 | 288 |
| 274 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. | 289 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. |
| 275 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 290 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
| 276 // |data_reduction_proxy_usage_stats_| must outlive this | 291 // |data_reduction_proxy_usage_stats_| must outlive this |
| 277 // ChromeNetworkDelegate. | 292 // ChromeNetworkDelegate. |
| 278 data_reduction_proxy::DataReductionProxyUsageStats* | 293 data_reduction_proxy::DataReductionProxyUsageStats* |
| 279 data_reduction_proxy_usage_stats_; | 294 data_reduction_proxy_usage_stats_; |
| 280 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | 295 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
| 281 data_reduction_proxy_auth_request_handler_; | 296 data_reduction_proxy_auth_request_handler_; |
| 282 | 297 |
| 298 OnResolveProxyHandler* on_resolve_proxy_handler_; | |
|
mmenke
2014/07/07 20:21:59
Suggest not making this a pointer. Callbacks have
rcs
2014/07/07 22:08:49
Done.
| |
| 299 | |
| 283 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 300 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 284 }; | 301 }; |
| 285 | 302 |
| 286 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 303 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |