| 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 ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | |
| 10 #include "net/base/network_delegate.h" | 9 #include "net/base/network_delegate.h" |
| 11 | 10 |
| 11 namespace data_reduction_proxy { |
| 12 class DataReductionProxyAuthRequestHandler; |
| 13 class DataReductionProxyParams; |
| 14 } |
| 15 |
| 16 namespace net { |
| 17 class ProxyInfo; |
| 18 class URLRequest; |
| 19 } |
| 20 |
| 12 namespace android_webview { | 21 namespace android_webview { |
| 13 | 22 |
| 14 // WebView's implementation of the NetworkDelegate. | 23 // WebView's implementation of the NetworkDelegate. |
| 15 class AwNetworkDelegate : public net::NetworkDelegate { | 24 class AwNetworkDelegate : public net::NetworkDelegate { |
| 16 public: | 25 public: |
| 17 AwNetworkDelegate(); | 26 AwNetworkDelegate(); |
| 18 virtual ~AwNetworkDelegate(); | 27 virtual ~AwNetworkDelegate(); |
| 19 | 28 |
| 20 // Sets the |DataReductionProxySettings| object to use. If not set, the | 29 // Sets the |DataReductionProxySettings| object to use. If not set, the |
| 21 // NetworkDelegate will not perform any operations related to the data | 30 // NetworkDelegate will not perform any operations related to the data |
| 22 // reduction proxy. | 31 // reduction proxy. |
| 23 void set_data_reduction_proxy_params( | 32 void set_data_reduction_proxy_params( |
| 24 data_reduction_proxy::DataReductionProxyParams* params) { | 33 data_reduction_proxy::DataReductionProxyParams* params) { |
| 25 data_reduction_proxy_params_ = params; | 34 data_reduction_proxy_params_ = params; |
| 26 } | 35 } |
| 27 | 36 |
| 37 void set_data_reduction_proxy_auth_request_handler( |
| 38 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) { |
| 39 data_reduction_proxy_auth_request_handler_ = handler; |
| 40 } |
| 41 |
| 28 private: | 42 private: |
| 29 // NetworkDelegate implementation. | 43 // NetworkDelegate implementation. |
| 30 virtual int OnBeforeURLRequest(net::URLRequest* request, | 44 virtual int OnBeforeURLRequest(net::URLRequest* request, |
| 31 const net::CompletionCallback& callback, | 45 const net::CompletionCallback& callback, |
| 32 GURL* new_url) OVERRIDE; | 46 GURL* new_url) OVERRIDE; |
| 33 virtual int OnBeforeSendHeaders(net::URLRequest* request, | 47 virtual int OnBeforeSendHeaders(net::URLRequest* request, |
| 34 const net::CompletionCallback& callback, | 48 const net::CompletionCallback& callback, |
| 35 net::HttpRequestHeaders* headers) OVERRIDE; | 49 net::HttpRequestHeaders* headers) OVERRIDE; |
| 50 virtual void OnBeforeSendProxyHeaders( |
| 51 net::URLRequest* request, |
| 52 const net::ProxyInfo* proxy_info, |
| 53 net::HttpRequestHeaders* headers) OVERRIDE; |
| 36 virtual void OnSendHeaders(net::URLRequest* request, | 54 virtual void OnSendHeaders(net::URLRequest* request, |
| 37 const net::HttpRequestHeaders& headers) OVERRIDE; | 55 const net::HttpRequestHeaders& headers) OVERRIDE; |
| 38 virtual int OnHeadersReceived( | 56 virtual int OnHeadersReceived( |
| 39 net::URLRequest* request, | 57 net::URLRequest* request, |
| 40 const net::CompletionCallback& callback, | 58 const net::CompletionCallback& callback, |
| 41 const net::HttpResponseHeaders* original_response_headers, | 59 const net::HttpResponseHeaders* original_response_headers, |
| 42 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, | 60 scoped_refptr<net::HttpResponseHeaders>* override_response_headers, |
| 43 GURL* allowed_unsafe_redirect_url) OVERRIDE; | 61 GURL* allowed_unsafe_redirect_url) OVERRIDE; |
| 44 virtual void OnBeforeRedirect(net::URLRequest* request, | 62 virtual void OnBeforeRedirect(net::URLRequest* request, |
| 45 const GURL& new_location) OVERRIDE; | 63 const GURL& new_location) OVERRIDE; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 virtual bool OnCanAccessFile(const net::URLRequest& request, | 81 virtual bool OnCanAccessFile(const net::URLRequest& request, |
| 64 const base::FilePath& path) const OVERRIDE; | 82 const base::FilePath& path) const OVERRIDE; |
| 65 virtual bool OnCanThrottleRequest( | 83 virtual bool OnCanThrottleRequest( |
| 66 const net::URLRequest& request) const OVERRIDE; | 84 const net::URLRequest& request) const OVERRIDE; |
| 67 virtual int OnBeforeSocketStreamConnect( | 85 virtual int OnBeforeSocketStreamConnect( |
| 68 net::SocketStream* stream, | 86 net::SocketStream* stream, |
| 69 const net::CompletionCallback& callback) OVERRIDE; | 87 const net::CompletionCallback& callback) OVERRIDE; |
| 70 | 88 |
| 71 // Data reduction proxy parameters object. Must outlive this. | 89 // Data reduction proxy parameters object. Must outlive this. |
| 72 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; | 90 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_; |
| 91 data_reduction_proxy::DataReductionProxyAuthRequestHandler* |
| 92 data_reduction_proxy_auth_request_handler_; |
| 73 | 93 |
| 74 DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate); | 94 DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate); |
| 75 }; | 95 }; |
| 76 | 96 |
| 77 } // namespace android_webview | 97 } // namespace android_webview |
| 78 | 98 |
| 79 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ | 99 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_ |
| OLD | NEW |