| 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 30 matching lines...) Expand all Loading... |
| 41 class DomainReliabilityMonitor; | 41 class DomainReliabilityMonitor; |
| 42 } // namespace domain_reliability | 42 } // namespace domain_reliability |
| 43 | 43 |
| 44 namespace extensions { | 44 namespace extensions { |
| 45 class EventRouterForwarder; | 45 class EventRouterForwarder; |
| 46 class InfoMap; | 46 class InfoMap; |
| 47 } | 47 } |
| 48 | 48 |
| 49 namespace net { | 49 namespace net { |
| 50 class URLRequest; | 50 class URLRequest; |
| 51 class ProxyInfo; |
| 51 } | 52 } |
| 52 | 53 |
| 53 namespace policy { | 54 namespace policy { |
| 54 class URLBlacklistManager; | 55 class URLBlacklistManager; |
| 55 } | 56 } |
| 56 | 57 |
| 57 namespace prerender { | 58 namespace prerender { |
| 58 class PrerenderTracker; | 59 class PrerenderTracker; |
| 59 } | 60 } |
| 60 | 61 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 void set_prerender_tracker(prerender::PrerenderTracker* prerender_tracker) { | 118 void set_prerender_tracker(prerender::PrerenderTracker* prerender_tracker) { |
| 118 prerender_tracker_ = prerender_tracker; | 119 prerender_tracker_ = prerender_tracker; |
| 119 } | 120 } |
| 120 | 121 |
| 121 void set_data_reduction_proxy_params( | 122 void set_data_reduction_proxy_params( |
| 122 data_reduction_proxy::DataReductionProxyParams* params) { | 123 data_reduction_proxy::DataReductionProxyParams* params) { |
| 123 data_reduction_proxy_params_ = params; | 124 data_reduction_proxy_params_ = params; |
| 124 } | 125 } |
| 125 | 126 |
| 127 // Provides an opportunity to interpose on proxy resolution. Called before |
| 128 // ProxyService.ResolveProxy() returns. |proxy_info| contains information |
| 129 // about the proxy being used, and may be modified by this callback. |
| 130 typedef base::Callback<void(const GURL& url, int load_flags, |
| 131 net::ProxyInfo* result)> OnResolveProxyHandler; |
| 132 |
| 133 void set_on_resolve_proxy_handler(OnResolveProxyHandler* handler) { |
| 134 on_resolve_proxy_handler_ = handler; |
| 135 } |
| 136 |
| 126 // Adds the Client Hints header to HTTP requests. | 137 // Adds the Client Hints header to HTTP requests. |
| 127 void SetEnableClientHints(); | 138 void SetEnableClientHints(); |
| 128 | 139 |
| 129 // Causes |OnCanThrottleRequest| to always return false, for all | 140 // Causes |OnCanThrottleRequest| to always return false, for all |
| 130 // instances of this object. | 141 // instances of this object. |
| 131 static void NeverThrottleRequests(); | 142 static void NeverThrottleRequests(); |
| 132 | 143 |
| 133 // Binds the pref members to |pref_service| and moves them to the IO thread. | 144 // Binds the pref members to |pref_service| and moves them to the IO thread. |
| 134 // |enable_referrers| cannot be NULL, the others can. | 145 // |enable_referrers| cannot be NULL, the others can. |
| 135 // This method should be called on the UI thread. | 146 // This method should be called on the UI thread. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 152 // responsible for deleting the returned value. | 163 // responsible for deleting the returned value. |
| 153 base::Value* SessionNetworkStatsInfoToValue() const; | 164 base::Value* SessionNetworkStatsInfoToValue() const; |
| 154 | 165 |
| 155 private: | 166 private: |
| 156 friend class ChromeNetworkDelegateTest; | 167 friend class ChromeNetworkDelegateTest; |
| 157 | 168 |
| 158 // NetworkDelegate implementation. | 169 // NetworkDelegate implementation. |
| 159 virtual int OnBeforeURLRequest(net::URLRequest* request, | 170 virtual int OnBeforeURLRequest(net::URLRequest* request, |
| 160 const net::CompletionCallback& callback, | 171 const net::CompletionCallback& callback, |
| 161 GURL* new_url) OVERRIDE; | 172 GURL* new_url) OVERRIDE; |
| 173 virtual void OnResolveProxy( |
| 174 const GURL& url, int load_flags, net::ProxyInfo* result) OVERRIDE; |
| 162 virtual int OnBeforeSendHeaders(net::URLRequest* request, | 175 virtual int OnBeforeSendHeaders(net::URLRequest* request, |
| 163 const net::CompletionCallback& callback, | 176 const net::CompletionCallback& callback, |
| 164 net::HttpRequestHeaders* headers) OVERRIDE; | 177 net::HttpRequestHeaders* headers) OVERRIDE; |
| 165 virtual void OnSendHeaders(net::URLRequest* request, | 178 virtual void OnSendHeaders(net::URLRequest* request, |
| 166 const net::HttpRequestHeaders& headers) OVERRIDE; | 179 const net::HttpRequestHeaders& headers) OVERRIDE; |
| 167 virtual int OnHeadersReceived( | 180 virtual int OnHeadersReceived( |
| 168 net::URLRequest* request, | 181 net::URLRequest* request, |
| 169 const net::CompletionCallback& callback, | 182 const net::CompletionCallback& callback, |
| 170 const net::HttpResponseHeaders* original_response_headers, | 183 const net::HttpResponseHeaders* original_response_headers, |
| 171 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 184 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 int64 original_content_length_; | 256 int64 original_content_length_; |
| 244 | 257 |
| 245 scoped_ptr<ClientHints> client_hints_; | 258 scoped_ptr<ClientHints> client_hints_; |
| 246 | 259 |
| 247 bool first_request_; | 260 bool first_request_; |
| 248 | 261 |
| 249 prerender::PrerenderTracker* prerender_tracker_; | 262 prerender::PrerenderTracker* prerender_tracker_; |
| 250 | 263 |
| 251 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 264 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
| 252 | 265 |
| 266 OnResolveProxyHandler* on_resolve_proxy_handler_; |
| 267 |
| 253 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 268 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 254 }; | 269 }; |
| 255 | 270 |
| 256 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 271 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |