| 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/ssl_config_service_manager.h" | 15 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 16 #include "chrome/browser/prefs/pref_member.h" | 16 #include "chrome/browser/prefs/pref_member.h" |
| 17 #include "chrome/common/net/predictor_common.h" | |
| 18 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
| 19 | 18 |
| 20 class ChromeNetLog; | 19 class ChromeNetLog; |
| 21 class ChromeURLRequestContextGetter; | 20 class ChromeURLRequestContextGetter; |
| 22 class ExtensionEventRouterForwarder; | 21 class ExtensionEventRouterForwarder; |
| 23 class MediaInternals; | 22 class MediaInternals; |
| 24 class PrefProxyConfigTracker; | 23 class PrefProxyConfigTracker; |
| 25 class PrefService; | 24 class PrefService; |
| 26 class SystemURLRequestContextGetter; | 25 class SystemURLRequestContextGetter; |
| 27 | 26 |
| 28 namespace base { | 27 namespace base { |
| 29 class ListValue; | 28 class ListValue; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace chrome_browser_net { | |
| 33 class ConnectInterceptor; | |
| 34 class Predictor; | |
| 35 } // namespace chrome_browser_net | |
| 36 | |
| 37 namespace net { | 31 namespace net { |
| 38 class CertVerifier; | 32 class CertVerifier; |
| 39 class CookieStore; | 33 class CookieStore; |
| 40 class DnsRRResolver; | 34 class DnsRRResolver; |
| 41 class FtpTransactionFactory; | 35 class FtpTransactionFactory; |
| 42 class HostResolver; | 36 class HostResolver; |
| 43 class HttpAuthHandlerFactory; | 37 class HttpAuthHandlerFactory; |
| 44 class HttpTransactionFactory; | 38 class HttpTransactionFactory; |
| 45 class NetworkDelegate; | 39 class NetworkDelegate; |
| 46 class OriginBoundCertService; | 40 class OriginBoundCertService; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ChromeNetLog* net_log, | 96 ChromeNetLog* net_log, |
| 103 ExtensionEventRouterForwarder* extension_event_router_forwarder); | 97 ExtensionEventRouterForwarder* extension_event_router_forwarder); |
| 104 | 98 |
| 105 virtual ~IOThread(); | 99 virtual ~IOThread(); |
| 106 | 100 |
| 107 // Can only be called on the IO thread. | 101 // Can only be called on the IO thread. |
| 108 Globals* globals(); | 102 Globals* globals(); |
| 109 | 103 |
| 110 ChromeNetLog* net_log(); | 104 ChromeNetLog* net_log(); |
| 111 | 105 |
| 112 // Initializes the network predictor, which induces DNS pre-resolution and/or | |
| 113 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS | |
| 114 // prefetching should be enabled, and |preconnect_enabled| controls whether | |
| 115 // TCP/IP preconnection is enabled. This should be called by the UI thread. | |
| 116 // It will post a task to the IO thread to perform the actual initialization. | |
| 117 void InitNetworkPredictor(bool prefetching_enabled, | |
| 118 base::TimeDelta max_dns_queue_delay, | |
| 119 size_t max_speculative_parallel_resolves, | |
| 120 const chrome_common_net::UrlList& startup_urls, | |
| 121 base::ListValue* referral_list, | |
| 122 bool preconnect_enabled); | |
| 123 | |
| 124 // Handles changing to On The Record mode, discarding confidential data. | |
| 125 void ChangedToOnTheRecord(); | |
| 126 | |
| 127 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 106 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
| 128 net::URLRequestContextGetter* system_url_request_context_getter(); | 107 net::URLRequestContextGetter* system_url_request_context_getter(); |
| 129 | 108 |
| 130 // Clear all network stack history, including the host cache, as well as | 109 // Clears the host cache. Intended to be used to prevent exposing recently |
| 131 // speculative data about subresources of visited sites, and startup-time | 110 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
| 132 // navigations. | 111 // called on the IO thread. |
| 133 void ClearNetworkingHistory(); | 112 void ClearHostCache(); |
| 134 | 113 |
| 135 protected: | 114 protected: |
| 136 virtual void Init(); | 115 virtual void Init(); |
| 137 virtual void CleanUp(); | 116 virtual void CleanUp(); |
| 138 | 117 |
| 139 private: | 118 private: |
| 140 // Provide SystemURLRequestContextGetter with access to | 119 // Provide SystemURLRequestContextGetter with access to |
| 141 // InitSystemRequestContext(). | 120 // InitSystemRequestContext(). |
| 142 friend class SystemURLRequestContextGetter; | 121 friend class SystemURLRequestContextGetter; |
| 143 | 122 |
| 144 static void RegisterPrefs(PrefService* local_state); | 123 static void RegisterPrefs(PrefService* local_state); |
| 145 | 124 |
| 146 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( | 125 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
| 147 net::HostResolver* resolver); | 126 net::HostResolver* resolver); |
| 148 | 127 |
| 149 void InitSystemRequestContext(); | 128 void InitSystemRequestContext(); |
| 150 | 129 |
| 151 // Lazy initialization of system request context for | 130 // Lazy initialization of system request context for |
| 152 // SystemURLRequestContextGetter. To be called on IO thread. | 131 // SystemURLRequestContextGetter. To be called on IO thread. |
| 153 void InitSystemRequestContextOnIOThread(); | 132 void InitSystemRequestContextOnIOThread(); |
| 154 | 133 |
| 155 void InitNetworkPredictorOnIOThread( | |
| 156 bool prefetching_enabled, | |
| 157 base::TimeDelta max_dns_queue_delay, | |
| 158 size_t max_speculative_parallel_resolves, | |
| 159 const chrome_common_net::UrlList& startup_urls, | |
| 160 base::ListValue* referral_list, | |
| 161 bool preconnect_enabled); | |
| 162 | |
| 163 void ChangedToOnTheRecordOnIOThread(); | |
| 164 | |
| 165 // 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 | |
| 167 // called on the IO thread. | |
| 168 void ClearHostCache(); | |
| 169 | |
| 170 // Returns an SSLConfigService instance. | 134 // Returns an SSLConfigService instance. |
| 171 net::SSLConfigService* GetSSLConfigService(); | 135 net::SSLConfigService* GetSSLConfigService(); |
| 172 | 136 |
| 173 // The NetLog is owned by the browser process, to allow logging from other | 137 // 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. | 138 // threads during shutdown, but is used most frequently on the IOThread. |
| 175 ChromeNetLog* net_log_; | 139 ChromeNetLog* net_log_; |
| 176 | 140 |
| 177 // The ExtensionEventRouterForwarder allows for sending events to extensions | 141 // The ExtensionEventRouterForwarder allows for sending events to extensions |
| 178 // from the IOThread. | 142 // from the IOThread. |
| 179 ExtensionEventRouterForwarder* extension_event_router_forwarder_; | 143 ExtensionEventRouterForwarder* extension_event_router_forwarder_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 201 std::string auth_server_whitelist_; | 165 std::string auth_server_whitelist_; |
| 202 std::string auth_delegate_whitelist_; | 166 std::string auth_delegate_whitelist_; |
| 203 std::string gssapi_library_name_; | 167 std::string gssapi_library_name_; |
| 204 | 168 |
| 205 // This is an instance of the default SSLConfigServiceManager for the current | 169 // This is an instance of the default SSLConfigServiceManager for the current |
| 206 // platform and it gets SSL preferences from local_state object. | 170 // platform and it gets SSL preferences from local_state object. |
| 207 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; | 171 scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_; |
| 208 | 172 |
| 209 // These member variables are initialized by a task posted to the IO thread, | 173 // These member variables are initialized by a task posted to the IO thread, |
| 210 // which gets posted by calling certain member functions of IOThread. | 174 // which gets posted by calling certain member functions of IOThread. |
| 211 | |
| 212 // 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 | |
| 214 // these observers would be used accidentally after we have begun to tear | |
| 215 // down. | |
| 216 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | |
| 217 chrome_browser_net::Predictor* predictor_; | |
| 218 | |
| 219 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_; | 175 scoped_ptr<net::ProxyConfigService> system_proxy_config_service_; |
| 220 | 176 |
| 221 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; | 177 scoped_refptr<PrefProxyConfigTracker> pref_proxy_config_tracker_; |
| 222 | 178 |
| 223 scoped_refptr<net::URLRequestContextGetter> | 179 scoped_refptr<net::URLRequestContextGetter> |
| 224 system_url_request_context_getter_; | 180 system_url_request_context_getter_; |
| 225 | 181 |
| 226 ScopedRunnableMethodFactory<IOThread> method_factory_; | 182 ScopedRunnableMethodFactory<IOThread> method_factory_; |
| 227 | 183 |
| 228 DISALLOW_COPY_AND_ASSIGN(IOThread); | 184 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 229 }; | 185 }; |
| 230 | 186 |
| 231 #endif // CHROME_BROWSER_IO_THREAD_H_ | 187 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |