| 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 <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/net/proxy_service_factory.h" | 40 #include "chrome/browser/net/proxy_service_factory.h" |
| 41 #include "chrome/common/channel_info.h" | 41 #include "chrome/common/channel_info.h" |
| 42 #include "chrome/common/chrome_content_client.h" | 42 #include "chrome/common/chrome_content_client.h" |
| 43 #include "chrome/common/chrome_switches.h" | 43 #include "chrome/common/chrome_switches.h" |
| 44 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 45 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
| 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 46 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 47 #include "components/data_usage/core/data_use_aggregator.h" | 47 #include "components/data_usage/core/data_use_aggregator.h" |
| 48 #include "components/data_usage/core/data_use_amortizer.h" | 48 #include "components/data_usage/core/data_use_amortizer.h" |
| 49 #include "components/data_usage/core/data_use_annotator.h" | 49 #include "components/data_usage/core/data_use_annotator.h" |
| 50 #include "components/metrics/metrics_service.h" |
| 50 #include "components/net_log/chrome_net_log.h" | 51 #include "components/net_log/chrome_net_log.h" |
| 51 #include "components/policy/core/common/policy_service.h" | 52 #include "components/policy/core/common/policy_service.h" |
| 52 #include "components/prefs/pref_registry_simple.h" | 53 #include "components/prefs/pref_registry_simple.h" |
| 53 #include "components/prefs/pref_service.h" | 54 #include "components/prefs/pref_service.h" |
| 54 #include "components/proxy_config/pref_proxy_config_tracker.h" | 55 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 55 #include "components/variations/variations_associated_data.h" | 56 #include "components/variations/variations_associated_data.h" |
| 56 #include "components/version_info/version_info.h" | 57 #include "components/version_info/version_info.h" |
| 57 #include "content/public/browser/browser_thread.h" | 58 #include "content/public/browser/browser_thread.h" |
| 58 #include "content/public/browser/cookie_store_factory.h" | 59 #include "content/public/browser/cookie_store_factory.h" |
| 59 #include "content/public/common/content_features.h" | 60 #include "content/public/common/content_features.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 is_spdy_disabled_by_policy_ = policy_service->GetPolicies( | 497 is_spdy_disabled_by_policy_ = policy_service->GetPolicies( |
| 497 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())).Get( | 498 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, std::string())).Get( |
| 498 policy::key::kDisableSpdy) != NULL; | 499 policy::key::kDisableSpdy) != NULL; |
| 499 | 500 |
| 500 const base::Value* value = policy_service->GetPolicies( | 501 const base::Value* value = policy_service->GetPolicies( |
| 501 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, | 502 policy::PolicyNamespace(policy::POLICY_DOMAIN_CHROME, |
| 502 std::string())).GetValue(policy::key::kQuicAllowed); | 503 std::string())).GetValue(policy::key::kQuicAllowed); |
| 503 if (value) | 504 if (value) |
| 504 value->GetAsBoolean(&is_quic_allowed_by_policy_); | 505 value->GetAsBoolean(&is_quic_allowed_by_policy_); |
| 505 | 506 |
| 507 data_use_tracker_ = g_browser_process->metrics_service()->GetDataUseTracker(); |
| 508 |
| 506 BrowserThread::SetDelegate(BrowserThread::IO, this); | 509 BrowserThread::SetDelegate(BrowserThread::IO, this); |
| 507 } | 510 } |
| 508 | 511 |
| 509 IOThread::~IOThread() { | 512 IOThread::~IOThread() { |
| 510 // This isn't needed for production code, but in tests, IOThread may | 513 // This isn't needed for production code, but in tests, IOThread may |
| 511 // be multiply constructed. | 514 // be multiply constructed. |
| 512 BrowserThread::SetDelegate(BrowserThread::IO, NULL); | 515 BrowserThread::SetDelegate(BrowserThread::IO, NULL); |
| 513 | 516 |
| 514 pref_proxy_config_tracker_->DetachFromPrefService(); | 517 pref_proxy_config_tracker_->DetachFromPrefService(); |
| 515 DCHECK(!globals_); | 518 DCHECK(!globals_); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 new chrome_browser_data_usage::TabIdAnnotator()), | 605 new chrome_browser_data_usage::TabIdAnnotator()), |
| 603 std::move(data_use_amortizer))); | 606 std::move(data_use_amortizer))); |
| 604 | 607 |
| 605 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 608 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 606 // is fixed. | 609 // is fixed. |
| 607 tracked_objects::ScopedTracker tracking_profile3( | 610 tracked_objects::ScopedTracker tracking_profile3( |
| 608 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 611 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 609 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); | 612 "466432 IOThread::InitAsync::ChromeNetworkDelegate")); |
| 610 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( | 613 scoped_ptr<ChromeNetworkDelegate> chrome_network_delegate( |
| 611 new ChromeNetworkDelegate(extension_event_router_forwarder(), | 614 new ChromeNetworkDelegate(extension_event_router_forwarder(), |
| 612 &system_enable_referrers_)); | 615 &system_enable_referrers_, data_use_tracker_)); |
| 613 // By default, data usage is considered off the record. | 616 // By default, data usage is considered off the record. |
| 614 chrome_network_delegate->set_data_use_aggregator( | 617 chrome_network_delegate->set_data_use_aggregator( |
| 615 globals_->data_use_aggregator.get(), | 618 globals_->data_use_aggregator.get(), |
| 616 true /* is_data_usage_off_the_record */); | 619 true /* is_data_usage_off_the_record */); |
| 617 | 620 |
| 618 #if BUILDFLAG(ANDROID_JAVA_UI) | 621 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 619 globals_->external_data_use_observer.reset( | 622 globals_->external_data_use_observer.reset( |
| 620 new chrome::android::ExternalDataUseObserver( | 623 new chrome::android::ExternalDataUseObserver( |
| 621 globals_->data_use_aggregator.get(), | 624 globals_->data_use_aggregator.get(), |
| 622 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 625 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1778 std::move(job_factory); | 1781 std::move(job_factory); |
| 1779 | 1782 |
| 1780 context->set_job_factory( | 1783 context->set_job_factory( |
| 1781 globals->proxy_script_fetcher_url_request_job_factory.get()); | 1784 globals->proxy_script_fetcher_url_request_job_factory.get()); |
| 1782 | 1785 |
| 1783 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1786 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1784 // system URLRequestContext too. There's no reason this should be tied to a | 1787 // system URLRequestContext too. There's no reason this should be tied to a |
| 1785 // profile. | 1788 // profile. |
| 1786 return context; | 1789 return context; |
| 1787 } | 1790 } |
| OLD | NEW |