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(const GURL& url, int load_flags, |
| 149 net::ProxyInfo* result)> OnResolveProxyHandler; |
| 150 |
| 151 void set_on_resolve_proxy_handler(OnResolveProxyHandler* handler) { |
| 152 on_resolve_proxy_handler_ = handler; |
| 153 } |
| 154 |
145 // Adds the Client Hints header to HTTP requests. | 155 // Adds the Client Hints header to HTTP requests. |
146 void SetEnableClientHints(); | 156 void SetEnableClientHints(); |
147 | 157 |
148 // Causes |OnCanThrottleRequest| to always return false, for all | 158 // Causes |OnCanThrottleRequest| to always return false, for all |
149 // instances of this object. | 159 // instances of this object. |
150 static void NeverThrottleRequests(); | 160 static void NeverThrottleRequests(); |
151 | 161 |
152 // Binds the pref members to |pref_service| and moves them to the IO thread. | 162 // Binds the pref members to |pref_service| and moves them to the IO thread. |
153 // |enable_referrers| cannot be NULL, the others can. | 163 // |enable_referrers| cannot be NULL, the others can. |
154 // This method should be called on the UI thread. | 164 // This method should be called on the UI thread. |
(...skipping 16 matching lines...) Expand all Loading... |
171 // responsible for deleting the returned value. | 181 // responsible for deleting the returned value. |
172 base::Value* SessionNetworkStatsInfoToValue() const; | 182 base::Value* SessionNetworkStatsInfoToValue() const; |
173 | 183 |
174 private: | 184 private: |
175 friend class ChromeNetworkDelegateTest; | 185 friend class ChromeNetworkDelegateTest; |
176 | 186 |
177 // NetworkDelegate implementation. | 187 // NetworkDelegate implementation. |
178 virtual int OnBeforeURLRequest(net::URLRequest* request, | 188 virtual int OnBeforeURLRequest(net::URLRequest* request, |
179 const net::CompletionCallback& callback, | 189 const net::CompletionCallback& callback, |
180 GURL* new_url) OVERRIDE; | 190 GURL* new_url) OVERRIDE; |
| 191 virtual void OnResolveProxy( |
| 192 const GURL& url, int load_flags, net::ProxyInfo* result) OVERRIDE; |
181 virtual int OnBeforeSendHeaders(net::URLRequest* request, | 193 virtual int OnBeforeSendHeaders(net::URLRequest* request, |
182 const net::CompletionCallback& callback, | 194 const net::CompletionCallback& callback, |
183 net::HttpRequestHeaders* headers) OVERRIDE; | 195 net::HttpRequestHeaders* headers) OVERRIDE; |
184 virtual void OnBeforeSendProxyHeaders( | 196 virtual void OnBeforeSendProxyHeaders( |
185 net::URLRequest* request, | 197 net::URLRequest* request, |
186 const net::ProxyInfo& proxy_info, | 198 const net::ProxyInfo& proxy_info, |
187 net::HttpRequestHeaders* headers) OVERRIDE; | 199 net::HttpRequestHeaders* headers) OVERRIDE; |
188 virtual void OnSendHeaders(net::URLRequest* request, | 200 virtual void OnSendHeaders(net::URLRequest* request, |
189 const net::HttpRequestHeaders& headers) OVERRIDE; | 201 const net::HttpRequestHeaders& headers) OVERRIDE; |
190 virtual int OnHeadersReceived( | 202 virtual int OnHeadersReceived( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 285 |
274 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. | 286 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. |
275 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 287 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
276 // |data_reduction_proxy_usage_stats_| must outlive this | 288 // |data_reduction_proxy_usage_stats_| must outlive this |
277 // ChromeNetworkDelegate. | 289 // ChromeNetworkDelegate. |
278 data_reduction_proxy::DataReductionProxyUsageStats* | 290 data_reduction_proxy::DataReductionProxyUsageStats* |
279 data_reduction_proxy_usage_stats_; | 291 data_reduction_proxy_usage_stats_; |
280 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | 292 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
281 data_reduction_proxy_auth_request_handler_; | 293 data_reduction_proxy_auth_request_handler_; |
282 | 294 |
| 295 OnResolveProxyHandler* on_resolve_proxy_handler_; |
| 296 |
283 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 297 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
284 }; | 298 }; |
285 | 299 |
286 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 300 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
OLD | NEW |