| 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 19 matching lines...) Expand all Loading... |
| 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 | 36 |
| 37 class PrefProxyConfigTracker; | 37 class PrefProxyConfigTracker; |
| 38 class PrefService; | 38 class PrefService; |
| 39 class PrefRegistrySimple; | 39 class PrefRegistrySimple; |
| 40 class SystemURLRequestContextGetter; |
| 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 } |
| 46 } | 47 } |
| 47 #endif // defined(OS_ANDROID) | 48 #endif // defined(OS_ANDROID) |
| 48 | 49 |
| 49 namespace base { | 50 namespace base { |
| 50 class CommandLine; | 51 class CommandLine; |
| 51 } | 52 } |
| 52 | 53 |
| 53 namespace certificate_transparency { | 54 namespace certificate_transparency { |
| 54 class TreeStateTracker; | 55 class TreeStateTracker; |
| 55 } | 56 } |
| 56 | 57 |
| 57 namespace chrome { | |
| 58 class TestingIOThreadState; | |
| 59 } | |
| 60 | |
| 61 namespace chrome_browser_net { | 58 namespace chrome_browser_net { |
| 62 class DnsProbeService; | 59 class DnsProbeService; |
| 63 } | 60 } |
| 64 | 61 |
| 65 namespace data_usage { | 62 namespace data_usage { |
| 66 class DataUseAggregator; | 63 class DataUseAggregator; |
| 67 } | 64 } |
| 68 | 65 |
| 69 namespace data_use_measurement { | 66 namespace data_use_measurement { |
| 70 class ChromeDataUseAscriber; | 67 class ChromeDataUseAscriber; |
| 71 } | 68 } |
| 72 | 69 |
| 73 namespace extensions { | 70 namespace extensions { |
| 74 class EventRouterForwarder; | 71 class EventRouterForwarder; |
| 75 } | 72 } |
| 76 | 73 |
| 77 namespace net { | 74 namespace net { |
| 78 class CTPolicyEnforcer; | 75 class CTPolicyEnforcer; |
| 79 class CertVerifier; | 76 class CertVerifier; |
| 77 class ChannelIDService; |
| 78 class CookieStore; |
| 80 class CTLogVerifier; | 79 class CTLogVerifier; |
| 81 class HostMappingRules; | 80 class HostMappingRules; |
| 82 class HostResolver; | 81 class HostResolver; |
| 83 class HttpAuthPreferences; | 82 class HttpAuthPreferences; |
| 84 class HttpServerProperties; | 83 class HttpServerProperties; |
| 85 class HttpTransactionFactory; | 84 class HttpTransactionFactory; |
| 86 class HttpUserAgentSettings; | 85 class HttpUserAgentSettings; |
| 87 class LoggingNetworkChangeObserver; | 86 class LoggingNetworkChangeObserver; |
| 88 class NetworkDelegate; | 87 class NetworkDelegate; |
| 89 class NetworkQualityEstimator; | 88 class NetworkQualityEstimator; |
| 90 class ProxyConfigService; | 89 class ProxyConfigService; |
| 91 class ProxyService; | 90 class ProxyService; |
| 92 class SSLConfigService; | 91 class SSLConfigService; |
| 93 class TransportSecurityState; | 92 class TransportSecurityState; |
| 94 class URLRequestContext; | 93 class URLRequestContext; |
| 95 class URLRequestContextGetter; | 94 class URLRequestContextGetter; |
| 96 class URLRequestContextStorage; | |
| 97 class URLRequestJobFactory; | 95 class URLRequestJobFactory; |
| 98 | 96 |
| 99 namespace ct { | 97 namespace ct { |
| 100 class STHObserver; | 98 class STHObserver; |
| 101 } | 99 } |
| 102 | 100 |
| 103 } // namespace net | 101 } // namespace net |
| 104 | 102 |
| 105 namespace net_log { | 103 namespace net_log { |
| 106 class ChromeNetLog; | 104 class ChromeNetLog; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 std::unique_ptr<data_usage::DataUseAggregator> data_use_aggregator; | 141 std::unique_ptr<data_usage::DataUseAggregator> data_use_aggregator; |
| 144 #if defined(OS_ANDROID) | 142 #if defined(OS_ANDROID) |
| 145 // An external observer of data use. | 143 // An external observer of data use. |
| 146 std::unique_ptr<chrome::android::ExternalDataUseObserver> | 144 std::unique_ptr<chrome::android::ExternalDataUseObserver> |
| 147 external_data_use_observer; | 145 external_data_use_observer; |
| 148 #endif // defined(OS_ANDROID) | 146 #endif // defined(OS_ANDROID) |
| 149 // The "system" NetworkDelegate, used for Profile-agnostic network events. | 147 // The "system" NetworkDelegate, used for Profile-agnostic network events. |
| 150 std::unique_ptr<net::NetworkDelegate> system_network_delegate; | 148 std::unique_ptr<net::NetworkDelegate> system_network_delegate; |
| 151 std::unique_ptr<net::HostResolver> host_resolver; | 149 std::unique_ptr<net::HostResolver> host_resolver; |
| 152 std::unique_ptr<net::CertVerifier> cert_verifier; | 150 std::unique_ptr<net::CertVerifier> cert_verifier; |
| 151 // The ChannelIDService must outlive the HttpTransactionFactory. |
| 152 std::unique_ptr<net::ChannelIDService> system_channel_id_service; |
| 153 // This TransportSecurityState doesn't load or save any state. It's only | 153 // This TransportSecurityState doesn't load or save any state. It's only |
| 154 // used to enforce pinning for system requests and will only use built-in | 154 // used to enforce pinning for system requests and will only use built-in |
| 155 // pins. | 155 // pins. |
| 156 std::unique_ptr<net::TransportSecurityState> transport_security_state; | 156 std::unique_ptr<net::TransportSecurityState> transport_security_state; |
| 157 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs; | 157 std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs; |
| 158 std::unique_ptr<net::CTVerifier> cert_transparency_verifier; | 158 std::unique_ptr<net::CTVerifier> cert_transparency_verifier; |
| 159 std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer; | 159 std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer; |
| 160 scoped_refptr<net::SSLConfigService> ssl_config_service; | 160 scoped_refptr<net::SSLConfigService> ssl_config_service; |
| 161 std::unique_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 161 std::unique_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
| 162 std::unique_ptr<net::HttpServerProperties> http_server_properties; | 162 std::unique_ptr<net::HttpServerProperties> http_server_properties; |
| 163 std::unique_ptr<net::ProxyService> proxy_script_fetcher_proxy_service; | 163 std::unique_ptr<net::ProxyService> proxy_script_fetcher_proxy_service; |
| 164 std::unique_ptr<net::HttpNetworkSession> | 164 std::unique_ptr<net::HttpNetworkSession> |
| 165 proxy_script_fetcher_http_network_session; | 165 proxy_script_fetcher_http_network_session; |
| 166 std::unique_ptr<net::HttpTransactionFactory> | 166 std::unique_ptr<net::HttpTransactionFactory> |
| 167 proxy_script_fetcher_http_transaction_factory; | 167 proxy_script_fetcher_http_transaction_factory; |
| 168 std::unique_ptr<net::URLRequestJobFactory> | 168 std::unique_ptr<net::URLRequestJobFactory> |
| 169 proxy_script_fetcher_url_request_job_factory; | 169 proxy_script_fetcher_url_request_job_factory; |
| 170 std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences; | 170 std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences; |
| 171 // TODO(willchan): Remove proxy script fetcher context since it's not | 171 // TODO(willchan): Remove proxy script fetcher context since it's not |
| 172 // necessary now that I got rid of refcounting URLRequestContexts. | 172 // necessary now that I got rid of refcounting URLRequestContexts. |
| 173 // | 173 // |
| 174 // The first URLRequestContext is |system_url_request_context|. We introduce | 174 // The first URLRequestContext is |system_url_request_context|. We introduce |
| 175 // |proxy_script_fetcher_context| for the second context. It has a direct | 175 // |proxy_script_fetcher_context| for the second context. It has a direct |
| 176 // ProxyService, since we always directly connect to fetch the PAC script. | 176 // ProxyService, since we always directly connect to fetch the PAC script. |
| 177 std::unique_ptr<net::URLRequestContext> proxy_script_fetcher_context; | 177 std::unique_ptr<net::URLRequestContext> proxy_script_fetcher_context; |
| 178 std::unique_ptr<net::URLRequestContextStorage> | 178 std::unique_ptr<net::ProxyService> system_proxy_service; |
| 179 system_request_context_storage; | 179 std::unique_ptr<net::HttpNetworkSession> system_http_network_session; |
| 180 std::unique_ptr<net::HttpTransactionFactory> |
| 181 system_http_transaction_factory; |
| 182 std::unique_ptr<net::URLRequestJobFactory> system_url_request_job_factory; |
| 180 std::unique_ptr<net::URLRequestContext> system_request_context; | 183 std::unique_ptr<net::URLRequestContext> system_request_context; |
| 181 SystemRequestContextLeakChecker system_request_context_leak_checker; | 184 SystemRequestContextLeakChecker system_request_context_leak_checker; |
| 185 // |system_cookie_store| and |system_channel_id_service| are shared |
| 186 // between |proxy_script_fetcher_context| and |system_request_context|. |
| 187 std::unique_ptr<net::CookieStore> system_cookie_store; |
| 182 #if BUILDFLAG(ENABLE_EXTENSIONS) | 188 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 183 scoped_refptr<extensions::EventRouterForwarder> | 189 scoped_refptr<extensions::EventRouterForwarder> |
| 184 extension_event_router_forwarder; | 190 extension_event_router_forwarder; |
| 185 #endif | 191 #endif |
| 186 std::unique_ptr<net::HostMappingRules> host_mapping_rules; | 192 std::unique_ptr<net::HostMappingRules> host_mapping_rules; |
| 187 std::unique_ptr<net::HttpUserAgentSettings> http_user_agent_settings; | 193 std::unique_ptr<net::HttpUserAgentSettings> http_user_agent_settings; |
| 188 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator; | 194 std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator; |
| 189 std::unique_ptr< | 195 std::unique_ptr< |
| 190 net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver> | 196 net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver> |
| 191 network_quality_observer; | 197 network_quality_observer; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 // preferences/policy/commandline. | 262 // preferences/policy/commandline. |
| 257 // | 263 // |
| 258 // For a description of what these features are, and how they are | 264 // For a description of what these features are, and how they are |
| 259 // configured, see the comments in pref_names.cc for | 265 // configured, see the comments in pref_names.cc for |
| 260 // |kQuickCheckEnabled| and |kPacHttpsUrlStrippingEnabled | 266 // |kQuickCheckEnabled| and |kPacHttpsUrlStrippingEnabled |
| 261 // respectively. | 267 // respectively. |
| 262 bool WpadQuickCheckEnabled() const; | 268 bool WpadQuickCheckEnabled() const; |
| 263 bool PacHttpsUrlStrippingEnabled() const; | 269 bool PacHttpsUrlStrippingEnabled() const; |
| 264 | 270 |
| 265 private: | 271 private: |
| 272 // Provide SystemURLRequestContextGetter with access to |
| 273 // InitSystemRequestContext(). |
| 274 friend class SystemURLRequestContextGetter; |
| 275 |
| 266 friend class test::IOThreadPeer; | 276 friend class test::IOThreadPeer; |
| 267 friend class chrome::TestingIOThreadState; | |
| 268 | 277 |
| 269 // BrowserThreadDelegate implementation, runs on the IO thread. | 278 // BrowserThreadDelegate implementation, runs on the IO thread. |
| 270 // This handles initialization and destruction of state that must | 279 // This handles initialization and destruction of state that must |
| 271 // live on the IO thread. | 280 // live on the IO thread. |
| 272 void Init() override; | 281 void Init() override; |
| 273 void CleanUp() override; | 282 void CleanUp() override; |
| 274 | 283 |
| 284 // Global state must be initialized on the IO thread, then this |
| 285 // method must be invoked on the UI thread. |
| 286 void InitSystemRequestContext(); |
| 287 |
| 288 // Lazy initialization of system request context for |
| 289 // SystemURLRequestContextGetter. To be called on IO thread only |
| 290 // after global state has been initialized on the IO thread, and |
| 291 // SystemRequestContext state has been initialized on the UI thread. |
| 292 void InitSystemRequestContextOnIOThread(); |
| 293 |
| 275 void CreateDefaultAuthHandlerFactory(); | 294 void CreateDefaultAuthHandlerFactory(); |
| 276 | 295 |
| 277 // Returns an SSLConfigService instance. | 296 // Returns an SSLConfigService instance. |
| 278 net::SSLConfigService* GetSSLConfigService(); | 297 net::SSLConfigService* GetSSLConfigService(); |
| 279 | 298 |
| 280 void ChangedToOnTheRecordOnIOThread(); | 299 void ChangedToOnTheRecordOnIOThread(); |
| 281 | 300 |
| 282 void UpdateDnsClientEnabled(); | 301 void UpdateDnsClientEnabled(); |
| 283 void UpdateServerWhitelist(); | 302 void UpdateServerWhitelist(); |
| 284 void UpdateDelegateWhitelist(); | 303 void UpdateDelegateWhitelist(); |
| 285 void UpdateAndroidAuthNegotiateAccountType(); | 304 void UpdateAndroidAuthNegotiateAccountType(); |
| 286 void UpdateNegotiateDisableCnameLookup(); | 305 void UpdateNegotiateDisableCnameLookup(); |
| 287 void UpdateNegotiateEnablePort(); | 306 void UpdateNegotiateEnablePort(); |
| 288 | 307 |
| 289 extensions::EventRouterForwarder* extension_event_router_forwarder() { | 308 extensions::EventRouterForwarder* extension_event_router_forwarder() { |
| 290 #if BUILDFLAG(ENABLE_EXTENSIONS) | 309 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 291 return extension_event_router_forwarder_; | 310 return extension_event_router_forwarder_; |
| 292 #else | 311 #else |
| 293 return NULL; | 312 return NULL; |
| 294 #endif | 313 #endif |
| 295 } | 314 } |
| 296 void ConstructSystemRequestContext(); | 315 static net::URLRequestContext* ConstructSystemRequestContext( |
| 316 IOThread::Globals* globals, |
| 317 const net::HttpNetworkSession::Params& params, |
| 318 net::NetLog* net_log); |
| 297 | 319 |
| 298 // Parse command line flags and use components/network_session_configurator to | 320 // Parse command line flags and use components/network_session_configurator to |
| 299 // configure |params|. | 321 // configure |params|. |
| 300 static void ConfigureParamsFromFieldTrialsAndCommandLine( | 322 static void ConfigureParamsFromFieldTrialsAndCommandLine( |
| 301 const base::CommandLine& command_line, | 323 const base::CommandLine& command_line, |
| 302 bool is_quic_allowed_by_policy, | 324 bool is_quic_allowed_by_policy, |
| 303 bool http_09_on_non_default_ports_enabled, | 325 bool http_09_on_non_default_ports_enabled, |
| 304 net::HttpNetworkSession::Params* params); | 326 net::HttpNetworkSession::Params* params); |
| 305 | 327 |
| 306 // TODO(willchan): Remove proxy script fetcher context since it's not | 328 // TODO(willchan): Remove proxy script fetcher context since it's not |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 bool http_09_on_non_default_ports_enabled_; | 412 bool http_09_on_non_default_ports_enabled_; |
| 391 | 413 |
| 392 const base::TimeTicks creation_time_; | 414 const base::TimeTicks creation_time_; |
| 393 | 415 |
| 394 base::WeakPtrFactory<IOThread> weak_factory_; | 416 base::WeakPtrFactory<IOThread> weak_factory_; |
| 395 | 417 |
| 396 DISALLOW_COPY_AND_ASSIGN(IOThread); | 418 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 397 }; | 419 }; |
| 398 | 420 |
| 399 #endif // CHROME_BROWSER_IO_THREAD_H_ | 421 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |