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 <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "chrome/browser/browser_process_sub_thread.h" | 14 #include "chrome/browser/browser_process_sub_thread.h" |
15 #include "chrome/common/net/predictor_common.h" | 15 #include "chrome/common/net/predictor_common.h" |
16 #include "net/base/network_change_notifier.h" | 16 #include "net/base/network_change_notifier.h" |
17 | 17 |
18 class ChromeNetLog; | 18 class ChromeNetLog; |
19 class ChromeURLRequestContextGetter; | 19 class ChromeURLRequestContextGetter; |
| 20 class ExtensionEventRouterForwarder; |
20 class ListValue; | 21 class ListValue; |
21 class PrefService; | 22 class PrefService; |
22 | 23 |
23 namespace chrome_browser_net { | 24 namespace chrome_browser_net { |
24 class ConnectInterceptor; | 25 class ConnectInterceptor; |
25 class Predictor; | 26 class Predictor; |
26 } // namespace chrome_browser_net | 27 } // namespace chrome_browser_net |
27 | 28 |
28 namespace net { | 29 namespace net { |
29 class CertVerifier; | 30 class CertVerifier; |
(...skipping 20 matching lines...) Expand all Loading... |
50 scoped_ptr<net::HostResolver> host_resolver; | 51 scoped_ptr<net::HostResolver> host_resolver; |
51 scoped_ptr<net::CertVerifier> cert_verifier; | 52 scoped_ptr<net::CertVerifier> cert_verifier; |
52 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 53 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
53 scoped_refptr<net::SSLConfigService> ssl_config_service; | 54 scoped_refptr<net::SSLConfigService> ssl_config_service; |
54 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 55 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
55 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; | 56 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; |
56 scoped_ptr<net::HttpTransactionFactory> | 57 scoped_ptr<net::HttpTransactionFactory> |
57 proxy_script_fetcher_http_transaction_factory; | 58 proxy_script_fetcher_http_transaction_factory; |
58 scoped_ptr<net::URLSecurityManager> url_security_manager; | 59 scoped_ptr<net::URLSecurityManager> url_security_manager; |
59 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; | 60 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; |
| 61 scoped_refptr<ExtensionEventRouterForwarder> |
| 62 extension_event_router_forwarder; |
60 }; | 63 }; |
61 | 64 |
62 // |net_log| must either outlive the IOThread or be NULL. | 65 // |net_log| must either outlive the IOThread or be NULL. |
63 IOThread(PrefService* local_state, ChromeNetLog* net_log); | 66 IOThread(PrefService* local_state, |
| 67 ChromeNetLog* net_log, |
| 68 ExtensionEventRouterForwarder* extension_event_router_forwarder); |
64 | 69 |
65 virtual ~IOThread(); | 70 virtual ~IOThread(); |
66 | 71 |
67 // Can only be called on the IO thread. | 72 // Can only be called on the IO thread. |
68 Globals* globals(); | 73 Globals* globals(); |
69 | 74 |
70 ChromeNetLog* net_log(); | 75 ChromeNetLog* net_log(); |
71 | 76 |
72 // Initializes the network predictor, which induces DNS pre-resolution and/or | 77 // Initializes the network predictor, which induces DNS pre-resolution and/or |
73 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS | 78 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 132 |
128 // Clears the host cache. Intended to be used to prevent exposing recently | 133 // Clears the host cache. Intended to be used to prevent exposing recently |
129 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 134 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
130 // called on the IO thread. | 135 // called on the IO thread. |
131 void ClearHostCache(); | 136 void ClearHostCache(); |
132 | 137 |
133 // The NetLog is owned by the browser process, to allow logging from other | 138 // The NetLog is owned by the browser process, to allow logging from other |
134 // threads during shutdown, but is used most frequently on the IOThread. | 139 // threads during shutdown, but is used most frequently on the IOThread. |
135 ChromeNetLog* net_log_; | 140 ChromeNetLog* net_log_; |
136 | 141 |
| 142 // The ExtensionEventRouterForwarder allows for sending events to extensions |
| 143 // from the IOThread. |
| 144 ExtensionEventRouterForwarder* extension_event_router_forwarder_; |
| 145 |
137 // These member variables are basically global, but their lifetimes are tied | 146 // These member variables are basically global, but their lifetimes are tied |
138 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. | 147 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
139 // This is because the destructor of IOThread runs on the wrong thread. All | 148 // This is because the destructor of IOThread runs on the wrong thread. All |
140 // member variables should be deleted in CleanUp(). | 149 // member variables should be deleted in CleanUp(). |
141 | 150 |
142 // These member variables are initialized in Init() and do not change for the | 151 // These member variables are initialized in Init() and do not change for the |
143 // lifetime of the IO thread. | 152 // lifetime of the IO thread. |
144 | 153 |
145 Globals* globals_; | 154 Globals* globals_; |
146 | 155 |
(...skipping 20 matching lines...) Expand all Loading... |
167 | 176 |
168 // Keeps track of all live ChromeURLRequestContextGetters, so the | 177 // Keeps track of all live ChromeURLRequestContextGetters, so the |
169 // ChromeURLRequestContexts can be released during | 178 // ChromeURLRequestContexts can be released during |
170 // IOThread::CleanUpAfterMessageLoopDestruction(). | 179 // IOThread::CleanUpAfterMessageLoopDestruction(). |
171 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; | 180 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; |
172 | 181 |
173 DISALLOW_COPY_AND_ASSIGN(IOThread); | 182 DISALLOW_COPY_AND_ASSIGN(IOThread); |
174 }; | 183 }; |
175 | 184 |
176 #endif // CHROME_BROWSER_IO_THREAD_H_ | 185 #endif // CHROME_BROWSER_IO_THREAD_H_ |
OLD | NEW |