[email protected] | 4617d2da | 2012-01-13 20:46:49 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_IO_THREAD_H_ |
| 6 | #define CHROME_BROWSER_IO_THREAD_H_ |
| 7 | |
avi | 6846aef | 2015-12-26 01:09:38 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
tbansal | b177b539 | 2015-06-25 11:13:02 | [diff] [blame] | 11 | #include <map> |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 12 | #include <memory> |
bnc | a580cbcf4 | 2015-08-17 17:21:19 | [diff] [blame] | 13 | #include <set> |
[email protected] | bcefe0f | 2010-11-10 16:19:10 | [diff] [blame] | 14 | #include <string> |
rch | 74da0e1a | 2016-01-14 02:49:32 | [diff] [blame] | 15 | #include <unordered_set> |
[email protected] | d0389f6 | 2013-11-08 06:06:13 | [diff] [blame] | 16 | #include <vector> |
[email protected] | c38831a1 | 2011-10-28 12:44:49 | [diff] [blame] | 17 | |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 18 | #include "base/compiler_specific.h" |
avi | 6846aef | 2015-12-26 01:09:38 | [diff] [blame] | 19 | #include "base/macros.h" |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 20 | #include "base/memory/ref_counted.h" |
[email protected] | 21ee224e | 2011-11-21 02:17:53 | [diff] [blame] | 21 | #include "base/memory/weak_ptr.h" |
bnc | e3553d9 | 2014-10-30 22:29:45 | [diff] [blame] | 22 | #include "base/strings/string_piece.h" |
avi | 6846aef | 2015-12-26 01:09:38 | [diff] [blame] | 23 | #include "build/build_config.h" |
[email protected] | a702da7 | 2014-07-09 05:23:54 | [diff] [blame] | 24 | #include "chrome/browser/net/chrome_network_delegate.h" |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 25 | #include "chrome/browser/net/system_network_context_manager.h" |
sievers | 2f1e811 | 2015-12-04 18:43:56 | [diff] [blame] | 26 | #include "chrome/common/features.h" |
rajendrant | 14a5a85 | 2016-11-17 17:58:48 | [diff] [blame] | 27 | #include "components/metrics/data_use_tracker.h" |
brettw | b1fc1b8 | 2016-02-02 00:19:08 | [diff] [blame] | 28 | #include "components/prefs/pref_member.h" |
abhishek.a21 | 2849cee | 2015-10-20 11:27:29 | [diff] [blame] | 29 | #include "components/ssl_config/ssl_config_service_manager.h" |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 30 | #include "content/public/browser/browser_thread.h" |
| 31 | #include "content/public/browser/browser_thread_delegate.h" |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 32 | #include "content/public/common/network_service.mojom.h" |
| 33 | #include "content/public/network/network_service.h" |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 34 | #include "extensions/features/features.h" |
[email protected] | 58bc704 | 2010-07-07 18:04:14 | [diff] [blame] | 35 | #include "net/base/network_change_notifier.h" |
tbansal | 15973c3 | 2017-05-10 18:40:44 | [diff] [blame] | 36 | #include "net/nqe/network_quality_estimator.h" |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 37 | |
[email protected] | 53c5b0f | 2013-07-22 10:54:11 | [diff] [blame] | 38 | class PrefProxyConfigTracker; |
[email protected] | bcefe0f | 2010-11-10 16:19:10 | [diff] [blame] | 39 | class PrefService; |
[email protected] | b1de2c7 | 2013-02-06 02:45:47 | [diff] [blame] | 40 | class PrefRegistrySimple; |
Matt Menke | 21b9cc6 | 2017-08-23 15:45:45 | [diff] [blame^] | 41 | class SystemNetworkContextManager; |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 42 | |
zpeng | db4a58e | 2017-01-10 17:40:32 | [diff] [blame] | 43 | #if defined(OS_ANDROID) |
tbansal | 41fc4b7 | 2015-11-09 22:19:28 | [diff] [blame] | 44 | namespace chrome { |
| 45 | namespace android { |
| 46 | class ExternalDataUseObserver; |
| 47 | } |
| 48 | } |
zpeng | db4a58e | 2017-01-10 17:40:32 | [diff] [blame] | 49 | #endif // defined(OS_ANDROID) |
tbansal | 41fc4b7 | 2015-11-09 22:19:28 | [diff] [blame] | 50 | |
eranm | 3c2d643 | 2016-06-01 10:17:27 | [diff] [blame] | 51 | namespace certificate_transparency { |
| 52 | class TreeStateTracker; |
| 53 | } |
| 54 | |
[email protected] | 7613faae | 2012-04-18 01:01:19 | [diff] [blame] | 55 | namespace chrome_browser_net { |
[email protected] | 4588b3d | 2012-11-14 00:37:38 | [diff] [blame] | 56 | class DnsProbeService; |
[email protected] | 7613faae | 2012-04-18 01:01:19 | [diff] [blame] | 57 | } |
| 58 | |
sclittle | 3f98c6c | 2015-11-19 22:59:29 | [diff] [blame] | 59 | namespace data_usage { |
| 60 | class DataUseAggregator; |
| 61 | } |
| 62 | |
kundaji | f617523b | 2016-09-09 22:41:24 | [diff] [blame] | 63 | namespace data_use_measurement { |
| 64 | class ChromeDataUseAscriber; |
| 65 | } |
| 66 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 67 | namespace extensions { |
| 68 | class EventRouterForwarder; |
| 69 | } |
| 70 | |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 71 | namespace net { |
eranm | 1a79db2 | 2015-11-24 10:56:49 | [diff] [blame] | 72 | class CTLogVerifier; |
[email protected] | 1889dc1b | 2010-10-14 22:03:13 | [diff] [blame] | 73 | class HostResolver; |
mmenke | c2af595 | 2017-06-07 23:26:47 | [diff] [blame] | 74 | class HttpAuthHandlerFactory; |
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 75 | class HttpAuthPreferences; |
pauljensen | 7b34e52 | 2016-05-12 18:20:59 | [diff] [blame] | 76 | class LoggingNetworkChangeObserver; |
tbansal | ea2fb8c | 2015-05-22 22:23:00 | [diff] [blame] | 77 | class NetworkQualityEstimator; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 78 | class ProxyConfigService; |
tbansal | 1bd4a95 | 2017-06-06 23:01:46 | [diff] [blame] | 79 | class RTTAndThroughputEstimatesObserver; |
[email protected] | 2fb62920 | 2010-12-23 23:52:57 | [diff] [blame] | 80 | class SSLConfigService; |
[email protected] | 27a112c | 2011-01-06 04:19:30 | [diff] [blame] | 81 | class URLRequestContext; |
mmenke | 1c261ff | 2017-07-23 17:06:35 | [diff] [blame] | 82 | class URLRequestContextBuilderMojo; |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 83 | class URLRequestContextGetter; |
eranm | 3c2d643 | 2016-06-01 10:17:27 | [diff] [blame] | 84 | |
| 85 | namespace ct { |
| 86 | class STHObserver; |
| 87 | } |
| 88 | |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 89 | } // namespace net |
| 90 | |
droger | c690e880 | 2015-09-21 14:29:16 | [diff] [blame] | 91 | namespace net_log { |
| 92 | class ChromeNetLog; |
| 93 | } |
| 94 | |
[email protected] | 7730542 | 2012-11-29 16:51:39 | [diff] [blame] | 95 | namespace policy { |
| 96 | class PolicyService; |
| 97 | } // namespace policy |
| 98 | |
[email protected] | 488a0e25 | 2014-06-25 04:37:44 | [diff] [blame] | 99 | namespace test { |
| 100 | class IOThreadPeer; |
| 101 | } // namespace test |
| 102 | |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 103 | // Contains state associated with, initialized and cleaned up on, and |
[email protected] | dd48370 | 2011-12-02 14:47:42 | [diff] [blame] | 104 | // primarily used on, the IO thread. |
[email protected] | c92b861 | 2011-12-13 22:18:59 | [diff] [blame] | 105 | // |
| 106 | // If you are looking to interact with the IO thread (e.g. post tasks |
| 107 | // to it or check if it is the current thread), see |
| 108 | // content::BrowserThread. |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 109 | class IOThread : public content::BrowserThreadDelegate { |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 110 | public: |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 111 | struct Globals { |
[email protected] | c93123fa | 2012-04-19 02:49:48 | [diff] [blame] | 112 | class SystemRequestContextLeakChecker { |
| 113 | public: |
| 114 | explicit SystemRequestContextLeakChecker(Globals* globals); |
| 115 | ~SystemRequestContextLeakChecker(); |
| 116 | |
| 117 | private: |
| 118 | Globals* const globals_; |
| 119 | }; |
| 120 | |
[email protected] | 1889dc1b | 2010-10-14 22:03:13 | [diff] [blame] | 121 | Globals(); |
| 122 | ~Globals(); |
| 123 | |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 124 | // In-process NetworkService for use in URLRequestContext configuration when |
| 125 | // the network service created through the ServiceManager is disabled. See |
| 126 | // SystemNetworkContextManager's header comment for more details |
| 127 | std::unique_ptr<content::NetworkService> network_service; |
| 128 | |
kundaji | f617523b | 2016-09-09 22:41:24 | [diff] [blame] | 129 | // Ascribes all data use in Chrome to a source, such as page loads. |
| 130 | std::unique_ptr<data_use_measurement::ChromeDataUseAscriber> |
| 131 | data_use_ascriber; |
sclittle | 3f98c6c | 2015-11-19 22:59:29 | [diff] [blame] | 132 | // Global aggregator of data use. It must outlive the |
| 133 | // |system_network_delegate|. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 134 | std::unique_ptr<data_usage::DataUseAggregator> data_use_aggregator; |
zpeng | db4a58e | 2017-01-10 17:40:32 | [diff] [blame] | 135 | #if defined(OS_ANDROID) |
sclittle | 3f98c6c | 2015-11-19 22:59:29 | [diff] [blame] | 136 | // An external observer of data use. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 137 | std::unique_ptr<chrome::android::ExternalDataUseObserver> |
sclittle | 3f98c6c | 2015-11-19 22:59:29 | [diff] [blame] | 138 | external_data_use_observer; |
zpeng | db4a58e | 2017-01-10 17:40:32 | [diff] [blame] | 139 | #endif // defined(OS_ANDROID) |
eranm | 1a79db2 | 2015-11-24 10:56:49 | [diff] [blame] | 140 | std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs; |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 141 | std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences; |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 142 | std::unique_ptr<content::mojom::NetworkContext> system_network_context; |
| 143 | net::URLRequestContext* system_request_context; |
[email protected] | c93123fa | 2012-04-19 02:49:48 | [diff] [blame] | 144 | SystemRequestContextLeakChecker system_request_context_leak_checker; |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 145 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 146 | scoped_refptr<extensions::EventRouterForwarder> |
[email protected] | 3ce0241 | 2011-03-01 12:01:15 | [diff] [blame] | 147 | extension_event_router_forwarder; |
[email protected] | 84b7a55 | 2014-07-19 04:52:06 | [diff] [blame] | 148 | #endif |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 149 | std::unique_ptr<net::NetworkQualityEstimator> network_quality_estimator; |
tbansal | 1bd4a95 | 2017-06-06 23:01:46 | [diff] [blame] | 150 | std::unique_ptr<net::RTTAndThroughputEstimatesObserver> |
tbansal | 15973c3 | 2017-05-10 18:40:44 | [diff] [blame] | 151 | network_quality_observer; |
[email protected] | cf4cae3 | 2014-05-27 00:39:10 | [diff] [blame] | 152 | |
[email protected] | 4588b3d | 2012-11-14 00:37:38 | [diff] [blame] | 153 | // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a |
| 154 | // main frame load fails with a DNS error in order to provide more useful |
| 155 | // information to the renderer so it can show a more specific error page. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 156 | std::unique_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; |
maksim.sisov | 3d40c81 | 2016-05-02 13:27:16 | [diff] [blame] | 157 | |
| 158 | // Enables Brotli Content-Encoding support |
| 159 | bool enable_brotli; |
bnc | 18fb77f | 2016-04-04 20:54:04 | [diff] [blame] | 160 | }; |
| 161 | |
[email protected] | b2fcd0e | 2010-12-01 15:19:40 | [diff] [blame] | 162 | // |net_log| must either outlive the IOThread or be NULL. |
[email protected] | b1de2c7 | 2013-02-06 02:45:47 | [diff] [blame] | 163 | IOThread(PrefService* local_state, |
[email protected] | 7730542 | 2012-11-29 16:51:39 | [diff] [blame] | 164 | policy::PolicyService* policy_service, |
droger | c690e880 | 2015-09-21 14:29:16 | [diff] [blame] | 165 | net_log::ChromeNetLog* net_log, |
Matt Menke | 21b9cc6 | 2017-08-23 15:45:45 | [diff] [blame^] | 166 | extensions::EventRouterForwarder* extension_event_router_forwarder, |
| 167 | SystemNetworkContextManager* system_network_context_manager); |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 168 | |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 169 | ~IOThread() override; |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 170 | |
[email protected] | 3c319eb | 2013-02-21 14:44:45 | [diff] [blame] | 171 | static void RegisterPrefs(PrefRegistrySimple* registry); |
| 172 | |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 173 | // Can only be called on the IO thread. |
| 174 | Globals* globals(); |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 175 | |
[email protected] | 37ac95b | 2013-07-23 23:39:35 | [diff] [blame] | 176 | // Allows overriding Globals in tests where IOThread::Init() and |
| 177 | // IOThread::CleanUp() are not called. This allows for injecting mocks into |
| 178 | // IOThread global objects. |
| 179 | void SetGlobalsForTesting(Globals* globals); |
| 180 | |
droger | c690e880 | 2015-09-21 14:29:16 | [diff] [blame] | 181 | net_log::ChromeNetLog* net_log(); |
[email protected] | b2fcd0e | 2010-12-01 15:19:40 | [diff] [blame] | 182 | |
[email protected] | b09f76d6 | 2011-12-07 01:51:06 | [diff] [blame] | 183 | // Handles changing to On The Record mode, discarding confidential data. |
| 184 | void ChangedToOnTheRecord(); |
| 185 | |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 186 | // Returns a getter for the URLRequestContext. Only called on the UI thread. |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 187 | net::URLRequestContextGetter* system_url_request_context_getter(); |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 188 | |
msramek | 94f5656c | 2016-08-31 17:08:29 | [diff] [blame] | 189 | // Clears the host cache. Intended to be used to prevent exposing recently |
[email protected] | 67372ecf | 2011-09-10 01:30:46 | [diff] [blame] | 190 | // visited sites on about:net-internals/#dns and about:dns pages. Must be |
msramek | 94f5656c | 2016-08-31 17:08:29 | [diff] [blame] | 191 | // called on the IO thread. If |host_filter| is not null, only hosts matched |
| 192 | // by it are deleted from the cache. |
| 193 | void ClearHostCache( |
| 194 | const base::Callback<bool(const std::string&)>& host_filter); |
[email protected] | d6f37fc | 2011-02-13 23:58:41 | [diff] [blame] | 195 | |
Matt Menke | cfef87d | 2017-08-03 13:03:06 | [diff] [blame] | 196 | // Dynamically disables QUIC for all NetworkContexts using the IOThread's |
| 197 | // NetworkService. Re-enabling Quic dynamically is not supported for |
| 198 | // simplicity and requires a browser restart. May only be called on the IO |
| 199 | // thread. |
pmarko | 6ab8be24 | 2017-01-11 11:02:55 | [diff] [blame] | 200 | void DisableQuic(); |
| 201 | |
gayane | 0b46091c | 2016-04-07 21:01:05 | [diff] [blame] | 202 | // Returns the callback for updating data use prefs. |
robliao | 7253fd2 | 2016-12-01 18:41:38 | [diff] [blame] | 203 | metrics::UpdateUsagePrefCallbackType GetMetricsDataUseForwarder(); |
gayane | 0b46091c | 2016-04-07 21:01:05 | [diff] [blame] | 204 | |
eranm | 3c2d643 | 2016-06-01 10:17:27 | [diff] [blame] | 205 | // Registers the |observer| for new STH notifications. |
| 206 | void RegisterSTHObserver(net::ct::STHObserver* observer); |
| 207 | |
| 208 | // Un-registers the |observer|. |
| 209 | void UnregisterSTHObserver(net::ct::STHObserver* observer); |
| 210 | |
eroman | 9f7ea64 | 2016-06-03 21:28:29 | [diff] [blame] | 211 | // Returns true if the indicated proxy resolution features are |
| 212 | // enabled. These features are controlled through |
| 213 | // preferences/policy/commandline. |
| 214 | // |
| 215 | // For a description of what these features are, and how they are |
| 216 | // configured, see the comments in pref_names.cc for |
| 217 | // |kQuickCheckEnabled| and |kPacHttpsUrlStrippingEnabled |
| 218 | // respectively. |
| 219 | bool WpadQuickCheckEnabled() const; |
| 220 | bool PacHttpsUrlStrippingEnabled() const; |
| 221 | |
mmenke | 1c261ff | 2017-07-23 17:06:35 | [diff] [blame] | 222 | // Configures |builder|'s ProxyService to use the specified |
| 223 | // |proxy_config_service| and sets a number of proxy-related options based on |
| 224 | // prefs, policies, and the command line. |
| 225 | void SetUpProxyConfigService( |
| 226 | net::URLRequestContextBuilderMojo* builder, |
| 227 | std::unique_ptr<net::ProxyConfigService> proxy_config_service) const; |
| 228 | |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 229 | private: |
[email protected] | 488a0e25 | 2014-06-25 04:37:44 | [diff] [blame] | 230 | friend class test::IOThreadPeer; |
[email protected] | 488a0e25 | 2014-06-25 04:37:44 | [diff] [blame] | 231 | |
[email protected] | 2e5b60a2 | 2011-11-28 15:56:41 | [diff] [blame] | 232 | // BrowserThreadDelegate implementation, runs on the IO thread. |
| 233 | // This handles initialization and destruction of state that must |
| 234 | // live on the IO thread. |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 235 | void Init() override; |
Daniel Cheng | a542fca | 2014-10-21 09:51:29 | [diff] [blame] | 236 | void CleanUp() override; |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 237 | |
mmenke | c2af595 | 2017-06-07 23:26:47 | [diff] [blame] | 238 | std::unique_ptr<net::HttpAuthHandlerFactory> CreateDefaultAuthHandlerFactory( |
| 239 | net::HostResolver* host_resolver); |
[email protected] | eb3cac7 | 2010-02-26 21:07:45 | [diff] [blame] | 240 | |
[email protected] | 4d45a6de | 2011-05-13 05:20:18 | [diff] [blame] | 241 | // Returns an SSLConfigService instance. |
| 242 | net::SSLConfigService* GetSSLConfigService(); |
| 243 | |
[email protected] | b09f76d6 | 2011-12-07 01:51:06 | [diff] [blame] | 244 | void ChangedToOnTheRecordOnIOThread(); |
| 245 | |
[email protected] | fa4b6c3 | 2012-11-26 23:02:39 | [diff] [blame] | 246 | void UpdateDnsClientEnabled(); |
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 247 | void UpdateServerWhitelist(); |
| 248 | void UpdateDelegateWhitelist(); |
| 249 | void UpdateAndroidAuthNegotiateAccountType(); |
| 250 | void UpdateNegotiateDisableCnameLookup(); |
| 251 | void UpdateNegotiateEnablePort(); |
[email protected] | fa4b6c3 | 2012-11-26 23:02:39 | [diff] [blame] | 252 | |
[email protected] | 84b7a55 | 2014-07-19 04:52:06 | [diff] [blame] | 253 | extensions::EventRouterForwarder* extension_event_router_forwarder() { |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 254 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
[email protected] | 84b7a55 | 2014-07-19 04:52:06 | [diff] [blame] | 255 | return extension_event_router_forwarder_; |
| 256 | #else |
| 257 | return NULL; |
| 258 | #endif |
| 259 | } |
mmenke | f2e53b2 | 2017-05-15 18:40:18 | [diff] [blame] | 260 | void ConstructSystemRequestContext(); |
wjmaclean | ea309f7 | 2015-08-25 20:56:59 | [diff] [blame] | 261 | |
[email protected] | b2fcd0e | 2010-12-01 15:19:40 | [diff] [blame] | 262 | // The NetLog is owned by the browser process, to allow logging from other |
| 263 | // threads during shutdown, but is used most frequently on the IOThread. |
droger | c690e880 | 2015-09-21 14:29:16 | [diff] [blame] | 264 | net_log::ChromeNetLog* net_log_; |
[email protected] | b2fcd0e | 2010-12-01 15:19:40 | [diff] [blame] | 265 | |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 266 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 267 | // The extensions::EventRouterForwarder allows for sending events to |
| 268 | // extensions from the IOThread. |
| 269 | extensions::EventRouterForwarder* extension_event_router_forwarder_; |
[email protected] | 84b7a55 | 2014-07-19 04:52:06 | [diff] [blame] | 270 | #endif |
[email protected] | 3ce0241 | 2011-03-01 12:01:15 | [diff] [blame] | 271 | |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 272 | // These member variables are basically global, but their lifetimes are tied |
| 273 | // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
| 274 | // This is because the destructor of IOThread runs on the wrong thread. All |
[email protected] | b2fcd0e | 2010-12-01 15:19:40 | [diff] [blame] | 275 | // member variables should be deleted in CleanUp(). |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 276 | |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 277 | // These member variables are initialized in Init() and do not change for the |
| 278 | // lifetime of the IO thread. |
| 279 | |
| 280 | Globals* globals_; |
| 281 | |
[email protected] | 58bc704 | 2010-07-07 18:04:14 | [diff] [blame] | 282 | // Observer that logs network changes to the ChromeNetLog. |
pauljensen | 7b34e52 | 2016-05-12 18:20:59 | [diff] [blame] | 283 | std::unique_ptr<net::LoggingNetworkChangeObserver> network_change_observer_; |
[email protected] | 58bc704 | 2010-07-07 18:04:14 | [diff] [blame] | 284 | |
eranm | 3c2d643 | 2016-06-01 10:17:27 | [diff] [blame] | 285 | std::unique_ptr<certificate_transparency::TreeStateTracker> ct_tree_tracker_; |
| 286 | |
[email protected] | 0a8db0d | 2011-04-13 15:15:40 | [diff] [blame] | 287 | BooleanPrefMember system_enable_referrers_; |
| 288 | |
[email protected] | fa4b6c3 | 2012-11-26 23:02:39 | [diff] [blame] | 289 | BooleanPrefMember dns_client_enabled_; |
| 290 | |
[email protected] | 6737814 | 2013-12-17 21:57:17 | [diff] [blame] | 291 | BooleanPrefMember quick_check_enabled_; |
| 292 | |
eroman | 9f7ea64 | 2016-06-03 21:28:29 | [diff] [blame] | 293 | BooleanPrefMember pac_https_url_stripping_enabled_; |
| 294 | |
[email protected] | bcefe0f | 2010-11-10 16:19:10 | [diff] [blame] | 295 | // Store HTTP Auth-related policies in this thread. |
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 296 | // TODO(aberent) Make the list of auth schemes a PrefMember, so that the |
| 297 | // policy can change after startup (https://crbug/549273). |
[email protected] | bcefe0f | 2010-11-10 16:19:10 | [diff] [blame] | 298 | std::string auth_schemes_; |
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 299 | BooleanPrefMember negotiate_disable_cname_lookup_; |
| 300 | BooleanPrefMember negotiate_enable_port_; |
| 301 | StringPrefMember auth_server_whitelist_; |
| 302 | StringPrefMember auth_delegate_whitelist_; |
| 303 | |
| 304 | #if defined(OS_ANDROID) |
| 305 | StringPrefMember auth_android_negotiate_account_type_; |
| 306 | #endif |
| 307 | #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 308 | // No PrefMember for the GSSAPI library name, since changing it after startup |
| 309 | // requires unloading the existing GSSAPI library, which could cause all sorts |
| 310 | // of problems for, for example, active Negotiate transactions. |
[email protected] | ac7f3fdb | 2010-11-12 12:47:05 | [diff] [blame] | 311 | std::string gssapi_library_name_; |
aberent | bba302d | 2015-12-03 10:20:19 | [diff] [blame] | 312 | #endif |
[email protected] | bcefe0f | 2010-11-10 16:19:10 | [diff] [blame] | 313 | |
zentaro | e032635 | 2017-05-09 13:11:51 | [diff] [blame] | 314 | #if defined(OS_CHROMEOS) |
| 315 | bool allow_gssapi_library_load_; |
| 316 | #endif |
| 317 | |
mmenke | f73a512 | 2017-07-13 23:27:39 | [diff] [blame] | 318 | // These are set on the UI thread, and then consumed during initialization on |
| 319 | // the IO thread. |
| 320 | content::mojom::NetworkContextRequest network_context_request_; |
| 321 | content::mojom::NetworkContextParamsPtr network_context_params_; |
| 322 | |
[email protected] | 4d45a6de | 2011-05-13 05:20:18 | [diff] [blame] | 323 | // This is an instance of the default SSLConfigServiceManager for the current |
| 324 | // platform and it gets SSL preferences from local_state object. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 325 | std::unique_ptr<ssl_config::SSLConfigServiceManager> |
| 326 | ssl_config_service_manager_; |
[email protected] | 4d45a6de | 2011-05-13 05:20:18 | [diff] [blame] | 327 | |
[email protected] | d13c327 | 2010-02-04 00:24:51 | [diff] [blame] | 328 | // These member variables are initialized by a task posted to the IO thread, |
| 329 | // which gets posted by calling certain member functions of IOThread. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 330 | std::unique_ptr<net::ProxyConfigService> system_proxy_config_service_; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 331 | |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 332 | std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 333 | |
[email protected] | abe2c03 | 2011-03-31 18:49:34 | [diff] [blame] | 334 | scoped_refptr<net::URLRequestContextGetter> |
| 335 | system_url_request_context_getter_; |
[email protected] | db0e86dd | 2011-03-16 14:47:21 | [diff] [blame] | 336 | |
Matt Menke | cfef87d | 2017-08-03 13:03:06 | [diff] [blame] | 337 | // True if QUIC is initially enabled. |
| 338 | bool is_quic_allowed_on_init_; |
peletskyi | 5df83d4 | 2015-04-30 16:37:46 | [diff] [blame] | 339 | |
mohan.reddy | 14cb4ad4 | 2014-09-17 18:15:14 | [diff] [blame] | 340 | base::WeakPtrFactory<IOThread> weak_factory_; |
| 341 | |
[email protected] | 0ac8368 | 2010-01-22 17:46:27 | [diff] [blame] | 342 | DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 343 | }; |
| 344 | |
[email protected] | fa55e19 | 2010-02-15 14:25:50 | [diff] [blame] | 345 | #endif // CHROME_BROWSER_IO_THREAD_H_ |