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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 } // namespace domain_reliability | 45 } // namespace domain_reliability |
46 | 46 |
47 namespace extensions { | 47 namespace extensions { |
48 class EventRouterForwarder; | 48 class EventRouterForwarder; |
49 class InfoMap; | 49 class InfoMap; |
50 } | 50 } |
51 | 51 |
52 namespace net { | 52 namespace net { |
53 class ProxyInfo; | 53 class ProxyInfo; |
54 class URLRequest; | 54 class URLRequest; |
55 class ProxyInfo; | |
mmenke
2014/07/01 19:45:12
nit: Already forward declared.
rcs
2014/07/02 00:56:20
Done.
| |
55 } | 56 } |
56 | 57 |
57 namespace policy { | 58 namespace policy { |
58 class URLBlacklistManager; | 59 class URLBlacklistManager; |
59 } | 60 } |
60 | 61 |
61 namespace prerender { | 62 namespace prerender { |
62 class PrerenderTracker; | 63 class PrerenderTracker; |
63 } | 64 } |
64 | 65 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 data_reduction_proxy_usage_stats_ = usage_stats; | 136 data_reduction_proxy_usage_stats_ = usage_stats; |
136 } | 137 } |
137 | 138 |
138 // |data_reduction_proxy_auth_request_handler_| must outlive this | 139 // |data_reduction_proxy_auth_request_handler_| must outlive this |
139 // ChromeNetworkDelegate. | 140 // ChromeNetworkDelegate. |
140 void set_data_reduction_proxy_auth_request_handler( | 141 void set_data_reduction_proxy_auth_request_handler( |
141 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) { | 142 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) { |
142 data_reduction_proxy_auth_request_handler_ = handler; | 143 data_reduction_proxy_auth_request_handler_ = handler; |
143 } | 144 } |
144 | 145 |
146 // Provides an opportunity to interpose on proxy resolution. Called before | |
147 // ProxyService.ResolveProxy() returns. |proxy_info| contains information | |
148 // about the proxy being used, and may be modified by this callback. | |
149 typedef base::Callback<void(const GURL& url, int load_flags, | |
150 net::ProxyInfo* result)> OnResolveProxyHandler; | |
151 | |
152 void set_on_resolve_proxy_handler(OnResolveProxyHandler* handler) { | |
153 on_resolve_proxy_handler_ = handler; | |
154 } | |
155 | |
145 // Adds the Client Hints header to HTTP requests. | 156 // Adds the Client Hints header to HTTP requests. |
146 void SetEnableClientHints(); | 157 void SetEnableClientHints(); |
147 | 158 |
148 // Causes |OnCanThrottleRequest| to always return false, for all | 159 // Causes |OnCanThrottleRequest| to always return false, for all |
149 // instances of this object. | 160 // instances of this object. |
150 static void NeverThrottleRequests(); | 161 static void NeverThrottleRequests(); |
151 | 162 |
152 // Binds the pref members to |pref_service| and moves them to the IO thread. | 163 // Binds the pref members to |pref_service| and moves them to the IO thread. |
153 // |enable_referrers| cannot be NULL, the others can. | 164 // |enable_referrers| cannot be NULL, the others can. |
154 // This method should be called on the UI thread. | 165 // This method should be called on the UI thread. |
(...skipping 16 matching lines...) Expand all Loading... | |
171 // responsible for deleting the returned value. | 182 // responsible for deleting the returned value. |
172 base::Value* SessionNetworkStatsInfoToValue() const; | 183 base::Value* SessionNetworkStatsInfoToValue() const; |
173 | 184 |
174 private: | 185 private: |
175 friend class ChromeNetworkDelegateTest; | 186 friend class ChromeNetworkDelegateTest; |
176 | 187 |
177 // NetworkDelegate implementation. | 188 // NetworkDelegate implementation. |
178 virtual int OnBeforeURLRequest(net::URLRequest* request, | 189 virtual int OnBeforeURLRequest(net::URLRequest* request, |
179 const net::CompletionCallback& callback, | 190 const net::CompletionCallback& callback, |
180 GURL* new_url) OVERRIDE; | 191 GURL* new_url) OVERRIDE; |
192 virtual void OnResolveProxy( | |
193 const GURL& url, int load_flags, net::ProxyInfo* result) OVERRIDE; | |
181 virtual int OnBeforeSendHeaders(net::URLRequest* request, | 194 virtual int OnBeforeSendHeaders(net::URLRequest* request, |
182 const net::CompletionCallback& callback, | 195 const net::CompletionCallback& callback, |
183 net::HttpRequestHeaders* headers) OVERRIDE; | 196 net::HttpRequestHeaders* headers) OVERRIDE; |
184 virtual void OnBeforeSendProxyHeaders( | 197 virtual void OnBeforeSendProxyHeaders( |
185 net::URLRequest* request, | 198 net::URLRequest* request, |
186 const net::ProxyInfo& proxy_info, | 199 const net::ProxyInfo& proxy_info, |
187 net::HttpRequestHeaders* headers) OVERRIDE; | 200 net::HttpRequestHeaders* headers) OVERRIDE; |
188 virtual void OnSendHeaders(net::URLRequest* request, | 201 virtual void OnSendHeaders(net::URLRequest* request, |
189 const net::HttpRequestHeaders& headers) OVERRIDE; | 202 const net::HttpRequestHeaders& headers) OVERRIDE; |
190 virtual int OnHeadersReceived( | 203 virtual int OnHeadersReceived( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
273 | 286 |
274 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. | 287 // |data_reduction_proxy_params_| must outlive this ChromeNetworkDelegate. |
275 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 288 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
276 // |data_reduction_proxy_usage_stats_| must outlive this | 289 // |data_reduction_proxy_usage_stats_| must outlive this |
277 // ChromeNetworkDelegate. | 290 // ChromeNetworkDelegate. |
278 data_reduction_proxy::DataReductionProxyUsageStats* | 291 data_reduction_proxy::DataReductionProxyUsageStats* |
279 data_reduction_proxy_usage_stats_; | 292 data_reduction_proxy_usage_stats_; |
280 data_reduction_proxy::DataReductionProxyAuthRequestHandler* | 293 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
281 data_reduction_proxy_auth_request_handler_; | 294 data_reduction_proxy_auth_request_handler_; |
282 | 295 |
296 OnResolveProxyHandler* on_resolve_proxy_handler_; | |
297 | |
283 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 298 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
284 }; | 299 }; |
285 | 300 |
286 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 301 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
OLD | NEW |