OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 6 #define CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "net/base/network_delegate.h" | 11 #include "net/base/network_delegate.h" |
12 | 12 |
13 class CookieSettings; | 13 class CookieSettings; |
14 class ExtensionEventRouterForwarder; | |
15 class ExtensionInfoMap; | 14 class ExtensionInfoMap; |
16 class PrefService; | 15 class PrefService; |
17 template<class T> class PrefMember; | 16 template<class T> class PrefMember; |
18 | 17 |
19 typedef PrefMember<bool> BooleanPrefMember; | 18 typedef PrefMember<bool> BooleanPrefMember; |
20 | 19 |
| 20 namespace extensions { |
| 21 class EventRouterForwarder; |
| 22 } |
| 23 |
21 namespace policy { | 24 namespace policy { |
22 class URLBlacklistManager; | 25 class URLBlacklistManager; |
23 } | 26 } |
24 | 27 |
25 // ChromeNetworkDelegate is the central point from within the chrome code to | 28 // ChromeNetworkDelegate is the central point from within the chrome code to |
26 // add hooks into the network stack. | 29 // add hooks into the network stack. |
27 class ChromeNetworkDelegate : public net::NetworkDelegate { | 30 class ChromeNetworkDelegate : public net::NetworkDelegate { |
28 public: | 31 public: |
29 // If |profile| is NULL, events will be broadcasted to all profiles, | 32 // If |profile| is NULL, events will be broadcasted to all profiles, |
30 // otherwise they will only be sent to the specified profile. | 33 // otherwise they will only be sent to the specified profile. |
31 // |enable_referrers| should be initialized on the UI thread (see below) | 34 // |enable_referrers| should be initialized on the UI thread (see below) |
32 // beforehand. This object's owner is responsible for cleaning it up at | 35 // beforehand. This object's owner is responsible for cleaning it up at |
33 // shutdown. If |cookie_settings| is NULL, all cookies are enabled, | 36 // shutdown. If |cookie_settings| is NULL, all cookies are enabled, |
34 // otherwise, the settings are enforced on all observed network requests. | 37 // otherwise, the settings are enforced on all observed network requests. |
35 ChromeNetworkDelegate( | 38 ChromeNetworkDelegate( |
36 ExtensionEventRouterForwarder* event_router, | 39 extensions::EventRouterForwarder* event_router, |
37 ExtensionInfoMap* extension_info_map, | 40 ExtensionInfoMap* extension_info_map, |
38 const policy::URLBlacklistManager* url_blacklist_manager, | 41 const policy::URLBlacklistManager* url_blacklist_manager, |
39 void* profile, | 42 void* profile, |
40 CookieSettings* cookie_settings, | 43 CookieSettings* cookie_settings, |
41 BooleanPrefMember* enable_referrers); | 44 BooleanPrefMember* enable_referrers); |
42 virtual ~ChromeNetworkDelegate(); | 45 virtual ~ChromeNetworkDelegate(); |
43 | 46 |
44 // Causes |OnCanThrottleRequest| to never return true. | 47 // Causes |OnCanThrottleRequest| to never return true. |
45 void NeverThrottleRequests(); | 48 void NeverThrottleRequests(); |
46 | 49 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const std::string& cookie_line, | 92 const std::string& cookie_line, |
90 net::CookieOptions* options) OVERRIDE; | 93 net::CookieOptions* options) OVERRIDE; |
91 virtual bool OnCanAccessFile(const net::URLRequest& request, | 94 virtual bool OnCanAccessFile(const net::URLRequest& request, |
92 const FilePath& path) const OVERRIDE; | 95 const FilePath& path) const OVERRIDE; |
93 virtual bool OnCanThrottleRequest( | 96 virtual bool OnCanThrottleRequest( |
94 const net::URLRequest& request) const OVERRIDE; | 97 const net::URLRequest& request) const OVERRIDE; |
95 virtual int OnBeforeSocketStreamConnect( | 98 virtual int OnBeforeSocketStreamConnect( |
96 net::SocketStream* stream, | 99 net::SocketStream* stream, |
97 const net::CompletionCallback& callback) OVERRIDE; | 100 const net::CompletionCallback& callback) OVERRIDE; |
98 | 101 |
99 scoped_refptr<ExtensionEventRouterForwarder> event_router_; | 102 scoped_refptr<extensions::EventRouterForwarder> event_router_; |
100 void* profile_; | 103 void* profile_; |
101 scoped_refptr<CookieSettings> cookie_settings_; | 104 scoped_refptr<CookieSettings> cookie_settings_; |
102 | 105 |
103 scoped_refptr<ExtensionInfoMap> extension_info_map_; | 106 scoped_refptr<ExtensionInfoMap> extension_info_map_; |
104 | 107 |
105 // Weak, owned by our owner. | 108 // Weak, owned by our owner. |
106 BooleanPrefMember* enable_referrers_; | 109 BooleanPrefMember* enable_referrers_; |
107 | 110 |
108 // True if OnCanThrottleRequest should always return false. | 111 // True if OnCanThrottleRequest should always return false. |
109 bool never_throttle_requests_; | 112 bool never_throttle_requests_; |
110 | 113 |
111 // Weak, owned by our owner. | 114 // Weak, owned by our owner. |
112 const policy::URLBlacklistManager* url_blacklist_manager_; | 115 const policy::URLBlacklistManager* url_blacklist_manager_; |
113 | 116 |
114 // When true, allow access to all file:// URLs. | 117 // When true, allow access to all file:// URLs. |
115 static bool g_allow_file_access_; | 118 static bool g_allow_file_access_; |
116 | 119 |
117 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 120 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
118 }; | 121 }; |
119 | 122 |
120 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 123 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
OLD | NEW |