| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "chrome/browser/browser_process_sub_thread.h" | 14 #include "chrome/browser/browser_process_sub_thread.h" |
| 15 #include "chrome/browser/net/spdy_config_service_manager.h" |
| 15 #include "chrome/browser/net/ssl_config_service_manager.h" | 16 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 16 #include "chrome/browser/prefs/pref_member.h" | 17 #include "chrome/browser/prefs/pref_member.h" |
| 17 #include "chrome/common/net/predictor_common.h" | 18 #include "chrome/common/net/predictor_common.h" |
| 18 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
| 19 | 20 |
| 20 class ChromeNetLog; | 21 class ChromeNetLog; |
| 21 class ChromeURLRequestContextGetter; | 22 class ChromeURLRequestContextGetter; |
| 22 class ExtensionEventRouterForwarder; | 23 class ExtensionEventRouterForwarder; |
| 23 class MediaInternals; | 24 class MediaInternals; |
| 24 class PrefProxyConfigTracker; | 25 class PrefProxyConfigTracker; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 class CookieStore; | 40 class CookieStore; |
| 40 class DnsRRResolver; | 41 class DnsRRResolver; |
| 41 class FtpTransactionFactory; | 42 class FtpTransactionFactory; |
| 42 class HostResolver; | 43 class HostResolver; |
| 43 class HttpAuthHandlerFactory; | 44 class HttpAuthHandlerFactory; |
| 44 class HttpTransactionFactory; | 45 class HttpTransactionFactory; |
| 45 class NetworkDelegate; | 46 class NetworkDelegate; |
| 46 class OriginBoundCertService; | 47 class OriginBoundCertService; |
| 47 class ProxyConfigService; | 48 class ProxyConfigService; |
| 48 class ProxyService; | 49 class ProxyService; |
| 50 class SpdyConfigService; |
| 49 class SSLConfigService; | 51 class SSLConfigService; |
| 50 class URLRequestContext; | 52 class URLRequestContext; |
| 51 class URLRequestContextGetter; | 53 class URLRequestContextGetter; |
| 52 class URLSecurityManager; | 54 class URLSecurityManager; |
| 53 } // namespace net | 55 } // namespace net |
| 54 | 56 |
| 55 class IOThread : public BrowserProcessSubThread { | 57 class IOThread : public BrowserProcessSubThread { |
| 56 public: | 58 public: |
| 57 struct Globals { | 59 struct Globals { |
| 58 Globals(); | 60 Globals(); |
| 59 ~Globals(); | 61 ~Globals(); |
| 60 | 62 |
| 61 struct MediaGlobals { | 63 struct MediaGlobals { |
| 62 MediaGlobals(); | 64 MediaGlobals(); |
| 63 ~MediaGlobals(); | 65 ~MediaGlobals(); |
| 64 // MediaInternals singleton used to aggregate media information. | 66 // MediaInternals singleton used to aggregate media information. |
| 65 scoped_ptr<MediaInternals> media_internals; | 67 scoped_ptr<MediaInternals> media_internals; |
| 66 } media; | 68 } media; |
| 67 | 69 |
| 68 // The "system" NetworkDelegate, used for Profile-agnostic network events. | 70 // The "system" NetworkDelegate, used for Profile-agnostic network events. |
| 69 scoped_ptr<net::NetworkDelegate> system_network_delegate; | 71 scoped_ptr<net::NetworkDelegate> system_network_delegate; |
| 70 scoped_ptr<net::HostResolver> host_resolver; | 72 scoped_ptr<net::HostResolver> host_resolver; |
| 71 scoped_ptr<net::CertVerifier> cert_verifier; | 73 scoped_ptr<net::CertVerifier> cert_verifier; |
| 72 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 74 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
| 75 scoped_refptr<net::SpdyConfigService> spdy_config_service; |
| 73 scoped_refptr<net::SSLConfigService> ssl_config_service; | 76 scoped_refptr<net::SSLConfigService> ssl_config_service; |
| 74 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 77 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
| 75 scoped_ptr<net::ProxyService> proxy_script_fetcher_proxy_service; | 78 scoped_ptr<net::ProxyService> proxy_script_fetcher_proxy_service; |
| 76 scoped_ptr<net::HttpTransactionFactory> | 79 scoped_ptr<net::HttpTransactionFactory> |
| 77 proxy_script_fetcher_http_transaction_factory; | 80 proxy_script_fetcher_http_transaction_factory; |
| 78 scoped_ptr<net::FtpTransactionFactory> | 81 scoped_ptr<net::FtpTransactionFactory> |
| 79 proxy_script_fetcher_ftp_transaction_factory; | 82 proxy_script_fetcher_ftp_transaction_factory; |
| 80 scoped_ptr<net::URLSecurityManager> url_security_manager; | 83 scoped_ptr<net::URLSecurityManager> url_security_manager; |
| 81 // We use a separate URLRequestContext for PAC fetches, in order to break | 84 // We use a separate URLRequestContext for PAC fetches, in order to break |
| 82 // the reference cycle: | 85 // the reference cycle: |
| 83 // URLRequestContext=>PAC fetch=>URLRequest=>URLRequestContext. | 86 // URLRequestContext=>PAC fetch=>URLRequest=>URLRequestContext. |
| 84 // The first URLRequestContext is |system_url_request_context|. We introduce | 87 // The first URLRequestContext is |system_url_request_context|. We introduce |
| 85 // |proxy_script_fetcher_context| for the second context. It has a direct | 88 // |proxy_script_fetcher_context| for the second context. It has a direct |
| 86 // ProxyService, since we always directly connect to fetch the PAC script. | 89 // ProxyService, since we always directly connect to fetch the PAC script. |
| 87 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; | 90 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; |
| 88 scoped_ptr<net::ProxyService> system_proxy_service; | 91 scoped_ptr<net::ProxyService> system_proxy_service; |
| 89 scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory; | 92 scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory; |
| 90 scoped_ptr<net::FtpTransactionFactory> system_ftp_transaction_factory; | 93 scoped_ptr<net::FtpTransactionFactory> system_ftp_transaction_factory; |
| 91 scoped_refptr<net::URLRequestContext> system_request_context; | 94 scoped_refptr<net::URLRequestContext> system_request_context; |
| 92 // |cookie_store| and |origin_bound_cert_service| are shared between | 95 // |cookie_store| and |origin_bound_cert_service| are shared between |
| 93 // |proxy_script_fetcher_context| and |system_request_context|. | 96 // |proxy_script_fetcher_context| and |system_request_context|. |
| 94 scoped_refptr<net::CookieStore> system_cookie_store; | 97 scoped_refptr<net::CookieStore> system_cookie_store; |
| 95 scoped_ptr<net::OriginBoundCertService> system_origin_bound_cert_service; | 98 scoped_ptr<net::OriginBoundCertService> system_origin_bound_cert_service; |
| 96 scoped_refptr<ExtensionEventRouterForwarder> | 99 scoped_refptr<ExtensionEventRouterForwarder> |
| 97 extension_event_router_forwarder; | 100 extension_event_router_forwarder; |
| 98 }; | 101 }; |
| 99 | 102 |
| 100 // |net_log| must either outlive the IOThread or be NULL. | 103 // |net_log| must either outlive the IOThread or be NULL. |
| 101 IOThread(PrefService* local_state, | 104 IOThread(PrefService* local_state, |
| 105 SpdyConfigServiceManager* spdy_config_service_manager, |
| 102 ChromeNetLog* net_log, | 106 ChromeNetLog* net_log, |
| 103 ExtensionEventRouterForwarder* extension_event_router_forwarder); | 107 ExtensionEventRouterForwarder* extension_event_router_forwarder); |
| 104 | 108 |
| 105 virtual ~IOThread(); | 109 virtual ~IOThread(); |
| 106 | 110 |
| 107 // Can only be called on the IO thread. | 111 // Can only be called on the IO thread. |
| 108 Globals* globals(); | 112 Globals* globals(); |
| 109 | 113 |
| 110 ChromeNetLog* net_log(); | 114 ChromeNetLog* net_log(); |
| 111 | 115 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 base::ListValue* referral_list, | 164 base::ListValue* referral_list, |
| 161 bool preconnect_enabled); | 165 bool preconnect_enabled); |
| 162 | 166 |
| 163 void ChangedToOnTheRecordOnIOThread(); | 167 void ChangedToOnTheRecordOnIOThread(); |
| 164 | 168 |
| 165 // Clears the host cache. Intended to be used to prevent exposing recently | 169 // Clears the host cache. Intended to be used to prevent exposing recently |
| 166 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 170 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
| 167 // called on the IO thread. | 171 // called on the IO thread. |
| 168 void ClearHostCache(); | 172 void ClearHostCache(); |
| 169 | 173 |
| 174 // Returns an SpdyConfigService instance. |
| 175 net::SpdyConfigService* GetSpdyConfigService(); |
| 176 |
| 170 // Returns an SSLConfigService instance. | 177 // Returns an SSLConfigService instance. |
| 171 net::SSLConfigService* GetSSLConfigService(); | 178 net::SSLConfigService* GetSSLConfigService(); |
| 172 | 179 |
| 173 // The NetLog is owned by the browser process, to allow logging from other | 180 // The NetLog is owned by the browser process, to allow logging from other |
| 174 // threads during shutdown, but is used most frequently on the IOThread. | 181 // threads during shutdown, but is used most frequently on the IOThread. |
| 175 ChromeNetLog* net_log_; | 182 ChromeNetLog* net_log_; |
| 176 | 183 |
| 177 // The ExtensionEventRouterForwarder allows for sending events to extensions | 184 // The ExtensionEventRouterForwarder allows for sending events to extensions |
| 178 // from the IOThread. | 185 // from the IOThread. |
| 179 ExtensionEventRouterForwarder* extension_event_router_forwarder_; | 186 ExtensionEventRouterForwarder* extension_event_router_forwarder_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 195 BooleanPrefMember system_enable_referrers_; | 202 BooleanPrefMember system_enable_referrers_; |
| 196 | 203 |
| 197 // Store HTTP Auth-related policies in this thread. | 204 // Store HTTP Auth-related policies in this thread. |
| 198 std::string auth_schemes_; | 205 std::string auth_schemes_; |
| 199 bool negotiate_disable_cname_lookup_; | 206 bool negotiate_disable_cname_lookup_; |
| 200 bool negotiate_enable_port_; | 207 bool negotiate_enable_port_; |
| 201 std::string auth_server_whitelist_; | 208 std::string auth_server_whitelist_; |
| 202 std::string auth_delegate_whitelist_; | 209 std::string auth_delegate_whitelist_; |
| 203 std::string gssapi_library_name_; | 210 std::string gssapi_library_name_; |
| 204 | 211 |
| 212 // This is an instance of the default SpdyConfigServiceManager for the current |
| 213 // platform and it gets SPDY preferences from user preferences. |
| 214 scoped_refptr<SpdyConfigServiceManager> spdy_config_service_manager_; |
| 215 |
| 205 // This is an instance of the default SSLConfigServiceManager for the current | 216 // This is an instance of the default SSLConfigServiceManager for the current |
| 206 // platform and it gets SSL preferences from local_state object. | 217 // platform and it gets SSL preferences from local_state object. |
| 207 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; | 218 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; |
| 208 | 219 |
| 209 // These member variables are initialized by a task posted to the IO thread, | 220 // These member variables are initialized by a task posted to the IO thread, |
| 210 // which gets posted by calling certain member functions of IOThread. | 221 // which gets posted by calling certain member functions of IOThread. |
| 211 | 222 |
| 212 // Note: we user explicit pointers rather than smart pointers to be more | 223 // Note: we user explicit pointers rather than smart pointers to be more |
| 213 // explicit about destruction order, and ensure that there is no chance that | 224 // explicit about destruction order, and ensure that there is no chance that |
| 214 // these observers would be used accidentally after we have begun to tear | 225 // these observers would be used accidentally after we have begun to tear |
| 215 // down. | 226 // down. |
| 216 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | 227 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; |
| 217 chrome_browser_net::Predictor* predictor_; | 228 chrome_browser_net::Predictor* predictor_; |
| 218 | 229 |
| 219 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_; | 230 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_; |
| 220 | 231 |
| 221 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 232 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 222 | 233 |
| 223 scoped_refptr<net::URLRequestContextGetter> | 234 scoped_refptr<net::URLRequestContextGetter> |
| 224 system_url_request_context_getter_; | 235 system_url_request_context_getter_; |
| 225 | 236 |
| 226 ScopedRunnableMethodFactory<IOThread> method_factory_; | 237 ScopedRunnableMethodFactory<IOThread> method_factory_; |
| 227 | 238 |
| 228 DISALLOW_COPY_AND_ASSIGN(IOThread); | 239 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 229 }; | 240 }; |
| 230 | 241 |
| 231 #endif // CHROME_BROWSER_IO_THREAD_H_ | 242 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |