#ifndef CHROME_BROWSER_IO_THREAD_H_
#define CHROME_BROWSER_IO_THREAD_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/api/prefs/pref_member.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/browser_thread_delegate.h"
#include "net/base/network_change_notifier.h"
class ChromeNetLog;
class PrefProxyConfigTrackerImpl;
class PrefService;
class SystemURLRequestContextGetter;
namespace chrome_browser_net {
class HttpPipeliningCompatibilityClient;
class LoadTimeStats;
}
namespace extensions {
class EventRouterForwarder;
}
namespace net {
class CertVerifier;
class CookieStore;
class FtpTransactionFactory;
class HostMappingRules;
class HostResolver;
class HttpAuthHandlerFactory;
class HttpServerProperties;
class HttpTransactionFactory;
class NetworkDelegate;
class ServerBoundCertService;
class ProxyConfigService;
class ProxyService;
class SdchManager;
class SSLConfigService;
class TransportSecurityState;
class URLRequestContext;
class URLRequestContextGetter;
class URLRequestThrottlerManager;
class URLSecurityManager;
}
class IOThread : public content::BrowserThreadDelegate {
public:
struct Globals {
class SystemRequestContextLeakChecker {
public:
explicit SystemRequestContextLeakChecker(Globals* globals);
~SystemRequestContextLeakChecker();
private:
Globals* const globals_;
};
Globals();
~Globals();
scoped_ptr<net::NetworkDelegate> system_network_delegate;
scoped_ptr<net::HostResolver> host_resolver;
scoped_ptr<net::CertVerifier> cert_verifier;
scoped_ptr<net::TransportSecurityState> transport_security_state;
scoped_refptr<net::SSLConfigService> ssl_config_service;
scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory;
scoped_ptr<net::HttpServerProperties> http_server_properties;
scoped_ptr<net::ProxyService> proxy_script_fetcher_proxy_service;
scoped_ptr<net::HttpTransactionFactory>
proxy_script_fetcher_http_transaction_factory;
scoped_ptr<net::FtpTransactionFactory>
proxy_script_fetcher_ftp_transaction_factory;
scoped_ptr<net::URLRequestThrottlerManager> throttler_manager;
scoped_ptr<net::URLSecurityManager> url_security_manager;
scoped_ptr<net::URLRequestContext> proxy_script_fetcher_context;
scoped_ptr<net::ProxyService> system_proxy_service;
scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory;
scoped_ptr<net::FtpTransactionFactory> system_ftp_transaction_factory;
scoped_ptr<net::URLRequestContext> system_request_context;
SystemRequestContextLeakChecker system_request_context_leak_checker;
scoped_refptr<net::CookieStore> system_cookie_store;
scoped_ptr<net::ServerBoundCertService> system_server_bound_cert_service;
scoped_refptr<extensions::EventRouterForwarder>
extension_event_router_forwarder;
scoped_ptr<chrome_browser_net::HttpPipeliningCompatibilityClient>
http_pipelining_compatibility_client;
scoped_ptr<chrome_browser_net::LoadTimeStats> load_time_stats;
scoped_ptr<net::HostMappingRules> host_mapping_rules;
bool ignore_certificate_errors;
bool http_pipelining_enabled;
uint16 testing_fixed_http_port;
uint16 testing_fixed_https_port;
};
IOThread(PrefService* local_state,
ChromeNetLog* net_log,
extensions::EventRouterForwarder* extension_event_router_forwarder);
virtual ~IOThread();
Globals* globals();
ChromeNetLog* net_log();
void ChangedToOnTheRecord();
net::URLRequestContextGetter* system_url_request_context_getter();
void ClearHostCache();
private:
virtual void Init() OVERRIDE;
virtual void CleanUp() OVERRIDE;
friend class SystemURLRequestContextGetter;
void InitSystemRequestContext();
void InitSystemRequestContextOnIOThread();
static void RegisterPrefs(PrefService* local_state);
net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory(
net::HostResolver* resolver);
net::SSLConfigService* GetSSLConfigService();
void ChangedToOnTheRecordOnIOThread();
ChromeNetLog* net_log_;
extensions::EventRouterForwarder* extension_event_router_forwarder_;
Globals* globals_;
class LoggingNetworkChangeObserver;
scoped_ptr<LoggingNetworkChangeObserver> network_change_observer_;
BooleanPrefMember system_enable_referrers_;
std::string auth_schemes_;
bool negotiate_disable_cname_lookup_;
bool negotiate_enable_port_;
std::string auth_server_whitelist_;
std::string auth_delegate_whitelist_;
std::string gssapi_library_name_;
scoped_ptr<SSLConfigServiceManager> ssl_config_service_manager_;
scoped_ptr<net::ProxyConfigService> system_proxy_config_service_;
scoped_ptr<PrefProxyConfigTrackerImpl> pref_proxy_config_tracker_;
scoped_refptr<net::URLRequestContextGetter>
system_url_request_context_getter_;
net::SdchManager* sdch_manager_;
base::WeakPtrFactory<IOThread> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(IOThread);
};
#endif