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_impl.h"
11 namespace extensions
{
15 class ShellNetworkDelegate
: public net::NetworkDelegateImpl
{
17 ShellNetworkDelegate(void* browser_context
, InfoMap
* extension_info_map
);
18 ~ShellNetworkDelegate() override
;
20 static void SetAcceptAllCookies(bool accept
);
23 // NetworkDelegate implementation.
24 int OnBeforeURLRequest(net::URLRequest
* request
,
25 const net::CompletionCallback
& callback
,
26 GURL
* new_url
) override
;
27 int OnBeforeSendHeaders(net::URLRequest
* request
,
28 const net::CompletionCallback
& callback
,
29 net::HttpRequestHeaders
* headers
) override
;
30 void OnSendHeaders(net::URLRequest
* request
,
31 const net::HttpRequestHeaders
& headers
) override
;
32 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 void OnBeforeRedirect(net::URLRequest
* request
,
39 const GURL
& new_location
) override
;
40 void OnResponseStarted(net::URLRequest
* request
) override
;
41 void OnCompleted(net::URLRequest
* request
, bool started
) override
;
42 void OnURLRequestDestroyed(net::URLRequest
* request
) override
;
43 void OnPACScriptError(int line_number
, const base::string16
& error
) override
;
44 net::NetworkDelegate::AuthRequiredResponse
OnAuthRequired(
45 net::URLRequest
* request
,
46 const net::AuthChallengeInfo
& auth_info
,
47 const AuthCallback
& callback
,
48 net::AuthCredentials
* credentials
) override
;
50 void* browser_context_
;
51 scoped_refptr
<extensions::InfoMap
> extension_info_map_
;
53 DISALLOW_COPY_AND_ASSIGN(ShellNetworkDelegate
);
56 } // namespace extensions
58 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_NETNETWORK_DELEGATE_H_