| 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_IO_THREAD_H_ | 5 #ifndef CHROME_BROWSER_IO_THREAD_H_ |
| 6 #define CHROME_BROWSER_IO_THREAD_H_ | 6 #define CHROME_BROWSER_IO_THREAD_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/common/features.h" | 26 #include "chrome/common/features.h" |
| 27 #include "components/metrics/data_use_tracker.h" | 27 #include "components/metrics/data_use_tracker.h" |
| 28 #include "components/prefs/pref_member.h" | 28 #include "components/prefs/pref_member.h" |
| 29 #include "components/ssl_config/ssl_config_service_manager.h" | 29 #include "components/ssl_config/ssl_config_service_manager.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/browser_thread_delegate.h" | 31 #include "content/public/browser/browser_thread_delegate.h" |
| 32 #include "extensions/features/features.h" | 32 #include "extensions/features/features.h" |
| 33 #include "net/base/network_change_notifier.h" | 33 #include "net/base/network_change_notifier.h" |
| 34 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
| 35 #include "net/nqe/network_quality_estimator.h" | 35 #include "net/nqe/network_quality_estimator.h" |
| 36 #include "net/url_request/url_request_context_builder.h" |
| 36 | 37 |
| 37 class PrefProxyConfigTracker; | 38 class PrefProxyConfigTracker; |
| 38 class PrefService; | 39 class PrefService; |
| 39 class PrefRegistrySimple; | 40 class PrefRegistrySimple; |
| 40 | 41 |
| 41 #if defined(OS_ANDROID) | 42 #if defined(OS_ANDROID) |
| 42 namespace chrome { | 43 namespace chrome { |
| 43 namespace android { | 44 namespace android { |
| 44 class ExternalDataUseObserver; | 45 class ExternalDataUseObserver; |
| 45 } | 46 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 194 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
| 194 net::URLRequestContextGetter* system_url_request_context_getter(); | 195 net::URLRequestContextGetter* system_url_request_context_getter(); |
| 195 | 196 |
| 196 // Clears the host cache. Intended to be used to prevent exposing recently | 197 // Clears the host cache. Intended to be used to prevent exposing recently |
| 197 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 198 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
| 198 // called on the IO thread. If |host_filter| is not null, only hosts matched | 199 // called on the IO thread. If |host_filter| is not null, only hosts matched |
| 199 // by it are deleted from the cache. | 200 // by it are deleted from the cache. |
| 200 void ClearHostCache( | 201 void ClearHostCache( |
| 201 const base::Callback<bool(const std::string&)>& host_filter); | 202 const base::Callback<bool(const std::string&)>& host_filter); |
| 202 | 203 |
| 203 const net::HttpNetworkSession::Params& NetworkSessionParams() const; | 204 net::HttpNetworkSession::Params NetworkSessionParams() const; |
| 204 | 205 |
| 205 // Dynamically disables QUIC for HttpNetworkSessions owned by io_thread, and | 206 // Dynamically disables QUIC for HttpNetworkSessions owned by io_thread, and |
| 206 // to HttpNetworkSession::Params which are used for the creation of new | 207 // to |params_| which are used for the creation of new |
| 207 // HttpNetworkSessions. Not that re-enabling Quic dynamically is not | 208 // HttpNetworkSessions. Note that re-enabling Quic dynamically is not |
| 208 // supported for simplicity and requires a browser restart. | 209 // supported for simplicity and requires a browser restart. |
| 209 void DisableQuic(); | 210 void DisableQuic(); |
| 210 | 211 |
| 211 base::TimeTicks creation_time() const; | 212 base::TimeTicks creation_time() const; |
| 212 | 213 |
| 213 // Returns the callback for updating data use prefs. | 214 // Returns the callback for updating data use prefs. |
| 214 metrics::UpdateUsagePrefCallbackType GetMetricsDataUseForwarder(); | 215 metrics::UpdateUsagePrefCallbackType GetMetricsDataUseForwarder(); |
| 215 | 216 |
| 216 // Registers the |observer| for new STH notifications. | 217 // Registers the |observer| for new STH notifications. |
| 217 void RegisterSTHObserver(net::ct::STHObserver* observer); | 218 void RegisterSTHObserver(net::ct::STHObserver* observer); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 #endif | 263 #endif |
| 263 } | 264 } |
| 264 void ConstructSystemRequestContext(); | 265 void ConstructSystemRequestContext(); |
| 265 | 266 |
| 266 // Parse command line flags and use components/network_session_configurator to | 267 // Parse command line flags and use components/network_session_configurator to |
| 267 // configure |params|. | 268 // configure |params|. |
| 268 static void ConfigureParamsFromFieldTrialsAndCommandLine( | 269 static void ConfigureParamsFromFieldTrialsAndCommandLine( |
| 269 const base::CommandLine& command_line, | 270 const base::CommandLine& command_line, |
| 270 bool is_quic_allowed_by_policy, | 271 bool is_quic_allowed_by_policy, |
| 271 bool http_09_on_non_default_ports_enabled, | 272 bool http_09_on_non_default_ports_enabled, |
| 272 net::HttpNetworkSession::Params* params); | 273 net::URLRequestContextBuilder::HttpNetworkSessionParams* params); |
| 273 | 274 |
| 274 // The NetLog is owned by the browser process, to allow logging from other | 275 // The NetLog is owned by the browser process, to allow logging from other |
| 275 // threads during shutdown, but is used most frequently on the IOThread. | 276 // threads during shutdown, but is used most frequently on the IOThread. |
| 276 net_log::ChromeNetLog* net_log_; | 277 net_log::ChromeNetLog* net_log_; |
| 277 | 278 |
| 278 #if BUILDFLAG(ENABLE_EXTENSIONS) | 279 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 279 // The extensions::EventRouterForwarder allows for sending events to | 280 // The extensions::EventRouterForwarder allows for sending events to |
| 280 // extensions from the IOThread. | 281 // extensions from the IOThread. |
| 281 extensions::EventRouterForwarder* extension_event_router_forwarder_; | 282 extensions::EventRouterForwarder* extension_event_router_forwarder_; |
| 282 #endif | 283 #endif |
| 283 | 284 |
| 284 // These member variables are basically global, but their lifetimes are tied | 285 // These member variables are basically global, but their lifetimes are tied |
| 285 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. | 286 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
| 286 // This is because the destructor of IOThread runs on the wrong thread. All | 287 // This is because the destructor of IOThread runs on the wrong thread. All |
| 287 // member variables should be deleted in CleanUp(). | 288 // member variables should be deleted in CleanUp(). |
| 288 | 289 |
| 289 // These member variables are initialized in Init() and do not change for the | 290 // These member variables are initialized in Init() and do not change for the |
| 290 // lifetime of the IO thread. | 291 // lifetime of the IO thread. |
| 291 | 292 |
| 292 Globals* globals_; | 293 Globals* globals_; |
| 293 | 294 |
| 294 net::HttpNetworkSession::Params params_; | 295 net::URLRequestContextBuilder::HttpNetworkSessionParams params_; |
| 295 | 296 |
| 296 // Observer that logs network changes to the ChromeNetLog. | 297 // Observer that logs network changes to the ChromeNetLog. |
| 297 std::unique_ptr<net::LoggingNetworkChangeObserver> network_change_observer_; | 298 std::unique_ptr<net::LoggingNetworkChangeObserver> network_change_observer_; |
| 298 | 299 |
| 299 std::unique_ptr<certificate_transparency::TreeStateTracker> ct_tree_tracker_; | 300 std::unique_ptr<certificate_transparency::TreeStateTracker> ct_tree_tracker_; |
| 300 | 301 |
| 301 BooleanPrefMember system_enable_referrers_; | 302 BooleanPrefMember system_enable_referrers_; |
| 302 | 303 |
| 303 BooleanPrefMember dns_client_enabled_; | 304 BooleanPrefMember dns_client_enabled_; |
| 304 | 305 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 bool http_09_on_non_default_ports_enabled_; | 351 bool http_09_on_non_default_ports_enabled_; |
| 351 | 352 |
| 352 const base::TimeTicks creation_time_; | 353 const base::TimeTicks creation_time_; |
| 353 | 354 |
| 354 base::WeakPtrFactory<IOThread> weak_factory_; | 355 base::WeakPtrFactory<IOThread> weak_factory_; |
| 355 | 356 |
| 356 DISALLOW_COPY_AND_ASSIGN(IOThread); | 357 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 357 }; | 358 }; |
| 358 | 359 |
| 359 #endif // CHROME_BROWSER_IO_THREAD_H_ | 360 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |