Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 #include "chrome/browser/domain_reliability/service_factory.h" | 39 #include "chrome/browser/domain_reliability/service_factory.h" |
| 40 #include "chrome/browser/download/chrome_download_manager_delegate.h" | 40 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 41 #include "chrome/browser/download/download_service.h" | 41 #include "chrome/browser/download/download_service.h" |
| 42 #include "chrome/browser/download/download_service_factory.h" | 42 #include "chrome/browser/download/download_service_factory.h" |
| 43 #include "chrome/browser/history/top_sites.h" | 43 #include "chrome/browser/history/top_sites.h" |
| 44 #include "chrome/browser/net/chrome_url_request_context.h" | 44 #include "chrome/browser/net/chrome_url_request_context.h" |
| 45 #include "chrome/browser/net/net_pref_observer.h" | 45 #include "chrome/browser/net/net_pref_observer.h" |
| 46 #include "chrome/browser/net/predictor.h" | 46 #include "chrome/browser/net/predictor.h" |
| 47 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 47 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 48 #include "chrome/browser/net/proxy_service_factory.h" | 48 #include "chrome/browser/net/proxy_service_factory.h" |
| 49 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | |
| 49 #include "chrome/browser/net/ssl_config_service_manager.h" | 50 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 50 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 51 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 51 #include "chrome/browser/plugins/plugin_prefs.h" | 52 #include "chrome/browser/plugins/plugin_prefs.h" |
| 52 #include "chrome/browser/policy/profile_policy_connector.h" | 53 #include "chrome/browser/policy/profile_policy_connector.h" |
| 53 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 54 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 54 #include "chrome/browser/prefs/browser_prefs.h" | 55 #include "chrome/browser/prefs/browser_prefs.h" |
| 55 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 56 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 56 #include "chrome/browser/prefs/pref_service_syncable.h" | 57 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 57 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 58 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
| 58 #include "chrome/browser/prerender/prerender_manager_factory.h" | 59 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" | 105 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" |
| 105 #endif | 106 #endif |
| 106 | 107 |
| 107 #if defined(OS_CHROMEOS) | 108 #if defined(OS_CHROMEOS) |
| 108 #include "chrome/browser/chromeos/locale_change_guard.h" | 109 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 109 #include "chrome/browser/chromeos/login/users/user_manager.h" | 110 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 110 #include "chrome/browser/chromeos/preferences.h" | 111 #include "chrome/browser/chromeos/preferences.h" |
| 111 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 112 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 112 #endif | 113 #endif |
| 113 | 114 |
| 115 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 116 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_configurator. h" | |
| 117 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | |
| 118 #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" | |
| 119 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
| 120 #endif | |
| 121 | |
| 114 #if defined(ENABLE_CONFIGURATION_POLICY) | 122 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 115 #include "chrome/browser/policy/schema_registry_service.h" | 123 #include "chrome/browser/policy/schema_registry_service.h" |
| 116 #include "chrome/browser/policy/schema_registry_service_factory.h" | 124 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 117 #include "components/policy/core/browser/browser_policy_connector.h" | 125 #include "components/policy/core/browser/browser_policy_connector.h" |
| 118 #if defined(OS_CHROMEOS) | 126 #if defined(OS_CHROMEOS) |
| 119 #include "chrome/browser/chromeos/login/login_utils.h" | 127 #include "chrome/browser/chromeos/login/login_utils.h" |
| 120 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 121 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" | 129 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" |
| 122 #else | 130 #else |
| 123 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 131 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 600 #endif | 608 #endif |
| 601 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = | 609 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = |
| 602 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; | 610 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; |
| 603 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 611 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
| 604 startup_pref_type == SessionStartupPref::LAST) { | 612 startup_pref_type == SessionStartupPref::LAST) { |
| 605 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 613 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
| 606 } | 614 } |
| 607 | 615 |
| 608 InitHostZoomMap(); | 616 InitHostZoomMap(); |
| 609 | 617 |
| 618 base::Callback<void(bool)> data_reduction_proxy_unavailable; | |
| 619 scoped_ptr<data_reduction_proxy::DataReductionProxyParams> | |
| 620 data_reduction_proxy_params; | |
| 621 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 622 InitDataReductionProxyForIO(&data_reduction_proxy_params, | |
| 623 &data_reduction_proxy_unavailable); | |
|
willchan no longer on Chromium
2014/07/31 22:31:35
indentation off
bengr
2014/08/02 01:10:31
Done.
| |
| 624 #endif | |
| 625 | |
| 610 // Make sure we initialize the ProfileIOData after everything else has been | 626 // Make sure we initialize the ProfileIOData after everything else has been |
| 611 // initialized that we might be reading from the IO thread. | 627 // initialized that we might be reading from the IO thread. |
| 612 | 628 |
| 613 io_data_.Init(cookie_path, channel_id_path, cache_path, | 629 io_data_.Init(cookie_path, channel_id_path, cache_path, |
| 614 cache_max_size, media_cache_path, media_cache_max_size, | 630 cache_max_size, media_cache_path, media_cache_max_size, |
| 615 extensions_cookie_path, GetPath(), infinite_cache_path, | 631 extensions_cookie_path, GetPath(), infinite_cache_path, |
| 616 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), | 632 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
| 617 CreateDomainReliabilityMonitor()); | 633 CreateDomainReliabilityMonitor(), |
| 634 data_reduction_proxy_unavailable, | |
| 635 data_reduction_proxy_params.Pass()); | |
| 636 | |
| 637 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 638 InitDataReductionProxySettings(); | |
| 639 #endif | |
| 618 | 640 |
| 619 #if defined(ENABLE_PLUGINS) | 641 #if defined(ENABLE_PLUGINS) |
| 620 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 642 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 621 PluginPrefs::GetForProfile(this).get(), | 643 PluginPrefs::GetForProfile(this).get(), |
| 622 io_data_.GetResourceContextNoInit()); | 644 io_data_.GetResourceContextNoInit()); |
| 623 #endif | 645 #endif |
| 624 | 646 |
| 625 // Delay README creation to not impact startup performance. | 647 // Delay README creation to not impact startup performance. |
| 626 BrowserThread::PostDelayedTask( | 648 BrowserThread::PostDelayedTask( |
| 627 BrowserThread::FILE, FROM_HERE, | 649 BrowserThread::FILE, FROM_HERE, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 709 for (std::vector<std::string>::const_iterator it = keys_to_remove.begin(); | 731 for (std::vector<std::string>::const_iterator it = keys_to_remove.begin(); |
| 710 it != keys_to_remove.end(); ++it) { | 732 it != keys_to_remove.end(); ++it) { |
| 711 host_zoom_dictionary->RemoveWithoutPathExpansion(*it, NULL); | 733 host_zoom_dictionary->RemoveWithoutPathExpansion(*it, NULL); |
| 712 } | 734 } |
| 713 } | 735 } |
| 714 | 736 |
| 715 zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback( | 737 zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback( |
| 716 base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this))); | 738 base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this))); |
| 717 } | 739 } |
| 718 | 740 |
| 741 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 742 void ProfileImpl::InitDataReductionProxyForIO( | |
|
willchan no longer on Chromium
2014/07/31 22:31:34
There's no reason for this to be a member function
marq (ping after 24h)
2014/07/31 23:54:32
Nit: This doesn't actually initialize the data red
bengr
2014/08/02 01:10:31
Done.
bengr
2014/08/02 01:10:31
Done.
| |
| 743 scoped_ptr<data_reduction_proxy::DataReductionProxyParams>* params, | |
| 744 base::Callback<void(bool)>* unavailable_callback) { | |
| 745 DataReductionProxyChromeSettings* data_reduction_proxy_chrome_settings = | |
| 746 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); | |
| 747 DCHECK(params); | |
| 748 params->reset(data_reduction_proxy_chrome_settings->params()->Clone()); | |
|
marq (ping after 24h)
2014/07/31 23:54:32
Params is cloned so there's a copy for the IO thre
bengr
2014/08/02 01:10:31
The issue is lifetime. The profile's IO data outli
| |
| 749 *unavailable_callback = | |
| 750 base::Bind( | |
| 751 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, | |
| 752 base::Unretained(data_reduction_proxy_chrome_settings)); | |
| 753 } | |
| 754 | |
| 755 void ProfileImpl::InitDataReductionProxySettings() { | |
|
willchan no longer on Chromium
2014/07/31 22:31:34
Ditto, this doesn't need to be a member function.
bengr
2014/08/02 01:10:32
Done.
| |
| 756 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigurator> | |
| 757 configurator(new DataReductionProxyChromeConfigurator(prefs_.get())); | |
| 758 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this)-> | |
|
marq (ping after 24h)
2014/07/31 23:54:32
Right, so this will use the params created in Data
bengr
2014/08/02 01:10:31
The global params are for the system context.
| |
| 759 InitDataReductionProxySettings(configurator.Pass(), | |
| 760 prefs_.get(), | |
| 761 g_browser_process->local_state(), | |
| 762 GetRequestContext()); | |
| 763 } | |
| 764 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 765 | |
| 719 base::FilePath ProfileImpl::last_selected_directory() { | 766 base::FilePath ProfileImpl::last_selected_directory() { |
| 720 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 767 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
| 721 } | 768 } |
| 722 | 769 |
| 723 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { | 770 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { |
| 724 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 771 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
| 725 } | 772 } |
| 726 | 773 |
| 727 ProfileImpl::~ProfileImpl() { | 774 ProfileImpl::~ProfileImpl() { |
| 728 MaybeSendDestroyedNotification(); | 775 MaybeSendDestroyedNotification(); |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1340 ProfileImpl::CreateDomainReliabilityMonitor() { | 1387 ProfileImpl::CreateDomainReliabilityMonitor() { |
| 1341 domain_reliability::DomainReliabilityService* service = | 1388 domain_reliability::DomainReliabilityService* service = |
| 1342 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1389 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1343 GetForBrowserContext(this); | 1390 GetForBrowserContext(this); |
| 1344 if (!service) | 1391 if (!service) |
| 1345 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1392 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1346 | 1393 |
| 1347 return service->CreateMonitor( | 1394 return service->CreateMonitor( |
| 1348 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1395 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1349 } | 1396 } |
| OLD | NEW |