OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_ | 5 #ifndef IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_ |
6 #define IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_ | 6 #define IOS_COMPONENTS_IO_THREAD_IOS_IO_THREAD_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "components/prefs/pref_member.h" | 22 #include "components/prefs/pref_member.h" |
23 #include "components/ssl_config/ssl_config_service_manager.h" | 23 #include "components/ssl_config/ssl_config_service_manager.h" |
24 #include "ios/web/public/web_thread_delegate.h" | 24 #include "ios/web/public/web_thread_delegate.h" |
25 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
26 #include "net/http/http_network_session.h" | 26 #include "net/http/http_network_session.h" |
27 | 27 |
28 class PrefProxyConfigTracker; | 28 class PrefProxyConfigTracker; |
29 class PrefService; | 29 class PrefService; |
30 | 30 |
31 namespace net { | 31 namespace net { |
32 class CTPolicyEnforcer; | |
33 class CertVerifier; | |
34 class ChannelIDService; | |
35 class CookieStore; | |
36 class CTVerifier; | |
37 class HostResolver; | |
38 class HttpAuthHandlerFactory; | |
39 class HttpAuthPreferences; | |
40 class HttpServerProperties; | |
41 class HttpTransactionFactory; | |
42 class HttpUserAgentSettings; | |
43 class NetworkDelegate; | 32 class NetworkDelegate; |
44 class ProxyConfigService; | 33 class ProxyConfigService; |
45 class ProxyService; | |
46 class SSLConfigService; | |
47 class TransportSecurityState; | |
48 class URLRequestContext; | 34 class URLRequestContext; |
49 class URLRequestContextGetter; | 35 class URLRequestContextGetter; |
50 class URLRequestJobFactory; | |
51 } // namespace net | 36 } // namespace net |
52 | 37 |
53 namespace net_log { | 38 namespace net_log { |
54 class ChromeNetLog; | 39 class ChromeNetLog; |
55 } // namespace net_log | 40 } // namespace net_log |
56 | 41 |
57 namespace io_thread { | 42 namespace io_thread { |
58 | 43 |
59 class SystemURLRequestContextGetter; | 44 class SystemURLRequestContextGetter; |
60 | 45 |
(...skipping 30 matching lines...) Expand all Loading... |
91 explicit SystemRequestContextLeakChecker(Globals* globals); | 76 explicit SystemRequestContextLeakChecker(Globals* globals); |
92 ~SystemRequestContextLeakChecker(); | 77 ~SystemRequestContextLeakChecker(); |
93 | 78 |
94 private: | 79 private: |
95 Globals* const globals_; | 80 Globals* const globals_; |
96 }; | 81 }; |
97 | 82 |
98 Globals(); | 83 Globals(); |
99 ~Globals(); | 84 ~Globals(); |
100 | 85 |
101 // The "system" NetworkDelegate, used for BrowserState-agnostic network | |
102 // events. | |
103 std::unique_ptr<net::NetworkDelegate> system_network_delegate; | |
104 std::unique_ptr<net::HostResolver> host_resolver; | |
105 std::unique_ptr<net::CertVerifier> cert_verifier; | 86 std::unique_ptr<net::CertVerifier> cert_verifier; |
106 // The ChannelIDService must outlive the HttpTransactionFactory. | 87 // The ChannelIDService must outlive the HttpTransactionFactory. |
107 std::unique_ptr<net::ChannelIDService> system_channel_id_service; | 88 std::unique_ptr<net::ChannelIDService> system_channel_id_service; |
108 // This TransportSecurityState doesn't load or save any state. It's only | |
109 // used to enforce pinning for system requests and will only use built-in | |
110 // pins. | |
111 std::unique_ptr<net::TransportSecurityState> transport_security_state; | |
112 std::unique_ptr<net::CTVerifier> cert_transparency_verifier; | 89 std::unique_ptr<net::CTVerifier> cert_transparency_verifier; |
113 scoped_refptr<net::SSLConfigService> ssl_config_service; | 90 scoped_refptr<net::SSLConfigService> ssl_config_service; |
114 std::unique_ptr<net::HttpAuthPreferences> http_auth_preferences; | |
115 std::unique_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | |
116 std::unique_ptr<net::HttpServerProperties> http_server_properties; | |
117 std::unique_ptr<net::ProxyService> system_proxy_service; | |
118 std::unique_ptr<net::HttpNetworkSession> system_http_network_session; | |
119 std::unique_ptr<net::HttpTransactionFactory> | |
120 system_http_transaction_factory; | |
121 std::unique_ptr<net::URLRequestJobFactory> system_url_request_job_factory; | |
122 std::unique_ptr<net::URLRequestContext> system_request_context; | 91 std::unique_ptr<net::URLRequestContext> system_request_context; |
123 SystemRequestContextLeakChecker system_request_context_leak_checker; | 92 SystemRequestContextLeakChecker system_request_context_leak_checker; |
124 std::unique_ptr<net::CookieStore> system_cookie_store; | |
125 std::unique_ptr<net::HttpUserAgentSettings> http_user_agent_settings; | |
126 std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer; | |
127 }; | 93 }; |
128 | 94 |
129 // |net_log| must either outlive the IOSIOThread or be NULL. | 95 // |net_log| must either outlive the IOSIOThread or be NULL. |
130 IOSIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log); | 96 IOSIOThread(PrefService* local_state, net_log::ChromeNetLog* net_log); |
131 ~IOSIOThread() override; | 97 ~IOSIOThread() override; |
132 | 98 |
133 // Can only be called on the IO thread. | 99 // Can only be called on the IO thread. |
134 Globals* globals(); | 100 Globals* globals(); |
135 | 101 |
136 // Allows overriding Globals in tests where IOSIOThread::Init() and | 102 // Allows overriding Globals in tests where IOSIOThread::Init() and |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // Provide SystemURLRequestContextGetter with access to | 136 // Provide SystemURLRequestContextGetter with access to |
171 // InitSystemRequestContext(). | 137 // InitSystemRequestContext(). |
172 friend class SystemURLRequestContextGetter; | 138 friend class SystemURLRequestContextGetter; |
173 | 139 |
174 // WebThreadDelegate implementation, runs on the IO thread. | 140 // WebThreadDelegate implementation, runs on the IO thread. |
175 // This handles initialization and destruction of state that must | 141 // This handles initialization and destruction of state that must |
176 // live on the IO thread. | 142 // live on the IO thread. |
177 void Init() override; | 143 void Init() override; |
178 void CleanUp() override; | 144 void CleanUp() override; |
179 | 145 |
180 // Sets up HttpAuthPreferences and HttpAuthHandlerFactory on Globals. | |
181 void CreateDefaultAuthHandlerFactory(); | |
182 | |
183 // Returns an SSLConfigService instance. | 146 // Returns an SSLConfigService instance. |
184 net::SSLConfigService* GetSSLConfigService(); | 147 net::SSLConfigService* GetSSLConfigService(); |
185 | 148 |
186 // Discards confidental data. To be called on IO thread only. | 149 // Discards confidental data. To be called on IO thread only. |
187 void ChangedToOnTheRecordOnIOThread(); | 150 void ChangedToOnTheRecordOnIOThread(); |
188 | 151 |
189 static net::URLRequestContext* ConstructSystemRequestContext( | |
190 Globals* globals, | |
191 const net::HttpNetworkSession::Params& params, | |
192 net::NetLog* net_log); | |
193 | |
194 // The NetLog is owned by the application context, to allow logging from other | 152 // The NetLog is owned by the application context, to allow logging from other |
195 // threads during shutdown, but is used most frequently on the IO thread. | 153 // threads during shutdown, but is used most frequently on the IO thread. |
196 net_log::ChromeNetLog* net_log_; | 154 net_log::ChromeNetLog* net_log_; |
197 | 155 |
198 // These member variables are basically global, but their lifetimes are tied | 156 // These member variables are basically global, but their lifetimes are tied |
199 // to the IOSIOThread. IOSIOThread owns them all, despite not using | 157 // to the IOSIOThread. IOSIOThread owns them all, despite not using |
200 // scoped_ptr. This is because the destructor of IOSIOThread runs on the | 158 // scoped_ptr. This is because the destructor of IOSIOThread runs on the |
201 // wrong thread. All member variables should be deleted in CleanUp(). | 159 // wrong thread. All member variables should be deleted in CleanUp(). |
202 | 160 |
203 // These member variables are initialized in Init() and do not change for the | 161 // These member variables are initialized in Init() and do not change for the |
(...skipping 24 matching lines...) Expand all Loading... |
228 const base::TimeTicks creation_time_; | 186 const base::TimeTicks creation_time_; |
229 | 187 |
230 base::WeakPtrFactory<IOSIOThread> weak_factory_; | 188 base::WeakPtrFactory<IOSIOThread> weak_factory_; |
231 | 189 |
232 DISALLOW_COPY_AND_ASSIGN(IOSIOThread); | 190 DISALLOW_COPY_AND_ASSIGN(IOSIOThread); |
233 }; | 191 }; |
234 | 192 |
235 } // namespace io_thread | 193 } // namespace io_thread |
236 | 194 |
237 #endif // IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_ | 195 #endif // IOS_COMPONENTS_IO_THREAD_IO_THREAD_H_ |
OLD | NEW |