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 EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
16 #include "extensions/browser/extension_throttle_entry.h" | 16 #include "extensions/browser/extension_throttle_entry.h" |
17 #include "net/base/backoff_entry.h" | 17 #include "net/base/backoff_entry.h" |
18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
19 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 class ResourceThrottle; | 23 class ResourceThrottle; |
24 } | 24 } |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 class BoundNetLog; | 27 class NetLogWithSource; |
28 class NetLog; | 28 class NetLog; |
29 } | 29 } |
30 | 30 |
31 namespace extensions { | 31 namespace extensions { |
32 | 32 |
33 // Class that registers URL request throttler entries for URLs being accessed | 33 // Class that registers URL request throttler entries for URLs being accessed |
34 // in order to supervise traffic. URL requests for HTTP contents should | 34 // in order to supervise traffic. URL requests for HTTP contents should |
35 // register their URLs in this manager on each request. | 35 // register their URLs in this manager on each request. |
36 // | 36 // |
37 // ExtensionThrottleManager maintains a map of URL IDs to URL request | 37 // ExtensionThrottleManager maintains a map of URL IDs to URL request |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // | 161 // |
162 // TODO(joi): See if we can fix the offending unit tests and remove this | 162 // TODO(joi): See if we can fix the offending unit tests and remove this |
163 // workaround. | 163 // workaround. |
164 bool enable_thread_checks_; | 164 bool enable_thread_checks_; |
165 | 165 |
166 // Initially false, switches to true once we have logged because of back-off | 166 // Initially false, switches to true once we have logged because of back-off |
167 // being disabled for localhost. | 167 // being disabled for localhost. |
168 bool logged_for_localhost_disabled_; | 168 bool logged_for_localhost_disabled_; |
169 | 169 |
170 // net::NetLog to use, if configured. | 170 // net::NetLog to use, if configured. |
171 net::BoundNetLog net_log_; | 171 net::NetLogWithSource net_log_; |
172 | 172 |
173 // Valid once we've registered for network notifications. | 173 // Valid once we've registered for network notifications. |
174 base::PlatformThreadId registered_from_thread_; | 174 base::PlatformThreadId registered_from_thread_; |
175 | 175 |
176 bool ignore_user_gesture_load_flag_for_tests_; | 176 bool ignore_user_gesture_load_flag_for_tests_; |
177 | 177 |
178 // This is NULL when it is not set for tests. | 178 // This is NULL when it is not set for tests. |
179 std::unique_ptr<net::BackoffEntry::Policy> backoff_policy_for_tests_; | 179 std::unique_ptr<net::BackoffEntry::Policy> backoff_policy_for_tests_; |
180 | 180 |
181 DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleManager); | 181 DISALLOW_COPY_AND_ASSIGN(ExtensionThrottleManager); |
182 }; | 182 }; |
183 | 183 |
184 } // namespace extensions | 184 } // namespace extensions |
185 | 185 |
186 #endif // EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ | 186 #endif // EXTENSIONS_BROWSER_EXTENSION_THROTTLE_MANAGER_H_ |
OLD | NEW |