| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 #include "components/zoom/zoom_event_manager.h" | 107 #include "components/zoom/zoom_event_manager.h" |
| 108 #include "content/public/browser/browser_thread.h" | 108 #include "content/public/browser/browser_thread.h" |
| 109 #include "content/public/browser/dom_storage_context.h" | 109 #include "content/public/browser/dom_storage_context.h" |
| 110 #include "content/public/browser/notification_service.h" | 110 #include "content/public/browser/notification_service.h" |
| 111 #include "content/public/browser/render_process_host.h" | 111 #include "content/public/browser/render_process_host.h" |
| 112 #include "content/public/browser/storage_partition.h" | 112 #include "content/public/browser/storage_partition.h" |
| 113 #include "content/public/browser/url_data_source.h" | 113 #include "content/public/browser/url_data_source.h" |
| 114 #include "content/public/browser/user_metrics.h" | 114 #include "content/public/browser/user_metrics.h" |
| 115 #include "content/public/common/content_constants.h" | 115 #include "content/public/common/content_constants.h" |
| 116 #include "content/public/common/page_zoom.h" | 116 #include "content/public/common/page_zoom.h" |
| 117 #include "extensions/features/features.h" |
| 117 #include "printing/features/features.h" | 118 #include "printing/features/features.h" |
| 118 #include "ui/base/l10n/l10n_util.h" | 119 #include "ui/base/l10n/l10n_util.h" |
| 119 | 120 |
| 120 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
| 121 #include "chrome/browser/chromeos/locale_change_guard.h" | 122 #include "chrome/browser/chromeos/locale_change_guard.h" |
| 122 #include "chrome/browser/chromeos/preferences.h" | 123 #include "chrome/browser/chromeos/preferences.h" |
| 123 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 124 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 124 #include "components/user_manager/user_manager.h" | 125 #include "components/user_manager/user_manager.h" |
| 125 #endif | 126 #endif |
| 126 | 127 |
| 127 #if BUILDFLAG(ENABLE_BACKGROUND) | 128 #if BUILDFLAG(ENABLE_BACKGROUND) |
| 128 #include "chrome/browser/background/background_mode_manager.h" | 129 #include "chrome/browser/background/background_mode_manager.h" |
| 129 #endif | 130 #endif |
| 130 | 131 |
| 131 #if defined(OS_CHROMEOS) | 132 #if defined(OS_CHROMEOS) |
| 132 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 133 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 133 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 134 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 134 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 135 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 135 #else | 136 #else |
| 136 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 137 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 137 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 138 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
| 138 #endif | 139 #endif |
| 139 | 140 |
| 140 #if defined(ENABLE_EXTENSIONS) | 141 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 141 #include "chrome/browser/extensions/extension_service.h" | 142 #include "chrome/browser/extensions/extension_service.h" |
| 142 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 143 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 143 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 144 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 144 #include "components/guest_view/browser/guest_view_manager.h" | 145 #include "components/guest_view/browser/guest_view_manager.h" |
| 145 #include "extensions/browser/extension_pref_store.h" | 146 #include "extensions/browser/extension_pref_store.h" |
| 146 #include "extensions/browser/extension_pref_value_map.h" | 147 #include "extensions/browser/extension_pref_value_map.h" |
| 147 #include "extensions/browser/extension_pref_value_map_factory.h" | 148 #include "extensions/browser/extension_pref_value_map_factory.h" |
| 148 #include "extensions/browser/extension_system.h" | 149 #include "extensions/browser/extension_system.h" |
| 149 #endif | 150 #endif |
| 150 | 151 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 return kPrefExitTypeSessionEnded; | 265 return kPrefExitTypeSessionEnded; |
| 265 case Profile::EXIT_CRASHED: | 266 case Profile::EXIT_CRASHED: |
| 266 return kPrefExitTypeCrashed; | 267 return kPrefExitTypeCrashed; |
| 267 } | 268 } |
| 268 NOTREACHED(); | 269 NOTREACHED(); |
| 269 return std::string(); | 270 return std::string(); |
| 270 } | 271 } |
| 271 | 272 |
| 272 PrefStore* CreateExtensionPrefStore(Profile* profile, | 273 PrefStore* CreateExtensionPrefStore(Profile* profile, |
| 273 bool incognito_pref_store) { | 274 bool incognito_pref_store) { |
| 274 #if defined(ENABLE_EXTENSIONS) | 275 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 275 return new ExtensionPrefStore( | 276 return new ExtensionPrefStore( |
| 276 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), | 277 ExtensionPrefValueMapFactory::GetForBrowserContext(profile), |
| 277 incognito_pref_store); | 278 incognito_pref_store); |
| 278 #else | 279 #else |
| 279 return NULL; | 280 return NULL; |
| 280 #endif | 281 #endif |
| 281 } | 282 } |
| 282 | 283 |
| 283 } // namespace | 284 } // namespace |
| 284 | 285 |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 #if defined(ENABLE_PLUGINS) | 691 #if defined(ENABLE_PLUGINS) |
| 691 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( | 692 ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( |
| 692 io_data_.GetResourceContextNoInit()); | 693 io_data_.GetResourceContextNoInit()); |
| 693 #endif | 694 #endif |
| 694 | 695 |
| 695 // Destroy OTR profile and its profile services first. | 696 // Destroy OTR profile and its profile services first. |
| 696 if (off_the_record_profile_) { | 697 if (off_the_record_profile_) { |
| 697 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 698 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
| 698 off_the_record_profile_.get()); | 699 off_the_record_profile_.get()); |
| 699 } else { | 700 } else { |
| 700 #if defined(ENABLE_EXTENSIONS) | 701 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 701 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> | 702 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> |
| 702 ClearAllIncognitoSessionOnlyPreferences(); | 703 ClearAllIncognitoSessionOnlyPreferences(); |
| 703 #endif | 704 #endif |
| 704 } | 705 } |
| 705 | 706 |
| 706 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( | 707 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
| 707 this); | 708 this); |
| 708 | 709 |
| 709 if (pref_proxy_config_tracker_) | 710 if (pref_proxy_config_tracker_) |
| 710 pref_proxy_config_tracker_->DetachFromPrefService(); | 711 pref_proxy_config_tracker_->DetachFromPrefService(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 chrome::NOTIFICATION_PROFILE_CREATED, | 761 chrome::NOTIFICATION_PROFILE_CREATED, |
| 761 content::Source<Profile>(off_the_record_profile_.get()), | 762 content::Source<Profile>(off_the_record_profile_.get()), |
| 762 content::NotificationService::NoDetails()); | 763 content::NotificationService::NoDetails()); |
| 763 } | 764 } |
| 764 return off_the_record_profile_.get(); | 765 return off_the_record_profile_.get(); |
| 765 } | 766 } |
| 766 | 767 |
| 767 void ProfileImpl::DestroyOffTheRecordProfile() { | 768 void ProfileImpl::DestroyOffTheRecordProfile() { |
| 768 off_the_record_profile_.reset(); | 769 off_the_record_profile_.reset(); |
| 769 otr_prefs_->ClearMutableValues(); | 770 otr_prefs_->ClearMutableValues(); |
| 770 #if defined(ENABLE_EXTENSIONS) | 771 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 771 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> | 772 ExtensionPrefValueMapFactory::GetForBrowserContext(this)-> |
| 772 ClearAllIncognitoSessionOnlyPreferences(); | 773 ClearAllIncognitoSessionOnlyPreferences(); |
| 773 #endif | 774 #endif |
| 774 } | 775 } |
| 775 | 776 |
| 776 bool ProfileImpl::HasOffTheRecordProfile() { | 777 bool ProfileImpl::HasOffTheRecordProfile() { |
| 777 return off_the_record_profile_.get() != NULL; | 778 return off_the_record_profile_.get() != NULL; |
| 778 } | 779 } |
| 779 | 780 |
| 780 Profile* ProfileImpl::GetOriginalProfile() { | 781 Profile* ProfileImpl::GetOriginalProfile() { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 793 return false; | 794 return false; |
| 794 #endif | 795 #endif |
| 795 } | 796 } |
| 796 | 797 |
| 797 bool ProfileImpl::IsLegacySupervised() const { | 798 bool ProfileImpl::IsLegacySupervised() const { |
| 798 return IsSupervised() && !IsChild(); | 799 return IsSupervised() && !IsChild(); |
| 799 } | 800 } |
| 800 | 801 |
| 801 ExtensionSpecialStoragePolicy* | 802 ExtensionSpecialStoragePolicy* |
| 802 ProfileImpl::GetExtensionSpecialStoragePolicy() { | 803 ProfileImpl::GetExtensionSpecialStoragePolicy() { |
| 803 #if defined(ENABLE_EXTENSIONS) | 804 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 804 if (!extension_special_storage_policy_.get()) { | 805 if (!extension_special_storage_policy_.get()) { |
| 805 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") | 806 TRACE_EVENT0("browser", "ProfileImpl::GetExtensionSpecialStoragePolicy") |
| 806 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( | 807 extension_special_storage_policy_ = new ExtensionSpecialStoragePolicy( |
| 807 CookieSettingsFactory::GetForProfile(this).get()); | 808 CookieSettingsFactory::GetForProfile(this).get()); |
| 808 } | 809 } |
| 809 return extension_special_storage_policy_.get(); | 810 return extension_special_storage_policy_.get(); |
| 810 #else | 811 #else |
| 811 return NULL; | 812 return NULL; |
| 812 #endif | 813 #endif |
| 813 } | 814 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 // KeyedService is trying to create a RequestContext at startup, | 947 // KeyedService is trying to create a RequestContext at startup, |
| 947 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is | 948 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is |
| 948 // invoked after all KeyedServices have been initialized (see | 949 // invoked after all KeyedServices have been initialized (see |
| 949 // http://crbug.com/171406). | 950 // http://crbug.com/171406). |
| 950 DCHECK(ssl_config_service_manager_) << | 951 DCHECK(ssl_config_service_manager_) << |
| 951 "SSLConfigServiceManager is not initialized yet"; | 952 "SSLConfigServiceManager is not initialized yet"; |
| 952 return ssl_config_service_manager_->Get(); | 953 return ssl_config_service_manager_->Get(); |
| 953 } | 954 } |
| 954 | 955 |
| 955 content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() { | 956 content::BrowserPluginGuestManager* ProfileImpl::GetGuestManager() { |
| 956 #if defined(ENABLE_EXTENSIONS) | 957 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 957 return guest_view::GuestViewManager::FromBrowserContext(this); | 958 return guest_view::GuestViewManager::FromBrowserContext(this); |
| 958 #else | 959 #else |
| 959 return NULL; | 960 return NULL; |
| 960 #endif | 961 #endif |
| 961 } | 962 } |
| 962 | 963 |
| 963 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { | 964 DownloadManagerDelegate* ProfileImpl::GetDownloadManagerDelegate() { |
| 964 return DownloadServiceFactory::GetForBrowserContext(this)-> | 965 return DownloadServiceFactory::GetForBrowserContext(this)-> |
| 965 GetDownloadManagerDelegate(); | 966 GetDownloadManagerDelegate(); |
| 966 } | 967 } |
| 967 | 968 |
| 968 storage::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { | 969 storage::SpecialStoragePolicy* ProfileImpl::GetSpecialStoragePolicy() { |
| 969 #if defined(ENABLE_EXTENSIONS) | 970 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 970 return GetExtensionSpecialStoragePolicy(); | 971 return GetExtensionSpecialStoragePolicy(); |
| 971 #else | 972 #else |
| 972 return NULL; | 973 return NULL; |
| 973 #endif | 974 #endif |
| 974 } | 975 } |
| 975 | 976 |
| 976 content::PushMessagingService* ProfileImpl::GetPushMessagingService() { | 977 content::PushMessagingService* ProfileImpl::GetPushMessagingService() { |
| 977 return PushMessagingServiceFactory::GetForProfile(this); | 978 return PushMessagingServiceFactory::GetForProfile(this); |
| 978 } | 979 } |
| 979 | 980 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1273 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { | 1274 ProfileImpl::CreateDomainReliabilityMonitor(PrefService* local_state) { |
| 1274 domain_reliability::DomainReliabilityService* service = | 1275 domain_reliability::DomainReliabilityService* service = |
| 1275 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> | 1276 domain_reliability::DomainReliabilityServiceFactory::GetInstance()-> |
| 1276 GetForBrowserContext(this); | 1277 GetForBrowserContext(this); |
| 1277 if (!service) | 1278 if (!service) |
| 1278 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); | 1279 return std::unique_ptr<domain_reliability::DomainReliabilityMonitor>(); |
| 1279 | 1280 |
| 1280 return service->CreateMonitor( | 1281 return service->CreateMonitor( |
| 1281 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); | 1282 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 1282 } | 1283 } |
| OLD | NEW |