Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / android_webview / browser / net / aw_network_delegate.h
blob8771bbced15b5bee2573e078898b0c182e24ec62
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
3 // found in the LICENSE file.
5 #ifndef ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_
6 #define ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "net/base/network_delegate.h"
11 namespace data_reduction_proxy {
12 class DataReductionProxyAuthRequestHandler;
13 class DataReductionProxyParams;
16 namespace net {
17 class ProxyInfo;
18 class URLRequest;
21 namespace android_webview {
23 // WebView's implementation of the NetworkDelegate.
24 class AwNetworkDelegate : public net::NetworkDelegate {
25 public:
26 AwNetworkDelegate();
27 virtual ~AwNetworkDelegate();
29 // Sets the |DataReductionProxySettings| object to use. If not set, the
30 // NetworkDelegate will not perform any operations related to the data
31 // reduction proxy.
32 void set_data_reduction_proxy_params(
33 data_reduction_proxy::DataReductionProxyParams* params) {
34 data_reduction_proxy_params_ = params;
37 void set_data_reduction_proxy_auth_request_handler(
38 data_reduction_proxy::DataReductionProxyAuthRequestHandler* handler) {
39 data_reduction_proxy_auth_request_handler_ = handler;
42 private:
43 // NetworkDelegate implementation.
44 virtual int OnBeforeURLRequest(net::URLRequest* request,
45 const net::CompletionCallback& callback,
46 GURL* new_url) OVERRIDE;
47 virtual int OnBeforeSendHeaders(net::URLRequest* request,
48 const net::CompletionCallback& callback,
49 net::HttpRequestHeaders* headers) OVERRIDE;
50 virtual void OnBeforeSendProxyHeaders(
51 net::URLRequest* request,
52 const net::ProxyInfo& proxy_info,
53 net::HttpRequestHeaders* headers) OVERRIDE;
54 virtual void OnSendHeaders(net::URLRequest* request,
55 const net::HttpRequestHeaders& headers) OVERRIDE;
56 virtual int OnHeadersReceived(
57 net::URLRequest* request,
58 const net::CompletionCallback& callback,
59 const net::HttpResponseHeaders* original_response_headers,
60 scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
61 GURL* allowed_unsafe_redirect_url) OVERRIDE;
62 virtual void OnBeforeRedirect(net::URLRequest* request,
63 const GURL& new_location) OVERRIDE;
64 virtual void OnResponseStarted(net::URLRequest* request) OVERRIDE;
65 virtual void OnRawBytesRead(const net::URLRequest& request,
66 int bytes_read) OVERRIDE;
67 virtual void OnCompleted(net::URLRequest* request, bool started) OVERRIDE;
68 virtual void OnURLRequestDestroyed(net::URLRequest* request) OVERRIDE;
69 virtual void OnPACScriptError(int line_number,
70 const base::string16& error) OVERRIDE;
71 virtual net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(
72 net::URLRequest* request,
73 const net::AuthChallengeInfo& auth_info,
74 const AuthCallback& callback,
75 net::AuthCredentials* credentials) OVERRIDE;
76 virtual bool OnCanGetCookies(const net::URLRequest& request,
77 const net::CookieList& cookie_list) OVERRIDE;
78 virtual bool OnCanSetCookie(const net::URLRequest& request,
79 const std::string& cookie_line,
80 net::CookieOptions* options) OVERRIDE;
81 virtual bool OnCanAccessFile(const net::URLRequest& request,
82 const base::FilePath& path) const OVERRIDE;
83 virtual bool OnCanThrottleRequest(
84 const net::URLRequest& request) const OVERRIDE;
85 virtual int OnBeforeSocketStreamConnect(
86 net::SocketStream* stream,
87 const net::CompletionCallback& callback) OVERRIDE;
89 // Data reduction proxy parameters object. Must outlive this.
90 data_reduction_proxy::DataReductionProxyParams* data_reduction_proxy_params_;
91 data_reduction_proxy::DataReductionProxyAuthRequestHandler*
92 data_reduction_proxy_auth_request_handler_;
94 DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate);
97 } // namespace android_webview
99 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_