| 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; | 14 class ExtensionEventRouterForwarder; |
| 15 class ExtensionInfoMap; | 15 class ExtensionInfoMap; |
| 16 class ManagedModeURLFilter; |
| 16 class PrefService; | 17 class PrefService; |
| 17 template<class T> class PrefMember; | 18 template<class T> class PrefMember; |
| 18 | 19 |
| 19 typedef PrefMember<bool> BooleanPrefMember; | 20 typedef PrefMember<bool> BooleanPrefMember; |
| 20 | 21 |
| 21 namespace policy { | 22 namespace policy { |
| 22 class URLBlacklistManager; | 23 class URLBlacklistManager; |
| 23 } | 24 } |
| 24 | 25 |
| 25 // ChromeNetworkDelegate is the central point from within the chrome code to | 26 // ChromeNetworkDelegate is the central point from within the chrome code to |
| 26 // add hooks into the network stack. | 27 // add hooks into the network stack. |
| 27 class ChromeNetworkDelegate : public net::NetworkDelegate { | 28 class ChromeNetworkDelegate : public net::NetworkDelegate { |
| 28 public: | 29 public: |
| 29 // If |profile| is NULL, events will be broadcasted to all profiles, | 30 // If |profile| is NULL, events will be broadcasted to all profiles, |
| 30 // otherwise they will only be sent to the specified profile. | 31 // otherwise they will only be sent to the specified profile. |
| 31 // |enable_referrers| should be initialized on the UI thread (see below) | 32 // |enable_referrers| should be initialized on the UI thread (see below) |
| 32 // beforehand. This object's owner is responsible for cleaning it up at | 33 // beforehand. This object's owner is responsible for cleaning it up at |
| 33 // shutdown. If |cookie_settings| is NULL, all cookies are enabled, | 34 // shutdown. If |cookie_settings| is NULL, all cookies are enabled, |
| 34 // otherwise, the settings are enforced on all observed network requests. | 35 // otherwise, the settings are enforced on all observed network requests. |
| 35 ChromeNetworkDelegate( | 36 ChromeNetworkDelegate( |
| 36 ExtensionEventRouterForwarder* event_router, | 37 ExtensionEventRouterForwarder* event_router, |
| 37 ExtensionInfoMap* extension_info_map, | 38 ExtensionInfoMap* extension_info_map, |
| 38 const policy::URLBlacklistManager* url_blacklist_manager, | 39 const policy::URLBlacklistManager* url_blacklist_manager, |
| 40 const ManagedModeURLFilter* managed_mode_url_filter, |
| 39 void* profile, | 41 void* profile, |
| 40 CookieSettings* cookie_settings, | 42 CookieSettings* cookie_settings, |
| 41 BooleanPrefMember* enable_referrers); | 43 BooleanPrefMember* enable_referrers); |
| 42 virtual ~ChromeNetworkDelegate(); | 44 virtual ~ChromeNetworkDelegate(); |
| 43 | 45 |
| 44 // Causes |OnCanThrottleRequest| to never return true. | 46 // Causes |OnCanThrottleRequest| to never return true. |
| 45 void NeverThrottleRequests(); | 47 void NeverThrottleRequests(); |
| 46 | 48 |
| 47 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. | 49 // Binds |enable_referrers| to |pref_service| and moves it to the IO thread. |
| 48 // This method should be called on the UI thread. | 50 // This method should be called on the UI thread. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 106 |
| 105 // Weak, owned by our owner. | 107 // Weak, owned by our owner. |
| 106 BooleanPrefMember* enable_referrers_; | 108 BooleanPrefMember* enable_referrers_; |
| 107 | 109 |
| 108 // True if OnCanThrottleRequest should always return false. | 110 // True if OnCanThrottleRequest should always return false. |
| 109 bool never_throttle_requests_; | 111 bool never_throttle_requests_; |
| 110 | 112 |
| 111 // Weak, owned by our owner. | 113 // Weak, owned by our owner. |
| 112 const policy::URLBlacklistManager* url_blacklist_manager_; | 114 const policy::URLBlacklistManager* url_blacklist_manager_; |
| 113 | 115 |
| 116 // Weak pointer. The owner of this object needs to make sure that the |
| 117 // |managed_mode_url_filter_| outlives it. |
| 118 const ManagedModeURLFilter* managed_mode_url_filter_; |
| 119 |
| 114 // When true, allow access to all file:// URLs. | 120 // When true, allow access to all file:// URLs. |
| 115 static bool g_allow_file_access_; | 121 static bool g_allow_file_access_; |
| 116 | 122 |
| 117 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 123 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
| 118 }; | 124 }; |
| 119 | 125 |
| 120 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 126 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
| OLD | NEW |