| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 bool enable_user_alternate_protocol_ports; | 206 bool enable_user_alternate_protocol_ports; |
| 204 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a | 207 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a |
| 205 // main frame load fails with a DNS error in order to provide more useful | 208 // main frame load fails with a DNS error in order to provide more useful |
| 206 // information to the renderer so it can show a more specific error page. | 209 // information to the renderer so it can show a more specific error page. |
| 207 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; | 210 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 // |net_log| must either outlive the IOThread or be NULL. | 213 // |net_log| must either outlive the IOThread or be NULL. |
| 211 IOThread(PrefService* local_state, | 214 IOThread(PrefService* local_state, |
| 212 policy::PolicyService* policy_service, | 215 policy::PolicyService* policy_service, |
| 213 ChromeNetLog* net_log, | 216 net_log::ChromeNetLog* net_log, |
| 214 extensions::EventRouterForwarder* extension_event_router_forwarder); | 217 extensions::EventRouterForwarder* extension_event_router_forwarder); |
| 215 | 218 |
| 216 ~IOThread() override; | 219 ~IOThread() override; |
| 217 | 220 |
| 218 static void RegisterPrefs(PrefRegistrySimple* registry); | 221 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 219 | 222 |
| 220 // Can only be called on the IO thread. | 223 // Can only be called on the IO thread. |
| 221 Globals* globals(); | 224 Globals* globals(); |
| 222 | 225 |
| 223 // Allows overriding Globals in tests where IOThread::Init() and | 226 // Allows overriding Globals in tests where IOThread::Init() and |
| 224 // IOThread::CleanUp() are not called. This allows for injecting mocks into | 227 // IOThread::CleanUp() are not called. This allows for injecting mocks into |
| 225 // IOThread global objects. | 228 // IOThread global objects. |
| 226 void SetGlobalsForTesting(Globals* globals); | 229 void SetGlobalsForTesting(Globals* globals); |
| 227 | 230 |
| 228 ChromeNetLog* net_log(); | 231 net_log::ChromeNetLog* net_log(); |
| 229 | 232 |
| 230 // Handles changing to On The Record mode, discarding confidential data. | 233 // Handles changing to On The Record mode, discarding confidential data. |
| 231 void ChangedToOnTheRecord(); | 234 void ChangedToOnTheRecord(); |
| 232 | 235 |
| 233 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 236 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
| 234 net::URLRequestContextGetter* system_url_request_context_getter(); | 237 net::URLRequestContextGetter* system_url_request_context_getter(); |
| 235 | 238 |
| 236 // Clears the host cache. Intended to be used to prevent exposing recently | 239 // Clears the host cache. Intended to be used to prevent exposing recently |
| 237 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 240 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
| 238 // called on the IO thread. | 241 // called on the IO thread. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 | 443 |
| 441 // TODO(willchan): Remove proxy script fetcher context since it's not | 444 // TODO(willchan): Remove proxy script fetcher context since it's not |
| 442 // necessary now that I got rid of refcounting URLRequestContexts. | 445 // necessary now that I got rid of refcounting URLRequestContexts. |
| 443 // See IOThread::Globals for details. | 446 // See IOThread::Globals for details. |
| 444 static net::URLRequestContext* ConstructProxyScriptFetcherContext( | 447 static net::URLRequestContext* ConstructProxyScriptFetcherContext( |
| 445 IOThread::Globals* globals, | 448 IOThread::Globals* globals, |
| 446 net::NetLog* net_log); | 449 net::NetLog* net_log); |
| 447 | 450 |
| 448 // The NetLog is owned by the browser process, to allow logging from other | 451 // The NetLog is owned by the browser process, to allow logging from other |
| 449 // threads during shutdown, but is used most frequently on the IOThread. | 452 // threads during shutdown, but is used most frequently on the IOThread. |
| 450 ChromeNetLog* net_log_; | 453 net_log::ChromeNetLog* net_log_; |
| 451 | 454 |
| 452 #if defined(ENABLE_EXTENSIONS) | 455 #if defined(ENABLE_EXTENSIONS) |
| 453 // The extensions::EventRouterForwarder allows for sending events to | 456 // The extensions::EventRouterForwarder allows for sending events to |
| 454 // extensions from the IOThread. | 457 // extensions from the IOThread. |
| 455 extensions::EventRouterForwarder* extension_event_router_forwarder_; | 458 extensions::EventRouterForwarder* extension_event_router_forwarder_; |
| 456 #endif | 459 #endif |
| 457 | 460 |
| 458 // These member variables are basically global, but their lifetimes are tied | 461 // These member variables are basically global, but their lifetimes are tied |
| 459 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. | 462 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
| 460 // This is because the destructor of IOThread runs on the wrong thread. All | 463 // 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... |
| 504 bool is_quic_allowed_by_policy_; | 507 bool is_quic_allowed_by_policy_; |
| 505 | 508 |
| 506 const base::TimeTicks creation_time_; | 509 const base::TimeTicks creation_time_; |
| 507 | 510 |
| 508 base::WeakPtrFactory<IOThread> weak_factory_; | 511 base::WeakPtrFactory<IOThread> weak_factory_; |
| 509 | 512 |
| 510 DISALLOW_COPY_AND_ASSIGN(IOThread); | 513 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 511 }; | 514 }; |
| 512 | 515 |
| 513 #endif // CHROME_BROWSER_IO_THREAD_H_ | 516 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |