1 // Copyright 2013 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 CONTENT_SHELL_BROWSER_SHELL_NETWORK_DELEGATE_H_
6 #define CONTENT_SHELL_BROWSER_SHELL_NETWORK_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "net/base/network_delegate.h"
14 class ShellNetworkDelegate
: public net::NetworkDelegate
{
16 ShellNetworkDelegate();
17 virtual ~ShellNetworkDelegate();
19 static void SetAcceptAllCookies(bool accept
);
22 // net::NetworkDelegate implementation.
23 virtual int OnBeforeURLRequest(net::URLRequest
* request
,
24 const net::CompletionCallback
& callback
,
25 GURL
* new_url
) OVERRIDE
;
26 virtual int OnBeforeSendHeaders(net::URLRequest
* request
,
27 const net::CompletionCallback
& callback
,
28 net::HttpRequestHeaders
* headers
) OVERRIDE
;
29 virtual void OnSendHeaders(net::URLRequest
* request
,
30 const net::HttpRequestHeaders
& headers
) OVERRIDE
;
31 virtual int OnHeadersReceived(
32 net::URLRequest
* request
,
33 const net::CompletionCallback
& callback
,
34 const net::HttpResponseHeaders
* original_response_headers
,
35 scoped_refptr
<net::HttpResponseHeaders
>*
36 override_response_headers
) OVERRIDE
;
37 virtual void OnBeforeRedirect(net::URLRequest
* request
,
38 const GURL
& new_location
) OVERRIDE
;
39 virtual void OnResponseStarted(net::URLRequest
* request
) OVERRIDE
;
40 virtual void OnRawBytesRead(const net::URLRequest
& request
,
41 int bytes_read
) OVERRIDE
;
42 virtual void OnCompleted(net::URLRequest
* request
, bool started
) OVERRIDE
;
43 virtual void OnURLRequestDestroyed(net::URLRequest
* request
) OVERRIDE
;
44 virtual void OnPACScriptError(int line_number
,
45 const string16
& error
) OVERRIDE
;
46 virtual AuthRequiredResponse
OnAuthRequired(
47 net::URLRequest
* request
,
48 const net::AuthChallengeInfo
& auth_info
,
49 const AuthCallback
& callback
,
50 net::AuthCredentials
* credentials
) OVERRIDE
;
51 virtual bool OnCanGetCookies(const net::URLRequest
& request
,
52 const net::CookieList
& cookie_list
) OVERRIDE
;
53 virtual bool OnCanSetCookie(const net::URLRequest
& request
,
54 const std::string
& cookie_line
,
55 net::CookieOptions
* options
) OVERRIDE
;
56 virtual bool OnCanAccessFile(const net::URLRequest
& request
,
57 const base::FilePath
& path
) const OVERRIDE
;
58 virtual bool OnCanThrottleRequest(
59 const net::URLRequest
& request
) const OVERRIDE
;
60 virtual int OnBeforeSocketStreamConnect(
61 net::SocketStream
* stream
,
62 const net::CompletionCallback
& callback
) OVERRIDE
;
63 virtual void OnRequestWaitStateChange(const net::URLRequest
& request
,
64 RequestWaitState state
) OVERRIDE
;
66 DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate
);
69 } // namespace content
71 #endif // CONTENT_SHELL_BROWSER_SHELL_NETWORK_DELEGATE_H_