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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/domain_reliability/service_factory.h" | 37 #include "chrome/browser/domain_reliability/service_factory.h" |
38 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 38 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
39 #include "chrome/browser/download/download_service.h" | 39 #include "chrome/browser/download/download_service.h" |
40 #include "chrome/browser/download/download_service_factory.h" | 40 #include "chrome/browser/download/download_service_factory.h" |
41 #include "chrome/browser/history/top_sites.h" | 41 #include "chrome/browser/history/top_sites.h" |
42 #include "chrome/browser/net/chrome_net_log.h" | 42 #include "chrome/browser/net/chrome_net_log.h" |
43 #include "chrome/browser/net/net_pref_observer.h" | 43 #include "chrome/browser/net/net_pref_observer.h" |
44 #include "chrome/browser/net/predictor.h" | 44 #include "chrome/browser/net/predictor.h" |
45 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 45 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
46 #include "chrome/browser/net/proxy_service_factory.h" | 46 #include "chrome/browser/net/proxy_service_factory.h" |
47 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" | |
48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 47 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" | 48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
50 #include "chrome/browser/net/ssl_config_service_manager.h" | 49 #include "chrome/browser/net/ssl_config_service_manager.h" |
51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 50 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
52 #include "chrome/browser/plugins/plugin_prefs.h" | 51 #include "chrome/browser/plugins/plugin_prefs.h" |
53 #include "chrome/browser/policy/profile_policy_connector.h" | 52 #include "chrome/browser/policy/profile_policy_connector.h" |
54 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 53 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
55 #include "chrome/browser/prefs/browser_prefs.h" | 54 #include "chrome/browser/prefs/browser_prefs.h" |
56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
57 #include "chrome/browser/prefs/pref_service_syncable.h" | 56 #include "chrome/browser/prefs/pref_service_syncable.h" |
(...skipping 19 matching lines...) Expand all Loading... |
77 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" | 76 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
78 #include "chrome/common/chrome_constants.h" | 77 #include "chrome/common/chrome_constants.h" |
79 #include "chrome/common/chrome_paths_internal.h" | 78 #include "chrome/common/chrome_paths_internal.h" |
80 #include "chrome/common/chrome_switches.h" | 79 #include "chrome/common/chrome_switches.h" |
81 #include "chrome/common/chrome_version_info.h" | 80 #include "chrome/common/chrome_version_info.h" |
82 #include "chrome/common/pref_names.h" | 81 #include "chrome/common/pref_names.h" |
83 #include "chrome/common/url_constants.h" | 82 #include "chrome/common/url_constants.h" |
84 #include "chrome/grit/chromium_strings.h" | 83 #include "chrome/grit/chromium_strings.h" |
85 #include "components/bookmarks/browser/bookmark_model.h" | 84 #include "components/bookmarks/browser/bookmark_model.h" |
86 #include "components/content_settings/core/browser/host_content_settings_map.h" | 85 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 86 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
igurator.h" |
87 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 87 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" |
88 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" | 88 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_sett
ings.h" |
89 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | 89 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" |
90 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" | 90 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
91 #include "components/domain_reliability/monitor.h" | 91 #include "components/domain_reliability/monitor.h" |
92 #include "components/domain_reliability/service.h" | 92 #include "components/domain_reliability/service.h" |
93 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 93 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
94 #include "components/metrics/metrics_service.h" | 94 #include "components/metrics/metrics_service.h" |
95 #include "components/pref_registry/pref_registry_syncable.h" | 95 #include "components/pref_registry/pref_registry_syncable.h" |
96 #include "components/signin/core/browser/signin_manager.h" | 96 #include "components/signin/core/browser/signin_manager.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 637 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
638 startup_pref_type == SessionStartupPref::LAST) { | 638 startup_pref_type == SessionStartupPref::LAST) { |
639 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 639 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
640 } | 640 } |
641 | 641 |
642 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); | 642 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); |
643 | 643 |
644 base::Callback<void(bool)> data_reduction_proxy_unavailable; | 644 base::Callback<void(bool)> data_reduction_proxy_unavailable; |
645 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 645 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> |
646 data_reduction_proxy_params; | 646 data_reduction_proxy_params; |
647 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; | 647 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> configurator; |
648 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 648 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> |
649 data_reduction_proxy_statistics_prefs; | 649 data_reduction_proxy_statistics_prefs; |
650 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> event_store; | 650 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> event_store; |
651 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = | 651 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = |
652 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); | 652 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); |
653 data_reduction_proxy_params = | 653 data_reduction_proxy_params = |
654 data_reduction_proxy_chrome_settings->params()->Clone(); | 654 data_reduction_proxy_chrome_settings->params()->Clone(); |
655 data_reduction_proxy_unavailable = | 655 data_reduction_proxy_unavailable = |
656 base::Bind( | 656 base::Bind( |
657 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, | 657 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, |
658 base::Unretained(data_reduction_proxy_chrome_settings)); | 658 base::Unretained(data_reduction_proxy_chrome_settings)); |
659 // The event_store is used by DataReductionProxyChromeSettings, configurator, | 659 // The event_store is used by DataReductionProxyChromeSettings, configurator, |
660 // and ProfileIOData. Ownership is passed to the latter via | 660 // and ProfileIOData. Ownership is passed to the latter via |
661 // ProfileIOData::Handle, which is only destroyed after | 661 // ProfileIOData::Handle, which is only destroyed after |
662 // BrowserContextKeyedServices, including DataReductionProxyChromeSettings | 662 // BrowserContextKeyedServices, including DataReductionProxyChromeSettings |
663 event_store.reset( | 663 event_store.reset( |
664 new data_reduction_proxy::DataReductionProxyEventStore( | 664 new data_reduction_proxy::DataReductionProxyEventStore( |
665 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); | 665 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); |
666 // The configurator is used by DataReductionProxyChromeSettings and | 666 // The configurator is used by DataReductionProxyChromeSettings and |
667 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, | 667 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, |
668 // which is only destroyed after BrowserContextKeyedServices, | 668 // which is only destroyed after BrowserContextKeyedServices, |
669 // including DataReductionProxyChromeSettings. | 669 // including DataReductionProxyChromeSettings. |
670 chrome_configurator.reset( | 670 configurator.reset( |
671 new DataReductionProxyChromeConfigurator( | 671 new data_reduction_proxy::DataReductionProxyConfigurator( |
672 prefs_.get(), | |
673 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 672 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
674 net_log, | 673 net_log, |
675 event_store.get())); | 674 event_store.get())); |
676 // Retain a raw pointer to use for initialization of data reduction proxy | 675 // Retain a raw pointer to use for initialization of data reduction proxy |
677 // settings after ownership is passed | 676 // settings after ownership is passed |
678 data_reduction_proxy::DataReductionProxyEventStore* | 677 data_reduction_proxy::DataReductionProxyEventStore* |
679 data_reduction_proxy_event_store = event_store.get(); | 678 data_reduction_proxy_event_store = event_store.get(); |
680 // Retain a raw pointer to use for initialization of data reduction proxy | 679 // Retain a raw pointer to use for initialization of data reduction proxy |
681 // settings after ownership is passed. | 680 // settings after ownership is passed. |
682 DataReductionProxyChromeConfigurator* | 681 data_reduction_proxy::DataReductionProxyConfigurator* |
683 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); | 682 data_reduction_proxy_configurator = configurator.get(); |
684 #if defined(OS_ANDROID) || defined(OS_IOS) | 683 #if defined(OS_ANDROID) || defined(OS_IOS) |
685 // On mobile we write data reduction proxy prefs directly to the pref service. | 684 // On mobile we write data reduction proxy prefs directly to the pref service. |
686 // On desktop we store data reduction proxy prefs in memory, writing to disk | 685 // On desktop we store data reduction proxy prefs in memory, writing to disk |
687 // every 60 minutes and on termination. Shutdown hooks must be added for | 686 // every 60 minutes and on termination. Shutdown hooks must be added for |
688 // Android and iOS in order for non-zero delays to be supported. | 687 // Android and iOS in order for non-zero delays to be supported. |
689 // (http://crbug.com/408264) | 688 // (http://crbug.com/408264) |
690 base::TimeDelta commit_delay = base::TimeDelta(); | 689 base::TimeDelta commit_delay = base::TimeDelta(); |
691 #else | 690 #else |
692 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | 691 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); |
693 #endif | 692 #endif |
(...skipping 11 matching lines...) Expand all Loading... |
705 | 704 |
706 // Make sure we initialize the ProfileIOData after everything else has been | 705 // Make sure we initialize the ProfileIOData after everything else has been |
707 // initialized that we might be reading from the IO thread. | 706 // initialized that we might be reading from the IO thread. |
708 | 707 |
709 io_data_.Init(cookie_path, channel_id_path, cache_path, | 708 io_data_.Init(cookie_path, channel_id_path, cache_path, |
710 cache_max_size, media_cache_path, media_cache_max_size, | 709 cache_max_size, media_cache_path, media_cache_max_size, |
711 extensions_cookie_path, GetPath(), infinite_cache_path, | 710 extensions_cookie_path, GetPath(), infinite_cache_path, |
712 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), | 711 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
713 CreateDomainReliabilityMonitor(local_state), | 712 CreateDomainReliabilityMonitor(local_state), |
714 data_reduction_proxy_unavailable, | 713 data_reduction_proxy_unavailable, |
715 chrome_configurator.Pass(), | 714 configurator.Pass(), |
716 data_reduction_proxy_params.Pass(), | 715 data_reduction_proxy_params.Pass(), |
717 data_reduction_proxy_statistics_prefs.Pass(), | 716 data_reduction_proxy_statistics_prefs.Pass(), |
718 event_store.Pass()); | 717 event_store.Pass()); |
719 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( | 718 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( |
720 data_reduction_proxy_chrome_configurator, | 719 data_reduction_proxy_configurator, |
721 prefs_.get(), | 720 prefs_.get(), |
722 g_browser_process->local_state(), | 721 g_browser_process->local_state(), |
723 GetRequestContext(), | 722 GetRequestContext(), |
724 net_log, | 723 net_log, |
725 data_reduction_proxy_event_store); | 724 data_reduction_proxy_event_store); |
726 | 725 |
727 #if defined(ENABLE_PLUGINS) | 726 #if defined(ENABLE_PLUGINS) |
728 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 727 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
729 PluginPrefs::GetForProfile(this).get(), | 728 PluginPrefs::GetForProfile(this).get(), |
730 io_data_.GetResourceContextNoInit()); | 729 io_data_.GetResourceContextNoInit()); |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1418 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
1420 domain_reliability::DomainReliabilityService* service = | 1419 domain_reliability::DomainReliabilityService* service = |
1421 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1420 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
1422 GetForBrowserContext(this); | 1421 GetForBrowserContext(this); |
1423 if (!service) | 1422 if (!service) |
1424 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1423 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
1425 | 1424 |
1426 return service->CreateMonitor( | 1425 return service->CreateMonitor( |
1427 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1426 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
1428 } | 1427 } |
OLD | NEW |