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 ~AwNetworkDelegate() override
;
25 // NetworkDelegate implementation.
26 int OnBeforeURLRequest(net::URLRequest
* request
,
27 const net::CompletionCallback
& callback
,
28 GURL
* new_url
) override
;
29 int OnBeforeSendHeaders(net::URLRequest
* request
,
30 const net::CompletionCallback
& callback
,
31 net::HttpRequestHeaders
* headers
) override
;
32 void OnSendHeaders(net::URLRequest
* request
,
33 const net::HttpRequestHeaders
& headers
) override
;
34 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 void OnBeforeRedirect(net::URLRequest
* request
,
41 const GURL
& new_location
) override
;
42 void OnResponseStarted(net::URLRequest
* request
) override
;
43 void OnRawBytesRead(const net::URLRequest
& request
, int bytes_read
) override
;
44 void OnCompleted(net::URLRequest
* request
, bool started
) override
;
45 void OnURLRequestDestroyed(net::URLRequest
* request
) override
;
46 void OnPACScriptError(int line_number
, const base::string16
& error
) override
;
47 net::NetworkDelegate::AuthRequiredResponse
OnAuthRequired(
48 net::URLRequest
* request
,
49 const net::AuthChallengeInfo
& auth_info
,
50 const AuthCallback
& callback
,
51 net::AuthCredentials
* credentials
) override
;
52 bool OnCanGetCookies(const net::URLRequest
& request
,
53 const net::CookieList
& cookie_list
) override
;
54 bool OnCanSetCookie(const net::URLRequest
& request
,
55 const std::string
& cookie_line
,
56 net::CookieOptions
* options
) override
;
57 bool OnCanAccessFile(const net::URLRequest
& request
,
58 const base::FilePath
& path
) const override
;
59 bool OnCanThrottleRequest(const net::URLRequest
& request
) const override
;
61 DISALLOW_COPY_AND_ASSIGN(AwNetworkDelegate
);
64 } // namespace android_webview
66 #endif // ANDROID_WEBVIEW_BROWSER_NET_AW_NETWORK_DELEGATE_H_