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