| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/prefs/pref_member.h" | 18 #include "base/prefs/pref_member.h" |
| 19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
| 20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
| 21 #include "chrome/browser/net/chrome_network_delegate.h" | 21 #include "chrome/browser/net/chrome_network_delegate.h" |
| 22 #include "chrome/browser/net/ssl_config_service_manager.h" | 22 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/browser_thread_delegate.h" | 24 #include "content/public/browser/browser_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 #include "net/socket/next_proto.h" | 27 #include "net/socket/next_proto.h" |
| 28 | 28 |
| 29 class ChromeNetLog; | |
| 30 class PrefProxyConfigTracker; | 29 class PrefProxyConfigTracker; |
| 31 class PrefService; | 30 class PrefService; |
| 32 class PrefRegistrySimple; | 31 class PrefRegistrySimple; |
| 33 class SystemURLRequestContextGetter; | 32 class SystemURLRequestContextGetter; |
| 34 | 33 |
| 35 namespace base { | 34 namespace base { |
| 36 class CommandLine; | 35 class CommandLine; |
| 37 } | 36 } |
| 38 | 37 |
| 39 namespace chrome_browser_net { | 38 namespace chrome_browser_net { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 class ProxyService; | 62 class ProxyService; |
| 64 class SSLConfigService; | 63 class SSLConfigService; |
| 65 class TransportSecurityState; | 64 class TransportSecurityState; |
| 66 class URLRequestBackoffManager; | 65 class URLRequestBackoffManager; |
| 67 class URLRequestContext; | 66 class URLRequestContext; |
| 68 class URLRequestContextGetter; | 67 class URLRequestContextGetter; |
| 69 class URLRequestJobFactory; | 68 class URLRequestJobFactory; |
| 70 class URLSecurityManager; | 69 class URLSecurityManager; |
| 71 } // namespace net | 70 } // namespace net |
| 72 | 71 |
| 72 namespace net_log { |
| 73 class ChromeNetLog; |
| 74 } |
| 75 |
| 73 namespace policy { | 76 namespace policy { |
| 74 class PolicyService; | 77 class PolicyService; |
| 75 } // namespace policy | 78 } // namespace policy |
| 76 | 79 |
| 77 namespace test { | 80 namespace test { |
| 78 class IOThreadPeer; | 81 class IOThreadPeer; |
| 79 } // namespace test | 82 } // namespace test |
| 80 | 83 |
| 81 // Contains state associated with, initialized and cleaned up on, and | 84 // Contains state associated with, initialized and cleaned up on, and |
| 82 // primarily used on, the IO thread. | 85 // primarily used on, the IO thread. |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 bool enable_user_alternate_protocol_ports; | 205 bool enable_user_alternate_protocol_ports; |
| 203 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a | 206 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a |
| 204 // main frame load fails with a DNS error in order to provide more useful | 207 // main frame load fails with a DNS error in order to provide more useful |
| 205 // information to the renderer so it can show a more specific error page. | 208 // information to the renderer so it can show a more specific error page. |
| 206 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; | 209 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; |
| 207 }; | 210 }; |
| 208 | 211 |
| 209 // |net_log| must either outlive the IOThread or be NULL. | 212 // |net_log| must either outlive the IOThread or be NULL. |
| 210 IOThread(PrefService* local_state, | 213 IOThread(PrefService* local_state, |
| 211 policy::PolicyService* policy_service, | 214 policy::PolicyService* policy_service, |
| 212 ChromeNetLog* net_log, | 215 net_log::ChromeNetLog* net_log, |
| 213 extensions::EventRouterForwarder* extension_event_router_forwarder); | 216 extensions::EventRouterForwarder* extension_event_router_forwarder); |
| 214 | 217 |
| 215 ~IOThread() override; | 218 ~IOThread() override; |
| 216 | 219 |
| 217 static void RegisterPrefs(PrefRegistrySimple* registry); | 220 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 218 | 221 |
| 219 // Can only be called on the IO thread. | 222 // Can only be called on the IO thread. |
| 220 Globals* globals(); | 223 Globals* globals(); |
| 221 | 224 |
| 222 // Allows overriding Globals in tests where IOThread::Init() and | 225 // Allows overriding Globals in tests where IOThread::Init() and |
| 223 // IOThread::CleanUp() are not called. This allows for injecting mocks into | 226 // IOThread::CleanUp() are not called. This allows for injecting mocks into |
| 224 // IOThread global objects. | 227 // IOThread global objects. |
| 225 void SetGlobalsForTesting(Globals* globals); | 228 void SetGlobalsForTesting(Globals* globals); |
| 226 | 229 |
| 227 ChromeNetLog* net_log(); | 230 net_log::ChromeNetLog* net_log(); |
| 228 | 231 |
| 229 // Handles changing to On The Record mode, discarding confidential data. | 232 // Handles changing to On The Record mode, discarding confidential data. |
| 230 void ChangedToOnTheRecord(); | 233 void ChangedToOnTheRecord(); |
| 231 | 234 |
| 232 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 235 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
| 233 net::URLRequestContextGetter* system_url_request_context_getter(); | 236 net::URLRequestContextGetter* system_url_request_context_getter(); |
| 234 | 237 |
| 235 // Clears the host cache. Intended to be used to prevent exposing recently | 238 // Clears the host cache. Intended to be used to prevent exposing recently |
| 236 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 239 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
| 237 // called on the IO thread. | 240 // called on the IO thread. |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 438 |
| 436 // TODO(willchan): Remove proxy script fetcher context since it's not | 439 // TODO(willchan): Remove proxy script fetcher context since it's not |
| 437 // necessary now that I got rid of refcounting URLRequestContexts. | 440 // necessary now that I got rid of refcounting URLRequestContexts. |
| 438 // See IOThread::Globals for details. | 441 // See IOThread::Globals for details. |
| 439 static net::URLRequestContext* ConstructProxyScriptFetcherContext( | 442 static net::URLRequestContext* ConstructProxyScriptFetcherContext( |
| 440 IOThread::Globals* globals, | 443 IOThread::Globals* globals, |
| 441 net::NetLog* net_log); | 444 net::NetLog* net_log); |
| 442 | 445 |
| 443 // The NetLog is owned by the browser process, to allow logging from other | 446 // The NetLog is owned by the browser process, to allow logging from other |
| 444 // threads during shutdown, but is used most frequently on the IOThread. | 447 // threads during shutdown, but is used most frequently on the IOThread. |
| 445 ChromeNetLog* net_log_; | 448 net_log::ChromeNetLog* net_log_; |
| 446 | 449 |
| 447 #if defined(ENABLE_EXTENSIONS) | 450 #if defined(ENABLE_EXTENSIONS) |
| 448 // The extensions::EventRouterForwarder allows for sending events to | 451 // The extensions::EventRouterForwarder allows for sending events to |
| 449 // extensions from the IOThread. | 452 // extensions from the IOThread. |
| 450 extensions::EventRouterForwarder* extension_event_router_forwarder_; | 453 extensions::EventRouterForwarder* extension_event_router_forwarder_; |
| 451 #endif | 454 #endif |
| 452 | 455 |
| 453 // These member variables are basically global, but their lifetimes are tied | 456 // These member variables are basically global, but their lifetimes are tied |
| 454 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. | 457 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
| 455 // This is because the destructor of IOThread runs on the wrong thread. All | 458 // This is because the destructor of IOThread runs on the wrong thread. All |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 bool is_quic_allowed_by_policy_; | 502 bool is_quic_allowed_by_policy_; |
| 500 | 503 |
| 501 const base::TimeTicks creation_time_; | 504 const base::TimeTicks creation_time_; |
| 502 | 505 |
| 503 base::WeakPtrFactory<IOThread> weak_factory_; | 506 base::WeakPtrFactory<IOThread> weak_factory_; |
| 504 | 507 |
| 505 DISALLOW_COPY_AND_ASSIGN(IOThread); | 508 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 506 }; | 509 }; |
| 507 | 510 |
| 508 #endif // CHROME_BROWSER_IO_THREAD_H_ | 511 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |