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 30 matching lines...) Expand all Loading... | |
| 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/extensions/extension_service.h" | 43 #include "chrome/browser/extensions/extension_service.h" |
| 44 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 44 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 45 #include "chrome/browser/history/top_sites.h" | 45 #include "chrome/browser/history/top_sites.h" |
| 46 #include "chrome/browser/net/chrome_url_request_context.h" | 46 #include "chrome/browser/net/chrome_url_request_context.h" |
| 47 #include "chrome/browser/net/net_pref_observer.h" | 47 #include "chrome/browser/net/net_pref_observer.h" |
| 48 #include "chrome/browser/net/predictor.h" | 48 #include "chrome/browser/net/predictor.h" |
| 49 #include "chrome/browser/net/pref_proxy_config_tracker.h" | 49 #include "chrome/browser/net/pref_proxy_config_tracker.h" |
| 50 #include "chrome/browser/net/proxy_service_factory.h" | 50 #include "chrome/browser/net/proxy_service_factory.h" |
| 51 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | |
| 51 #include "chrome/browser/net/ssl_config_service_manager.h" | 52 #include "chrome/browser/net/ssl_config_service_manager.h" |
| 52 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" | 53 #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
| 53 #include "chrome/browser/plugins/plugin_prefs.h" | 54 #include "chrome/browser/plugins/plugin_prefs.h" |
| 54 #include "chrome/browser/policy/profile_policy_connector.h" | 55 #include "chrome/browser/policy/profile_policy_connector.h" |
| 55 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 56 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 56 #include "chrome/browser/prefs/browser_prefs.h" | 57 #include "chrome/browser/prefs/browser_prefs.h" |
| 57 #include "chrome/browser/prefs/chrome_pref_service_factory.h" | 58 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
| 58 #include "chrome/browser/prefs/pref_service_syncable.h" | 59 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 59 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" | 60 #include "chrome/browser/prefs/tracked/tracked_preference_validation_delegate.h" |
| 60 #include "chrome/browser/prerender/prerender_manager_factory.h" | 61 #include "chrome/browser/prerender/prerender_manager_factory.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" | 112 #include "chrome/browser/media/protected_media_identifier_permission_context_fac tory.h" |
| 112 #endif | 113 #endif |
| 113 | 114 |
| 114 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
| 115 #include "chrome/browser/chromeos/locale_change_guard.h" | 116 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 116 #include "chrome/browser/chromeos/login/users/user_manager.h" | 117 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 117 #include "chrome/browser/chromeos/preferences.h" | 118 #include "chrome/browser/chromeos/preferences.h" |
| 118 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 119 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 119 #endif | 120 #endif |
| 120 | 121 |
| 122 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 123 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | |
| 124 #include "components/data_reduction_proxy/browser/data_reduction_proxy_settings. h" | |
| 125 #endif | |
| 126 | |
| 121 #if defined(ENABLE_CONFIGURATION_POLICY) | 127 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 122 #include "chrome/browser/policy/schema_registry_service.h" | 128 #include "chrome/browser/policy/schema_registry_service.h" |
| 123 #include "chrome/browser/policy/schema_registry_service_factory.h" | 129 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 124 #include "components/policy/core/browser/browser_policy_connector.h" | 130 #include "components/policy/core/browser/browser_policy_connector.h" |
| 125 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
| 126 #include "chrome/browser/chromeos/login/login_utils.h" | 132 #include "chrome/browser/chromeos/login/login_utils.h" |
| 127 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 133 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 128 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" | 134 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" |
| 129 #else | 135 #else |
| 130 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 136 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 Delegate* delegate, | 382 Delegate* delegate, |
| 377 CreateMode create_mode, | 383 CreateMode create_mode, |
| 378 base::SequencedTaskRunner* sequenced_task_runner) | 384 base::SequencedTaskRunner* sequenced_task_runner) |
| 379 : path_(path), | 385 : path_(path), |
| 380 pref_registry_(new user_prefs::PrefRegistrySyncable), | 386 pref_registry_(new user_prefs::PrefRegistrySyncable), |
| 381 io_data_(this), | 387 io_data_(this), |
| 382 host_content_settings_map_(NULL), | 388 host_content_settings_map_(NULL), |
| 383 last_session_exit_type_(EXIT_NORMAL), | 389 last_session_exit_type_(EXIT_NORMAL), |
| 384 start_time_(Time::Now()), | 390 start_time_(Time::Now()), |
| 385 delegate_(delegate), | 391 delegate_(delegate), |
| 386 predictor_(NULL) { | 392 predictor_(NULL), |
| 393 data_reduction_proxy_chrome_settings_(NULL) { | |
| 387 TRACE_EVENT0("browser", "ProfileImpl::ctor") | 394 TRACE_EVENT0("browser", "ProfileImpl::ctor") |
| 388 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << | 395 DCHECK(!path.empty()) << "Using an empty path will attempt to write " << |
| 389 "profile files to the root directory!"; | 396 "profile files to the root directory!"; |
| 390 | 397 |
| 391 #if defined(ENABLE_SESSION_SERVICE) | 398 #if defined(ENABLE_SESSION_SERVICE) |
| 392 create_session_service_timer_.Start(FROM_HERE, | 399 create_session_service_timer_.Start(FROM_HERE, |
| 393 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, | 400 TimeDelta::FromMilliseconds(kCreateSessionServiceDelayMS), this, |
| 394 &ProfileImpl::EnsureSessionServiceCreated); | 401 &ProfileImpl::EnsureSessionServiceCreated); |
| 395 #endif | 402 #endif |
| 396 | 403 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 591 #endif | 598 #endif |
| 592 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = | 599 content::CookieStoreConfig::SessionCookieMode session_cookie_mode = |
| 593 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; | 600 content::CookieStoreConfig::PERSISTANT_SESSION_COOKIES; |
| 594 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || | 601 if (GetLastSessionExitType() == Profile::EXIT_CRASHED || |
| 595 startup_pref_type == SessionStartupPref::LAST) { | 602 startup_pref_type == SessionStartupPref::LAST) { |
| 596 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; | 603 session_cookie_mode = content::CookieStoreConfig::RESTORED_SESSION_COOKIES; |
| 597 } | 604 } |
| 598 | 605 |
| 599 InitHostZoomMap(); | 606 InitHostZoomMap(); |
| 600 | 607 |
| 608 base::Callback<void(bool)> data_reduction_proxy_unavailable; | |
| 609 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 610 InitDataReductionProxy(&data_reduction_proxy_unavailable); | |
| 611 #endif | |
| 612 | |
| 601 // Make sure we initialize the ProfileIOData after everything else has been | 613 // Make sure we initialize the ProfileIOData after everything else has been |
| 602 // initialized that we might be reading from the IO thread. | 614 // initialized that we might be reading from the IO thread. |
| 603 | 615 |
| 604 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 616 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
| 605 cache_max_size, media_cache_path, media_cache_max_size, | 617 cache_max_size, media_cache_path, media_cache_max_size, |
| 606 extensions_cookie_path, GetPath(), infinite_cache_path, | 618 extensions_cookie_path, GetPath(), infinite_cache_path, |
| 607 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), | 619 predictor_, session_cookie_mode, GetSpecialStoragePolicy(), |
| 608 CreateDomainReliabilityMonitor()); | 620 CreateDomainReliabilityMonitor(), |
| 621 data_reduction_proxy_unavailable); | |
| 609 | 622 |
| 610 #if defined(ENABLE_PLUGINS) | 623 #if defined(ENABLE_PLUGINS) |
| 611 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 624 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 612 PluginPrefs::GetForProfile(this).get(), | 625 PluginPrefs::GetForProfile(this).get(), |
| 613 io_data_.GetResourceContextNoInit()); | 626 io_data_.GetResourceContextNoInit()); |
| 614 #endif | 627 #endif |
| 615 | 628 |
| 616 // Delay README creation to not impact startup performance. | 629 // Delay README creation to not impact startup performance. |
| 617 BrowserThread::PostDelayedTask( | 630 BrowserThread::PostDelayedTask( |
| 618 BrowserThread::FILE, FROM_HERE, | 631 BrowserThread::FILE, FROM_HERE, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 for (std::vector<std::string>::const_iterator it = keys_to_remove.begin(); | 713 for (std::vector<std::string>::const_iterator it = keys_to_remove.begin(); |
| 701 it != keys_to_remove.end(); ++it) { | 714 it != keys_to_remove.end(); ++it) { |
| 702 host_zoom_dictionary->RemoveWithoutPathExpansion(*it, NULL); | 715 host_zoom_dictionary->RemoveWithoutPathExpansion(*it, NULL); |
| 703 } | 716 } |
| 704 } | 717 } |
| 705 | 718 |
| 706 zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback( | 719 zoom_subscription_ = host_zoom_map->AddZoomLevelChangedCallback( |
| 707 base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this))); | 720 base::Bind(&ProfileImpl::OnZoomLevelChanged, base::Unretained(this))); |
| 708 } | 721 } |
| 709 | 722 |
| 723 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 724 void ProfileImpl::InitDataReductionProxy( | |
| 725 base::Callback<void(bool)>* unavailable_callback) { | |
| 726 data_reduction_proxy_chrome_settings_ = | |
| 727 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(this); | |
| 728 | |
| 729 DCHECK(unavailable_callback); | |
|
willchan no longer on Chromium
2014/07/28 15:45:23
Don't bother with the DCHECK, since the next line
bengr
2014/07/28 20:29:04
Done.
| |
| 730 *unavailable_callback = | |
| 731 base::Bind( | |
| 732 &data_reduction_proxy::DataReductionProxySettings::SetUnreachable, | |
| 733 base::Unretained(data_reduction_proxy_chrome_settings_)); | |
| 734 // Post to prevent a Profile initialization loop. | |
|
willchan no longer on Chromium
2014/07/28 15:45:23
I don't understand this comment. What's the loop?
bengr
2014/07/28 20:29:04
The comment needs to change. Before changing to pa
willchan no longer on Chromium
2014/07/29 00:26:56
Can you paste the error?
willchan no longer on Chromium
2014/07/31 22:31:34
Ben and I chatted about this offline. The problem
| |
| 735 BrowserThread::PostTask( | |
| 736 BrowserThread::UI, FROM_HERE, | |
| 737 base::Bind(&ProfileImpl::RunInitDataReductionProxyTask, | |
| 738 base::Unretained(this))); | |
| 739 } | |
| 740 | |
| 741 void ProfileImpl::RunInitDataReductionProxyTask() { | |
| 742 data_reduction_proxy_chrome_settings_->InitDataReductionProxySettings(this); | |
| 743 } | |
| 744 #endif // defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 745 | |
| 710 base::FilePath ProfileImpl::last_selected_directory() { | 746 base::FilePath ProfileImpl::last_selected_directory() { |
| 711 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); | 747 return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory); |
| 712 } | 748 } |
| 713 | 749 |
| 714 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { | 750 void ProfileImpl::set_last_selected_directory(const base::FilePath& path) { |
| 715 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); | 751 GetPrefs()->SetFilePath(prefs::kSelectFileLastDirectory, path); |
| 716 } | 752 } |
| 717 | 753 |
| 718 ProfileImpl::~ProfileImpl() { | 754 ProfileImpl::~ProfileImpl() { |
| 719 MaybeSendDestroyedNotification(); | 755 MaybeSendDestroyedNotification(); |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1320 ProfileImpl::CreateDomainReliabilityMonitor() { | 1356 ProfileImpl::CreateDomainReliabilityMonitor() { |
| 1321 domain_reliability::DomainReliabilityService* service = | 1357 domain_reliability::DomainReliabilityService* service = |
| 1322 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1358 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1323 GetForBrowserContext(this); | 1359 GetForBrowserContext(this); |
| 1324 if (!service) | 1360 if (!service) |
| 1325 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1361 return scoped_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1326 | 1362 |
| 1327 return service->CreateMonitor( | 1363 return service->CreateMonitor( |
| 1328 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1364 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); |
| 1329 } | 1365 } |
| OLD | NEW |