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