| 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/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/browser/net/chrome_network_delegate.h" | 33 #include "chrome/browser/net/chrome_network_delegate.h" |
| 34 #include "chrome/browser/net/connect_interceptor.h" | 34 #include "chrome/browser/net/connect_interceptor.h" |
| 35 #include "chrome/browser/net/dns_probe_service.h" | 35 #include "chrome/browser/net/dns_probe_service.h" |
| 36 #include "chrome/browser/net/proxy_service_factory.h" | 36 #include "chrome/browser/net/proxy_service_factory.h" |
| 37 #include "chrome/common/channel_info.h" | 37 #include "chrome/common/channel_info.h" |
| 38 #include "chrome/common/chrome_content_client.h" | 38 #include "chrome/common/chrome_content_client.h" |
| 39 #include "chrome/common/chrome_switches.h" | 39 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/pref_names.h" | 40 #include "chrome/common/pref_names.h" |
| 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 41 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 42 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 43 #include "components/data_usage/core/data_use_aggregator.h" | |
| 44 #include "components/net_log/chrome_net_log.h" | 43 #include "components/net_log/chrome_net_log.h" |
| 45 #include "components/policy/core/common/policy_service.h" | 44 #include "components/policy/core/common/policy_service.h" |
| 46 #include "components/proxy_config/pref_proxy_config_tracker.h" | 45 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 47 #include "components/variations/variations_associated_data.h" | 46 #include "components/variations/variations_associated_data.h" |
| 48 #include "components/version_info/version_info.h" | 47 #include "components/version_info/version_info.h" |
| 49 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
| 50 #include "content/public/browser/cookie_store_factory.h" | 49 #include "content/public/browser/cookie_store_factory.h" |
| 51 #include "content/public/common/user_agent.h" | 50 #include "content/public/common/user_agent.h" |
| 52 #include "net/base/external_estimate_provider.h" | 51 #include "net/base/external_estimate_provider.h" |
| 53 #include "net/base/host_mapping_rules.h" | 52 #include "net/base/host_mapping_rules.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 #if defined(ENABLE_EXTENSIONS) | 100 #if defined(ENABLE_EXTENSIONS) |
| 102 #include "chrome/browser/extensions/event_router_forwarder.h" | 101 #include "chrome/browser/extensions/event_router_forwarder.h" |
| 103 #endif | 102 #endif |
| 104 | 103 |
| 105 #if defined(USE_NSS_CERTS) || defined(OS_IOS) | 104 #if defined(USE_NSS_CERTS) || defined(OS_IOS) |
| 106 #include "net/cert_net/nss_ocsp.h" | 105 #include "net/cert_net/nss_ocsp.h" |
| 107 #endif | 106 #endif |
| 108 | 107 |
| 109 #if defined(OS_ANDROID) | 108 #if defined(OS_ANDROID) |
| 110 #include "base/android/build_info.h" | 109 #include "base/android/build_info.h" |
| 110 #include "chrome/browser/android/datausage/external_data_use_observer_android.h" |
| 111 #include "chrome/browser/android/net/external_estimate_provider_android.h" | 111 #include "chrome/browser/android/net/external_estimate_provider_android.h" |
| 112 #endif | 112 #endif |
| 113 | 113 |
| 114 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
| 115 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" | 115 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" |
| 116 #include "chromeos/network/host_resolver_impl_chromeos.h" | 116 #include "chromeos/network/host_resolver_impl_chromeos.h" |
| 117 #endif | 117 #endif |
| 118 | 118 |
| 119 using content::BrowserThread; | 119 using content::BrowserThread; |
| 120 | 120 |
| (...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 new LoggingNetworkChangeObserver(net_log_)); | 561 new LoggingNetworkChangeObserver(net_log_)); |
| 562 | 562 |
| 563 // Setup the HistogramWatcher to run on the IO thread. | 563 // Setup the HistogramWatcher to run on the IO thread. |
| 564 net::NetworkChangeNotifier::InitHistogramWatcher(); | 564 net::NetworkChangeNotifier::InitHistogramWatcher(); |
| 565 | 565 |
| 566 #if defined(ENABLE_EXTENSIONS) | 566 #if defined(ENABLE_EXTENSIONS) |
| 567 globals_->extension_event_router_forwarder = | 567 globals_->extension_event_router_forwarder = |
| 568 extension_event_router_forwarder_; | 568 extension_event_router_forwarder_; |
| 569 #endif | 569 #endif |
| 570 | 570 |
| 571 globals_->data_use_aggregator.reset(new data_usage::DataUseAggregator()); | 571 data_use_aggregator_.reset(new data_usage::DataUseAggregator()); |
| 572 | 572 |
| 573 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 573 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 574 // is fixed. | 574 // is fixed. |
| 575 tracked_objects::ScopedTracker tracking_profile3( | 575 tracked_objects::ScopedTracker tracking_profile3( |
| 576 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 576 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 577 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); | 577 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); |
| 578 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( | 578 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( |
| 579 new ChromeNetworkDelegate(extension_event_router_forwarder(), | 579 new ChromeNetworkDelegate(extension_event_router_forwarder(), |
| 580 &system_enable_referrers_)); | 580 &system_enable_referrers_)); |
| 581 // By default, data usage is considered off the record. | 581 // By default, data usage is considered off the record. |
| 582 chrome_network_delegate->set_data_use_aggregator( | 582 chrome_network_delegate->set_data_use_aggregator( |
| 583 globals_->data_use_aggregator.get(), | 583 data_use_aggregator(), true /* is_data_usage_off_the_record */); |
| 584 true /* is_data_usage_off_the_record */); | 584 |
| 585 #if defined(OS_ANDROID) |
| 586 external_data_use_observer_.reset( |
| 587 new chrome::android::ExternalDataUseObserverAndroid( |
| 588 data_use_aggregator())); |
| 589 #endif |
| 585 | 590 |
| 586 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 591 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 587 // is fixed. | 592 // is fixed. |
| 588 tracked_objects::ScopedTracker tracking_profile4( | 593 tracked_objects::ScopedTracker tracking_profile4( |
| 589 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 594 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 590 "466432 IOThread::InitAsync::CreateGlobalHostResolver")); | 595 "466432 IOThread::InitAsync::CreateGlobalHostResolver")); |
| 591 globals_->system_network_delegate = chrome_network_delegate.Pass(); | 596 globals_->system_network_delegate = chrome_network_delegate.Pass(); |
| 592 globals_->host_resolver = CreateGlobalHostResolver(net_log_); | 597 globals_->host_resolver = CreateGlobalHostResolver(net_log_); |
| 593 | 598 |
| 594 std::map<std::string, std::string> network_quality_estimator_params; | 599 std::map<std::string, std::string> network_quality_estimator_params; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 globals.origin_to_force_quic_on.CopyToIfSet( | 1055 globals.origin_to_force_quic_on.CopyToIfSet( |
| 1051 ¶ms->origin_to_force_quic_on); | 1056 ¶ms->origin_to_force_quic_on); |
| 1052 params->enable_user_alternate_protocol_ports = | 1057 params->enable_user_alternate_protocol_ports = |
| 1053 globals.enable_user_alternate_protocol_ports; | 1058 globals.enable_user_alternate_protocol_ports; |
| 1054 } | 1059 } |
| 1055 | 1060 |
| 1056 base::TimeTicks IOThread::creation_time() const { | 1061 base::TimeTicks IOThread::creation_time() const { |
| 1057 return creation_time_; | 1062 return creation_time_; |
| 1058 } | 1063 } |
| 1059 | 1064 |
| 1065 data_usage::DataUseAggregator* IOThread::data_use_aggregator() const { |
| 1066 return data_use_aggregator_.get(); |
| 1067 } |
| 1068 |
| 1060 net::SSLConfigService* IOThread::GetSSLConfigService() { | 1069 net::SSLConfigService* IOThread::GetSSLConfigService() { |
| 1061 return ssl_config_service_manager_->Get(); | 1070 return ssl_config_service_manager_->Get(); |
| 1062 } | 1071 } |
| 1063 | 1072 |
| 1064 void IOThread::ChangedToOnTheRecordOnIOThread() { | 1073 void IOThread::ChangedToOnTheRecordOnIOThread() { |
| 1065 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1074 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 1066 | 1075 |
| 1067 // Clear the host cache to avoid showing entries from the OTR session | 1076 // Clear the host cache to avoid showing entries from the OTR session |
| 1068 // in about:net-internals. | 1077 // in about:net-internals. |
| 1069 ClearHostCache(); | 1078 ClearHostCache(); |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1590 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); | 1599 globals->proxy_script_fetcher_url_request_job_factory = job_factory.Pass(); |
| 1591 | 1600 |
| 1592 context->set_job_factory( | 1601 context->set_job_factory( |
| 1593 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1602 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1594 | 1603 |
| 1595 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1604 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1596 // system URLRequestContext too. There's no reason this should be tied to a | 1605 // system URLRequestContext too. There's no reason this should be tied to a |
| 1597 // profile. | 1606 // profile. |
| 1598 return context; | 1607 return context; |
| 1599 } | 1608 } |
| OLD | NEW |