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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // the header file. Here we just forward-declare it. | 89 // the header file. Here we just forward-declare it. |
90 void set_cookie_settings(CookieSettings* cookie_settings); | 90 void set_cookie_settings(CookieSettings* cookie_settings); |
91 | 91 |
92 // Causes requested URLs to be fed to |predictor| via ConnectInterceptor. | 92 // Causes requested URLs to be fed to |predictor| via ConnectInterceptor. |
93 void set_predictor(chrome_browser_net::Predictor* predictor); | 93 void set_predictor(chrome_browser_net::Predictor* predictor); |
94 | 94 |
95 void set_enable_do_not_track(BooleanPrefMember* enable_do_not_track) { | 95 void set_enable_do_not_track(BooleanPrefMember* enable_do_not_track) { |
96 enable_do_not_track_ = enable_do_not_track; | 96 enable_do_not_track_ = enable_do_not_track; |
97 } | 97 } |
98 | 98 |
99 void set_force_safe_search( | |
100 BooleanPrefMember* force_safe_search) { | |
101 force_safe_search_ = force_safe_search; | |
102 } | |
103 | |
104 void set_force_google_safe_search( | 99 void set_force_google_safe_search( |
105 BooleanPrefMember* force_google_safe_search) { | 100 BooleanPrefMember* force_google_safe_search) { |
106 force_google_safe_search_ = force_google_safe_search; | 101 force_google_safe_search_ = force_google_safe_search; |
107 } | 102 } |
108 | 103 |
109 void set_force_youtube_safety_mode( | 104 void set_force_youtube_safety_mode( |
110 BooleanPrefMember* force_youtube_safety_mode) { | 105 BooleanPrefMember* force_youtube_safety_mode) { |
111 force_youtube_safety_mode_ = force_youtube_safety_mode; | 106 force_youtube_safety_mode_ = force_youtube_safety_mode; |
112 } | 107 } |
113 | 108 |
114 void set_domain_reliability_monitor( | 109 void set_domain_reliability_monitor( |
115 domain_reliability::DomainReliabilityMonitor* monitor) { | 110 domain_reliability::DomainReliabilityMonitor* monitor) { |
116 domain_reliability_monitor_ = monitor; | 111 domain_reliability_monitor_ = monitor; |
117 } | 112 } |
118 | 113 |
119 // Causes |OnCanThrottleRequest| to always return false, for all | 114 // Causes |OnCanThrottleRequest| to always return false, for all |
120 // instances of this object. | 115 // instances of this object. |
121 static void NeverThrottleRequests(); | 116 static void NeverThrottleRequests(); |
122 | 117 |
123 // Binds the pref members to |pref_service| and moves them to the IO thread. | 118 // Binds the pref members to |pref_service| and moves them to the IO thread. |
124 // |enable_referrers| cannot be NULL, the others can. | 119 // |enable_referrers| cannot be NULL, the others can. |
125 // This method should be called on the UI thread. | 120 // This method should be called on the UI thread. |
126 static void InitializePrefsOnUIThread( | 121 static void InitializePrefsOnUIThread( |
127 BooleanPrefMember* enable_referrers, | 122 BooleanPrefMember* enable_referrers, |
128 BooleanPrefMember* enable_do_not_track, | 123 BooleanPrefMember* enable_do_not_track, |
129 BooleanPrefMember* force_safe_search, | |
130 BooleanPrefMember* force_google_safe_search, | 124 BooleanPrefMember* force_google_safe_search, |
131 BooleanPrefMember* force_youtube_safety_mode, | 125 BooleanPrefMember* force_youtube_safety_mode, |
132 PrefService* pref_service); | 126 PrefService* pref_service); |
133 | 127 |
134 // When called, all file:// URLs will now be accessible. If this is not | 128 // When called, all file:// URLs will now be accessible. If this is not |
135 // called, then some platforms restrict access to file:// paths. | 129 // called, then some platforms restrict access to file:// paths. |
136 static void AllowAccessToAllFiles(); | 130 static void AllowAccessToAllFiles(); |
137 | 131 |
138 private: | 132 private: |
139 friend class ChromeNetworkDelegateThrottlingTest; | 133 friend class ChromeNetworkDelegateThrottlingTest; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 184 |
191 void* profile_; | 185 void* profile_; |
192 base::FilePath profile_path_; | 186 base::FilePath profile_path_; |
193 scoped_refptr<CookieSettings> cookie_settings_; | 187 scoped_refptr<CookieSettings> cookie_settings_; |
194 | 188 |
195 scoped_ptr<chrome_browser_net::ConnectInterceptor> connect_interceptor_; | 189 scoped_ptr<chrome_browser_net::ConnectInterceptor> connect_interceptor_; |
196 | 190 |
197 // Weak, owned by our owner. | 191 // Weak, owned by our owner. |
198 BooleanPrefMember* enable_referrers_; | 192 BooleanPrefMember* enable_referrers_; |
199 BooleanPrefMember* enable_do_not_track_; | 193 BooleanPrefMember* enable_do_not_track_; |
200 BooleanPrefMember* force_safe_search_; | |
201 BooleanPrefMember* force_google_safe_search_; | 194 BooleanPrefMember* force_google_safe_search_; |
202 BooleanPrefMember* force_youtube_safety_mode_; | 195 BooleanPrefMember* force_youtube_safety_mode_; |
203 | 196 |
204 // Weak, owned by our owner. | 197 // Weak, owned by our owner. |
205 #if defined(ENABLE_CONFIGURATION_POLICY) | 198 #if defined(ENABLE_CONFIGURATION_POLICY) |
206 const policy::URLBlacklistManager* url_blacklist_manager_; | 199 const policy::URLBlacklistManager* url_blacklist_manager_; |
207 #endif | 200 #endif |
208 domain_reliability::DomainReliabilityMonitor* domain_reliability_monitor_; | 201 domain_reliability::DomainReliabilityMonitor* domain_reliability_monitor_; |
209 | 202 |
210 // When true, allow access to all file:// URLs. | 203 // When true, allow access to all file:// URLs. |
211 static bool g_allow_file_access_; | 204 static bool g_allow_file_access_; |
212 | 205 |
213 // True if OnCanThrottleRequest should always return false. | 206 // True if OnCanThrottleRequest should always return false. |
214 // | 207 // |
215 // Note: This needs to be static as the instance of | 208 // Note: This needs to be static as the instance of |
216 // ChromeNetworkDelegate used may change over time, and we need to | 209 // ChromeNetworkDelegate used may change over time, and we need to |
217 // set this variable once at start-up time. It is effectively | 210 // set this variable once at start-up time. It is effectively |
218 // static anyway since it is based on a command-line flag. | 211 // static anyway since it is based on a command-line flag. |
219 static bool g_never_throttle_requests_; | 212 static bool g_never_throttle_requests_; |
220 | 213 |
221 bool experimental_web_platform_features_enabled_; | 214 bool experimental_web_platform_features_enabled_; |
222 | 215 |
223 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 216 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
224 }; | 217 }; |
225 | 218 |
226 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 219 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
OLD | NEW |