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