| 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 #include "chrome/browser/io_thread.h" | 5 #include "chrome/browser/io_thread.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "net/http/http_auth_handler_factory.h" | 54 #include "net/http/http_auth_handler_factory.h" |
| 55 #include "net/http/http_network_layer.h" | 55 #include "net/http/http_network_layer.h" |
| 56 #include "net/http/http_server_properties_impl.h" | 56 #include "net/http/http_server_properties_impl.h" |
| 57 #include "net/proxy/proxy_config_service.h" | 57 #include "net/proxy/proxy_config_service.h" |
| 58 #include "net/proxy/proxy_script_fetcher_impl.h" | 58 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 59 #include "net/proxy/proxy_service.h" | 59 #include "net/proxy/proxy_service.h" |
| 60 #include "net/spdy/spdy_session.h" | 60 #include "net/spdy/spdy_session.h" |
| 61 #include "net/url_request/url_fetcher.h" | 61 #include "net/url_request/url_fetcher.h" |
| 62 #include "net/url_request/url_request_throttler_manager.h" | 62 #include "net/url_request/url_request_throttler_manager.h" |
| 63 #include "net/websockets/websocket_job.h" | 63 #include "net/websockets/websocket_job.h" |
| 64 #include "v8/include/v8.h" |
| 64 | 65 |
| 65 #if defined(ENABLE_CONFIGURATION_POLICY) | 66 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 66 #include "policy/policy_constants.h" | 67 #include "policy/policy_constants.h" |
| 67 #endif | 68 #endif |
| 68 | 69 |
| 69 #if defined(USE_NSS) || defined(OS_IOS) | 70 #if defined(USE_NSS) || defined(OS_IOS) |
| 70 #include "net/ocsp/nss_ocsp.h" | 71 #include "net/ocsp/nss_ocsp.h" |
| 71 #endif | 72 #endif |
| 72 | 73 |
| 73 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 IOThread::IOThread( | 360 IOThread::IOThread( |
| 360 PrefServiceSimple* local_state, | 361 PrefServiceSimple* local_state, |
| 361 policy::PolicyService* policy_service, | 362 policy::PolicyService* policy_service, |
| 362 ChromeNetLog* net_log, | 363 ChromeNetLog* net_log, |
| 363 extensions::EventRouterForwarder* extension_event_router_forwarder) | 364 extensions::EventRouterForwarder* extension_event_router_forwarder) |
| 364 : net_log_(net_log), | 365 : net_log_(net_log), |
| 365 extension_event_router_forwarder_(extension_event_router_forwarder), | 366 extension_event_router_forwarder_(extension_event_router_forwarder), |
| 366 globals_(NULL), | 367 globals_(NULL), |
| 367 sdch_manager_(NULL), | 368 sdch_manager_(NULL), |
| 368 is_spdy_disabled_by_policy_(false), | 369 is_spdy_disabled_by_policy_(false), |
| 369 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 370 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
| 371 v8_default_isolate_(v8::Isolate::GetCurrent()) { |
| 372 DCHECK(v8_default_isolate_); |
| 373 |
| 370 // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make | 374 // We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make |
| 371 // sure that everything is initialized in the right order. | 375 // sure that everything is initialized in the right order. |
| 372 // | 376 // |
| 373 // TODO(joi): See if we can fix so it does get registered from | 377 // TODO(joi): See if we can fix so it does get registered from |
| 374 // browser_prefs::RegisterLocalState. | 378 // browser_prefs::RegisterLocalState. |
| 375 RegisterPrefs(local_state); | 379 RegisterPrefs(local_state); |
| 376 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); | 380 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); |
| 377 negotiate_disable_cname_lookup_ = local_state->GetBoolean( | 381 negotiate_disable_cname_lookup_ = local_state->GetBoolean( |
| 378 prefs::kDisableAuthNegotiateCnameLookup); | 382 prefs::kDisableAuthNegotiateCnameLookup); |
| 379 negotiate_enable_port_ = local_state->GetBoolean( | 383 negotiate_enable_port_ = local_state->GetBoolean( |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 542 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 539 | 543 |
| 540 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); | 544 globals_->throttler_manager.reset(new net::URLRequestThrottlerManager()); |
| 541 globals_->throttler_manager->set_net_log(net_log_); | 545 globals_->throttler_manager->set_net_log(net_log_); |
| 542 // Always done in production, disabled only for unit tests. | 546 // Always done in production, disabled only for unit tests. |
| 543 globals_->throttler_manager->set_enable_thread_checks(true); | 547 globals_->throttler_manager->set_enable_thread_checks(true); |
| 544 | 548 |
| 545 globals_->proxy_script_fetcher_context.reset( | 549 globals_->proxy_script_fetcher_context.reset( |
| 546 ConstructProxyScriptFetcherContext(globals_, net_log_)); | 550 ConstructProxyScriptFetcherContext(globals_, net_log_)); |
| 547 | 551 |
| 552 globals_->v8_default_isolate = v8_default_isolate_; |
| 553 |
| 548 sdch_manager_ = new net::SdchManager(); | 554 sdch_manager_ = new net::SdchManager(); |
| 549 | 555 |
| 550 #if defined(OS_MACOSX) && !defined(OS_IOS) | 556 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 551 // Start observing Keychain events. This needs to be done on the UI thread, | 557 // Start observing Keychain events. This needs to be done on the UI thread, |
| 552 // as Keychain services requires a CFRunLoop. | 558 // as Keychain services requires a CFRunLoop. |
| 553 BrowserThread::PostTask(BrowserThread::UI, | 559 BrowserThread::PostTask(BrowserThread::UI, |
| 554 FROM_HERE, | 560 FROM_HERE, |
| 555 base::Bind(&ObserveKeychainEvents)); | 561 base::Bind(&ObserveKeychainEvents)); |
| 556 #endif | 562 #endif |
| 557 | 563 |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 868 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 874 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 869 DCHECK(!globals_->system_proxy_service.get()); | 875 DCHECK(!globals_->system_proxy_service.get()); |
| 870 DCHECK(system_proxy_config_service_.get()); | 876 DCHECK(system_proxy_config_service_.get()); |
| 871 | 877 |
| 872 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 878 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 873 globals_->system_proxy_service.reset( | 879 globals_->system_proxy_service.reset( |
| 874 ProxyServiceFactory::CreateProxyService( | 880 ProxyServiceFactory::CreateProxyService( |
| 875 net_log_, | 881 net_log_, |
| 876 globals_->proxy_script_fetcher_context.get(), | 882 globals_->proxy_script_fetcher_context.get(), |
| 877 system_proxy_config_service_.release(), | 883 system_proxy_config_service_.release(), |
| 884 v8_default_isolate_, |
| 878 command_line)); | 885 command_line)); |
| 879 | 886 |
| 880 net::HttpNetworkSession::Params system_params; | 887 net::HttpNetworkSession::Params system_params; |
| 881 InitializeNetworkSessionParams(&system_params); | 888 InitializeNetworkSessionParams(&system_params); |
| 882 system_params.net_log = net_log_; | 889 system_params.net_log = net_log_; |
| 883 system_params.proxy_service = globals_->system_proxy_service.get(); | 890 system_params.proxy_service = globals_->system_proxy_service.get(); |
| 884 | 891 |
| 885 globals_->system_http_transaction_factory.reset( | 892 globals_->system_http_transaction_factory.reset( |
| 886 new net::HttpNetworkLayer( | 893 new net::HttpNetworkLayer( |
| 887 new net::HttpNetworkSession(system_params))); | 894 new net::HttpNetworkSession(system_params))); |
| 888 globals_->system_ftp_transaction_factory.reset( | 895 globals_->system_ftp_transaction_factory.reset( |
| 889 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 896 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 890 globals_->system_request_context.reset( | 897 globals_->system_request_context.reset( |
| 891 ConstructSystemRequestContext(globals_, net_log_)); | 898 ConstructSystemRequestContext(globals_, net_log_)); |
| 892 | 899 |
| 893 sdch_manager_->set_sdch_fetcher( | 900 sdch_manager_->set_sdch_fetcher( |
| 894 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 901 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 895 } | 902 } |
| 896 | 903 |
| 897 void IOThread::UpdateDnsClientEnabled() { | 904 void IOThread::UpdateDnsClientEnabled() { |
| 898 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 905 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 899 } | 906 } |
| OLD | NEW |