| 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 27 matching lines...) Expand all Loading... |
| 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" | 47 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator.
h" |
| 48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_io_data.h" |
| 48 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 49 #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" | 50 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact
ory.h" |
| 50 #include "chrome/browser/net/ssl_config_service_manager.h" | 51 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 52 #include "chrome/browser/plugins/plugin_prefs.h" | 53 #include "chrome/browser/plugins/plugin_prefs.h" |
| 53 #include "chrome/browser/policy/profile_policy_connector.h" | 54 #include "chrome/browser/policy/profile_policy_connector.h" |
| 54 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 55 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 55 #include "chrome/browser/prefs/browser_prefs.h" | 56 #include "chrome/browser/prefs/browser_prefs.h" |
| 56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 57 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 57 #include "chrome/browser/prefs/pref_service_syncable.h" | 58 #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" | 78 #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" |
| 78 #include "chrome/common/chrome_constants.h" | 79 #include "chrome/common/chrome_constants.h" |
| 79 #include "chrome/common/chrome_paths_internal.h" | 80 #include "chrome/common/chrome_paths_internal.h" |
| 80 #include "chrome/common/chrome_switches.h" | 81 #include "chrome/common/chrome_switches.h" |
| 81 #include "chrome/common/chrome_version_info.h" | 82 #include "chrome/common/chrome_version_info.h" |
| 82 #include "chrome/common/pref_names.h" | 83 #include "chrome/common/pref_names.h" |
| 83 #include "chrome/common/url_constants.h" | 84 #include "chrome/common/url_constants.h" |
| 84 #include "chrome/grit/chromium_strings.h" | 85 #include "chrome/grit/chromium_strings.h" |
| 85 #include "components/bookmarks/browser/bookmark_model.h" | 86 #include "components/bookmarks/browser/bookmark_model.h" |
| 86 #include "components/content_settings/core/browser/host_content_settings_map.h" | 87 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 88 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_d
ata.h" |
| 87 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_pref
s.h" | 89 #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" | 90 #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" | 91 #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" | 92 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param
s.h" |
| 91 #include "components/domain_reliability/monitor.h" | 93 #include "components/domain_reliability/monitor.h" |
| 92 #include "components/domain_reliability/service.h" | 94 #include "components/domain_reliability/service.h" |
| 93 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 95 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 94 #include "components/metrics/metrics_service.h" | 96 #include "components/metrics/metrics_service.h" |
| 95 #include "components/pref_registry/pref_registry_syncable.h" | 97 #include "components/pref_registry/pref_registry_syncable.h" |
| 96 #include "components/signin/core/browser/signin_manager.h" | 98 #include "components/signin/core/browser/signin_manager.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 StartupBrowserCreator::GetSessionStartupPref( | 632 StartupBrowserCreator::GetSessionStartupPref( |
| 631 *CommandLine::ForCurrentProcess(), this).type; | 633 *CommandLine::ForCurrentProcess(), this).type; |
| 632 #endif | 634 #endif |
| 633 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = | 635 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = |
| 634 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; | 636 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; |
| 635 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 637 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
| 636 startup_pref_type == SessionStartupPref::LAST) { | 638 startup_pref_type == SessionStartupPref::LAST) { |
| 637 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 639 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
| 638 } | 640 } |
| 639 | 641 |
| 642 // TODO(bengr): Remove this in M-43. |
| 643 data_reduction_proxy::MigrateStatisticsPrefs(g_browser_process->local_state(), |
| 644 prefs_.get()); |
| 645 |
| 640 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); | 646 ChromeNetLog* const net_log = g_browser_process->io_thread()->net_log(); |
| 641 | 647 |
| 642 base::Callback<void(bool)> data_reduction_proxy_unavailable; | 648 // Retain a raw pointer to use for initialization of data reduction proxy |
| 643 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | 649 // settings after ownership is passed. |
| 644 data_reduction_proxy_params; | 650 DataReductionProxyChromeConfigurator* |
| 645 scoped_ptr<DataReductionProxyChromeConfigurator> chrome_configurator; | 651 data_reduction_proxy_chrome_configurator = nullptr; |
| 646 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs> | 652 |
| 647 data_reduction_proxy_statistics_prefs; | 653 scoped_ptr<data_reduction_proxy::DataReductionProxyIOData> |
| 648 scoped_ptr<data_reduction_proxy::DataReductionProxyEventStore> event_store; | 654 data_reduction_proxy_io_data = |
| 649 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = | 655 CreateDataReductionProxyChromeIOData( |
| 650 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); | 656 net_log, this, prefs_.get(), |
| 651 data_reduction_proxy_params = | 657 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), |
| 652 data_reduction_proxy_chrome_settings->params()->Clone(); | 658 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), |
| 653 data_reduction_proxy_unavailable = | 659 &data_reduction_proxy_chrome_configurator).Pass(); |
| 654 base::Bind( | 660 |
| 655 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, | |
| 656 base::Unretained(data_reduction_proxy_chrome_settings)); | |
| 657 // The event_store is used by DataReductionProxyChromeSettings, configurator, | |
| 658 // and ProfileIOData. Ownership is passed to the latter via | |
| 659 // ProfileIOData::Handle, which is only destroyed after | |
| 660 // BrowserContextKeyedServices, including DataReductionProxyChromeSettings | |
| 661 event_store.reset( | |
| 662 new data_reduction_proxy::DataReductionProxyEventStore( | |
| 663 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); | |
| 664 // The configurator is used by DataReductionProxyChromeSettings and | |
| 665 // ProfileIOData. Ownership is passed to the latter via ProfileIOData::Handle, | |
| 666 // which is only destroyed after BrowserContextKeyedServices, | |
| 667 // including DataReductionProxyChromeSettings. | |
| 668 chrome_configurator.reset( | |
| 669 new DataReductionProxyChromeConfigurator( | |
| 670 prefs_.get(), | |
| 671 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | |
| 672 net_log, | |
| 673 event_store.get())); | |
| 674 // Retain a raw pointer to use for initialization of data reduction proxy | 661 // Retain a raw pointer to use for initialization of data reduction proxy |
| 675 // settings after ownership is passed | 662 // settings after ownership is passed |
| 676 data_reduction_proxy::DataReductionProxyEventStore* | 663 data_reduction_proxy::DataReductionProxyEventStore* |
| 677 data_reduction_proxy_event_store = event_store.get(); | 664 data_reduction_proxy_event_store = |
| 678 // Retain a raw pointer to use for initialization of data reduction proxy | 665 data_reduction_proxy_io_data->event_store(); |
| 679 // settings after ownership is passed. | |
| 680 DataReductionProxyChromeConfigurator* | |
| 681 data_reduction_proxy_chrome_configurator = chrome_configurator.get(); | |
| 682 #if defined(OS_ANDROID) || defined(OS_IOS) | |
| 683 // On mobile we write data reduction proxy prefs directly to the pref service. | |
| 684 // On desktop we store data reduction proxy prefs in memory, writing to disk | |
| 685 // every 60 minutes and on termination. Shutdown hooks must be added for | |
| 686 // Android and iOS in order for non-zero delays to be supported. | |
| 687 // (http://crbug.com/408264) | |
| 688 base::TimeDelta commit_delay = base::TimeDelta(); | |
| 689 #else | |
| 690 base::TimeDelta commit_delay = base::TimeDelta::FromMinutes(60); | |
| 691 #endif | |
| 692 // TODO(bengr): Remove this in M-43. | |
| 693 data_reduction_proxy::MigrateStatisticsPrefs(g_browser_process->local_state(), | |
| 694 prefs_.get()); | |
| 695 data_reduction_proxy_statistics_prefs = | |
| 696 scoped_ptr<data_reduction_proxy::DataReductionProxyStatisticsPrefs>( | |
| 697 new data_reduction_proxy::DataReductionProxyStatisticsPrefs( | |
| 698 prefs_.get(), | |
| 699 base::MessageLoopProxy::current(), | |
| 700 commit_delay)); | |
| 701 data_reduction_proxy_chrome_settings->SetDataReductionProxyStatisticsPrefs( | |
| 702 data_reduction_proxy_statistics_prefs.get()); | |
| 703 | 666 |
| 704 // Make sure we initialize the ProfileIOData after everything else has been | 667 // Make sure we initialize the ProfileIOData after everything else has been |
| 705 // initialized that we might be reading from the IO thread. | 668 // initialized that we might be reading from the IO thread. |
| 706 | 669 |
| 707 io_data_.Init(cookie_path, channel_id_path, cache_path, | 670 io_data_.Init(cookie_path, channel_id_path, cache_path, |
| 708 cache_max_size, media_cache_path, media_cache_max_size, | 671 cache_max_size, media_cache_path, media_cache_max_size, |
| 709 extensions_cookie_path, GetPath(), infinite_cache_path, | 672 extensions_cookie_path, GetPath(), infinite_cache_path, |
| 710 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), | 673 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
| 711 CreateDomainReliabilityMonitor(local_state), | 674 CreateDomainReliabilityMonitor(local_state), |
| 712 data_reduction_proxy_unavailable, | 675 data_reduction_proxy_io_data.Pass()); |
| 713 chrome_configurator.Pass(), | 676 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this)-> |
| 714 data_reduction_proxy_params.Pass(), | 677 InitDataReductionProxySettings( |
| 715 data_reduction_proxy_statistics_prefs.Pass(), | 678 data_reduction_proxy_chrome_configurator, prefs_.get(), |
| 716 event_store.Pass()); | 679 g_browser_process->local_state(), GetRequestContext(), net_log, |
| 717 data_reduction_proxy_chrome_settings->InitDataReductionProxySettings( | 680 data_reduction_proxy_event_store); |
| 718 data_reduction_proxy_chrome_configurator, | |
| 719 prefs_.get(), | |
| 720 g_browser_process->local_state(), | |
| 721 GetRequestContext(), | |
| 722 net_log, | |
| 723 data_reduction_proxy_event_store); | |
| 724 | 681 |
| 725 #if defined(ENABLE_PLUGINS) | 682 #if defined(ENABLE_PLUGINS) |
| 726 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 683 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 727 PluginPrefs::GetForProfile(this).get(), | 684 PluginPrefs::GetForProfile(this).get(), |
| 728 io_data_.GetResourceContextNoInit()); | 685 io_data_.GetResourceContextNoInit()); |
| 729 #endif | 686 #endif |
| 730 | 687 |
| 731 // Delay README creation to not impact startup performance. | 688 // Delay README creation to not impact startup performance. |
| 732 BrowserThread::PostDelayedTask( | 689 BrowserThread::PostDelayedTask( |
| 733 BrowserThread::FILE, FROM_HERE, | 690 BrowserThread::FILE, FROM_HERE, |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1416 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1373 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1417 domain_reliability::DomainReliabilityService* service = | 1374 domain_reliability::DomainReliabilityService* service = |
| 1418 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1375 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1419 GetForBrowserContext(this); | 1376 GetForBrowserContext(this); |
| 1420 if (!service) | 1377 if (!service) |
| 1421 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1378 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1422 | 1379 |
| 1423 return service->CreateMonitor( | 1380 return service->CreateMonitor( |
| 1424 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1381 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1425 } | 1382 } |
| OLD | NEW |