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_impl.h"
16 namespace android_webview
{
18 // WebView's implementation of the NetworkDelegate.
19 class AwNetworkDelegate
: public net::NetworkDelegateImpl
{
22 virtual ~AwNetworkDelegate();
25 // NetworkDelegate implementation.
26 virtual int OnBeforeURLRequest(net::URLRequest
* request
,
27 const net::CompletionCallback
& callback
,
28 GURL
* new_url
) override
;
29 virtual int OnBeforeSendHeaders(net::URLRequest
* request
,
30 const net::CompletionCallback
& callback
,
31 net::HttpRequestHeaders
* headers
) override
;
32 virtual void OnSendHeaders(net::URLRequest
* request
,
33 const net::HttpRequestHeaders
& headers
) override
;
34 virtual int OnHeadersReceived(
35 net::URLRequest
* request
,
36 const net::CompletionCallback
& callback
,
37 const net::HttpResponseHeaders
* original_response_headers
,
38 scoped_refptr
<net::HttpResponseHeaders
>* override_response_headers
,
39 GURL
* allowed_unsafe_redirect_url
) override
;
40 virtual void OnBeforeRedirect(net::URLRequest
* request
,
41 const GURL
& new_location
) override
;
42 virtual void OnResponseStarted(net::URLRequest
* request
) override
;
43 virtual void OnRawBytesRead(const net::URLRequest
& request
,
44 int bytes_read
) override
;
45 virtual void OnCompleted(net::URLRequest
* request
, bool started
) override
;
46 virtual void OnURLRequestDestroyed(net::URLRequest
* request
) override
;
47 virtual void OnPACScriptError(int line_number
,
48 const base::string16
& error
) override
;
49 virtual net::NetworkDelegate::AuthRequiredResponse
OnAuthRequired(
50 net::URLRequest
* request
,
51 const net::AuthChallengeInfo
& auth_info
,
52 const AuthCallback
& callback
,
53 net::AuthCredentials
* credentials
) override
;
54 virtual bool OnCanGetCookies(const net::URLRequest
& request
,
55 const net::CookieList
& cookie_list
) override
;
56 virtual bool OnCanSetCookie(const net::URLRequest
& request
,
57 const std::string
& cookie_line
,
58 net::CookieOptions
* options
) override
;
59 virtual bool OnCanAccessFile(const net::URLRequest
& request
,
60 const base::FilePath
& path
) const override
;
61 virtual bool OnCanThrottleRequest(
62 const net::URLRequest
& request
) const override
;
64 DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate
);
67 } // namespace android_webview
69 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_