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" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" | 16 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_metr
ics.h" |
17 #include "net/base/network_delegate_impl.h" | 17 #include "net/base/network_delegate_impl.h" |
18 | 18 |
19 class ChromeExtensionsNetworkDelegate; | 19 class ChromeExtensionsNetworkDelegate; |
20 class ClientHints; | |
21 class CookieSettings; | 20 class CookieSettings; |
22 class PrefService; | 21 class PrefService; |
23 | 22 |
24 template<class T> class PrefMember; | 23 template<class T> class PrefMember; |
25 | 24 |
26 typedef PrefMember<bool> BooleanPrefMember; | 25 typedef PrefMember<bool> BooleanPrefMember; |
27 | 26 |
28 namespace base { | 27 namespace base { |
29 class Value; | 28 class Value; |
30 } | 29 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 117 |
119 void set_domain_reliability_monitor( | 118 void set_domain_reliability_monitor( |
120 domain_reliability::DomainReliabilityMonitor* monitor) { | 119 domain_reliability::DomainReliabilityMonitor* monitor) { |
121 domain_reliability_monitor_ = monitor; | 120 domain_reliability_monitor_ = monitor; |
122 } | 121 } |
123 | 122 |
124 void set_prerender_tracker(prerender::PrerenderTracker* prerender_tracker) { | 123 void set_prerender_tracker(prerender::PrerenderTracker* prerender_tracker) { |
125 prerender_tracker_ = prerender_tracker; | 124 prerender_tracker_ = prerender_tracker; |
126 } | 125 } |
127 | 126 |
128 // Adds the Client Hints header to HTTP requests. | |
129 void SetEnableClientHints(); | |
130 | |
131 // Causes |OnCanThrottleRequest| to always return false, for all | 127 // Causes |OnCanThrottleRequest| to always return false, for all |
132 // instances of this object. | 128 // instances of this object. |
133 static void NeverThrottleRequests(); | 129 static void NeverThrottleRequests(); |
134 | 130 |
135 // Binds the pref members to |pref_service| and moves them to the IO thread. | 131 // Binds the pref members to |pref_service| and moves them to the IO thread. |
136 // |enable_referrers| cannot be NULL, the others can. | 132 // |enable_referrers| cannot be NULL, the others can. |
137 // This method should be called on the UI thread. | 133 // This method should be called on the UI thread. |
138 static void InitializePrefsOnUIThread( | 134 static void InitializePrefsOnUIThread( |
139 BooleanPrefMember* enable_referrers, | 135 BooleanPrefMember* enable_referrers, |
140 BooleanPrefMember* enable_do_not_track, | 136 BooleanPrefMember* enable_do_not_track, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 static bool g_allow_file_access_; | 218 static bool g_allow_file_access_; |
223 | 219 |
224 // True if OnCanThrottleRequest should always return false. | 220 // True if OnCanThrottleRequest should always return false. |
225 // | 221 // |
226 // Note: This needs to be static as the instance of | 222 // Note: This needs to be static as the instance of |
227 // ChromeNetworkDelegate used may change over time, and we need to | 223 // ChromeNetworkDelegate used may change over time, and we need to |
228 // set this variable once at start-up time. It is effectively | 224 // set this variable once at start-up time. It is effectively |
229 // static anyway since it is based on a command-line flag. | 225 // static anyway since it is based on a command-line flag. |
230 static bool g_never_throttle_requests_; | 226 static bool g_never_throttle_requests_; |
231 | 227 |
232 scoped_ptr<ClientHints> client_hints_; | |
233 | |
234 bool first_request_; | 228 bool first_request_; |
235 | 229 |
236 prerender::PrerenderTracker* prerender_tracker_; | 230 prerender::PrerenderTracker* prerender_tracker_; |
237 | 231 |
238 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); | 232 DISALLOW_COPY_AND_ASSIGN(ChromeNetworkDelegate); |
239 }; | 233 }; |
240 | 234 |
241 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ | 235 #endif // CHROME_BROWSER_NET_CHROME_NETWORK_DELEGATE_H_ |
OLD | NEW |