1 // Copyright 2014 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 EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_
8 #include "extensions/browser/info_map.h"
9 #include "net/base/network_delegate.h"
11 namespace extensions
{
15 class ShellNetworkDelegate
: public net::NetworkDelegate
{
17 ShellNetworkDelegate(void* browser_context
, InfoMap
* extension_info_map
);
18 virtual ~ShellNetworkDelegate();
20 static void SetAcceptAllCookies(bool accept
);
23 // NetworkDelegate implementation.
24 virtual int OnBeforeURLRequest(net::URLRequest
* request
,
25 const net::CompletionCallback
& callback
,
26 GURL
* new_url
) OVERRIDE
;
27 virtual int OnBeforeSendHeaders(net::URLRequest
* request
,
28 const net::CompletionCallback
& callback
,
29 net::HttpRequestHeaders
* headers
) OVERRIDE
;
30 virtual void OnSendHeaders(net::URLRequest
* request
,
31 const net::HttpRequestHeaders
& headers
) OVERRIDE
;
32 virtual int OnHeadersReceived(
33 net::URLRequest
* request
,
34 const net::CompletionCallback
& callback
,
35 const net::HttpResponseHeaders
* original_response_headers
,
36 scoped_refptr
<net::HttpResponseHeaders
>* override_response_headers
,
37 GURL
* allowed_unsafe_redirect_url
) OVERRIDE
;
38 virtual void OnBeforeRedirect(net::URLRequest
* request
,
39 const GURL
& new_location
) OVERRIDE
;
40 virtual void OnResponseStarted(net::URLRequest
* request
) OVERRIDE
;
41 virtual void OnCompleted(net::URLRequest
* request
, bool started
) OVERRIDE
;
42 virtual void OnURLRequestDestroyed(net::URLRequest
* request
) OVERRIDE
;
43 virtual void OnPACScriptError(int line_number
,
44 const base::string16
& error
) OVERRIDE
;
45 virtual net::NetworkDelegate::AuthRequiredResponse
OnAuthRequired(
46 net::URLRequest
* request
,
47 const net::AuthChallengeInfo
& auth_info
,
48 const AuthCallback
& callback
,
49 net::AuthCredentials
* credentials
) OVERRIDE
;
51 void* browser_context_
;
52 scoped_refptr
<extensions::InfoMap
> extension_info_map_
;
54 DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate
);
57 } // namespace extensions
59 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_