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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 using content::UserMetricsAction; | 124 using content::UserMetricsAction; |
125 | 125 |
126 namespace { | 126 namespace { |
127 | 127 |
128 // Constrict us to a very specific platform and architecture to make sure | 128 // Constrict us to a very specific platform and architecture to make sure |
129 // ifdefs don't cause problems with the check. | 129 // ifdefs don't cause problems with the check. |
130 #if defined(OS_LINUX) && defined(TOOLKIT_GTK) && defined(ARCH_CPU_X86_64) && \ | 130 #if defined(OS_LINUX) && defined(TOOLKIT_GTK) && defined(ARCH_CPU_X86_64) && \ |
131 !defined(_GLIBCXX_DEBUG) | 131 !defined(_GLIBCXX_DEBUG) |
132 // Make sure that the ProfileImpl doesn't grow. We're currently trying to drive | 132 // Make sure that the ProfileImpl doesn't grow. We're currently trying to drive |
133 // the number of services that are included in ProfileImpl (instead of using | 133 // the number of services that are included in ProfileImpl (instead of using |
134 // ProfileKeyedServiceFactory) to zero. | 134 // BrowserContextKeyedServiceFactory) to zero. |
135 // | 135 // |
136 // If you don't know about this effort, please read: | 136 // If you don't know about this effort, please read: |
137 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/pro
file-architecture | 137 // https://sites.google.com/a/chromium.org/dev/developers/design-documents/pro
file-architecture |
138 // | 138 // |
139 // REVIEWERS: Do not let anyone increment this. We need to drive the number of | 139 // REVIEWERS: Do not let anyone increment this. We need to drive the number of |
140 // raw accessed services down to zero. DO NOT LET PEOPLE REGRESS THIS UNLESS | 140 // raw accessed services down to zero. DO NOT LET PEOPLE REGRESS THIS UNLESS |
141 // THE PATCH ITSELF IS MAKING PROGRESS ON PKSF REFACTORING. | 141 // THE PATCH ITSELF IS MAKING PROGRESS ON PKSF REFACTORING. |
142 COMPILE_ASSERT(sizeof(ProfileImpl) <= 744u, profile_impl_size_unexpected); | 142 COMPILE_ASSERT(sizeof(ProfileImpl) <= 744u, profile_impl_size_unexpected); |
143 #endif | 143 #endif |
144 | 144 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 | 622 |
623 // Destroy OTR profile and its profile services first. | 623 // Destroy OTR profile and its profile services first. |
624 if (off_the_record_profile_) { | 624 if (off_the_record_profile_) { |
625 ProfileDestroyer::DestroyOffTheRecordProfileNow( | 625 ProfileDestroyer::DestroyOffTheRecordProfileNow( |
626 off_the_record_profile_.get()); | 626 off_the_record_profile_.get()); |
627 } else { | 627 } else { |
628 ExtensionPrefValueMapFactory::GetForProfile(this)-> | 628 ExtensionPrefValueMapFactory::GetForProfile(this)-> |
629 ClearAllIncognitoSessionOnlyPreferences(); | 629 ClearAllIncognitoSessionOnlyPreferences(); |
630 } | 630 } |
631 | 631 |
632 ProfileDependencyManager::GetInstance()->DestroyProfileServices(this); | 632 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( |
| 633 this); |
633 | 634 |
634 if (top_sites_) | 635 if (top_sites_) |
635 top_sites_->Shutdown(); | 636 top_sites_->Shutdown(); |
636 | 637 |
637 if (pref_proxy_config_tracker_) | 638 if (pref_proxy_config_tracker_) |
638 pref_proxy_config_tracker_->DetachFromPrefService(); | 639 pref_proxy_config_tracker_->DetachFromPrefService(); |
639 | 640 |
640 if (host_content_settings_map_) | 641 if (host_content_settings_map_) |
641 host_content_settings_map_->ShutdownOnUIThread(); | 642 host_content_settings_map_->ShutdownOnUIThread(); |
642 | 643 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 } else { | 727 } else { |
727 last_session_exit_type_ = | 728 last_session_exit_type_ = |
728 SessionTypePrefValueToExitType(exit_type_pref_value); | 729 SessionTypePrefValueToExitType(exit_type_pref_value); |
729 } | 730 } |
730 // Mark the session as open. | 731 // Mark the session as open. |
731 prefs_->SetString(prefs::kSessionExitType, kPrefExitTypeCrashed); | 732 prefs_->SetString(prefs::kSessionExitType, kPrefExitTypeCrashed); |
732 // Force this to true in case we fallback and use it. | 733 // Force this to true in case we fallback and use it. |
733 // TODO(sky): remove this in a couple of releases (m28ish). | 734 // TODO(sky): remove this in a couple of releases (m28ish). |
734 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); | 735 prefs_->SetBoolean(prefs::kSessionExitedCleanly, true); |
735 | 736 |
736 ProfileDependencyManager::GetInstance()->CreateProfileServices(this, false); | 737 BrowserContextDependencyManager::GetInstance()->CreateBrowserContextServices( |
| 738 this, false); |
737 | 739 |
738 DCHECK(!net_pref_observer_); | 740 DCHECK(!net_pref_observer_); |
739 net_pref_observer_.reset(new NetPrefObserver( | 741 net_pref_observer_.reset(new NetPrefObserver( |
740 prefs_.get(), | 742 prefs_.get(), |
741 prerender::PrerenderManagerFactory::GetForProfile(this), | 743 prerender::PrerenderManagerFactory::GetForProfile(this), |
742 predictor_)); | 744 predictor_)); |
743 | 745 |
744 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile()); | 746 ChromeVersionService::OnProfileLoaded(prefs_.get(), IsNewProfile()); |
745 DoFinalInit(); | 747 DoFinalInit(); |
746 } | 748 } |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 ProfileImpl::CreateRequestContextForStoragePartition( | 856 ProfileImpl::CreateRequestContextForStoragePartition( |
855 const base::FilePath& partition_path, | 857 const base::FilePath& partition_path, |
856 bool in_memory, | 858 bool in_memory, |
857 content::ProtocolHandlerMap* protocol_handlers) { | 859 content::ProtocolHandlerMap* protocol_handlers) { |
858 return io_data_.CreateIsolatedAppRequestContextGetter( | 860 return io_data_.CreateIsolatedAppRequestContextGetter( |
859 partition_path, in_memory, protocol_handlers); | 861 partition_path, in_memory, protocol_handlers); |
860 } | 862 } |
861 | 863 |
862 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 864 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
863 // If ssl_config_service_manager_ is null, this typically means that some | 865 // If ssl_config_service_manager_ is null, this typically means that some |
864 // ProfileKeyedService is trying to create a RequestContext at startup, but | 866 // BrowserContextKeyedService is trying to create a RequestContext at startup, |
865 // SSLConfigServiceManager is not initialized until DoFinalInit() which is | 867 // but SSLConfigServiceManager is not initialized until DoFinalInit() which is |
866 // invoked after all ProfileKeyedServices have been initialized (see | 868 // invoked after all BrowserContextKeyedServices have been initialized (see |
867 // http://crbug.com/171406). | 869 // http://crbug.com/171406). |
868 DCHECK(ssl_config_service_manager_) << | 870 DCHECK(ssl_config_service_manager_) << |
869 "SSLConfigServiceManager is not initialized yet"; | 871 "SSLConfigServiceManager is not initialized yet"; |
870 return ssl_config_service_manager_->Get(); | 872 return ssl_config_service_manager_->Get(); |
871 } | 873 } |
872 | 874 |
873 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 875 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
874 if (!host_content_settings_map_) { | 876 if (!host_content_settings_map_) { |
875 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 877 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
876 } | 878 } |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 base::FilePath* cache_path, | 1137 base::FilePath* cache_path, |
1136 int* max_size) { | 1138 int* max_size) { |
1137 DCHECK(cache_path); | 1139 DCHECK(cache_path); |
1138 DCHECK(max_size); | 1140 DCHECK(max_size); |
1139 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1141 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1140 if (!path.empty()) | 1142 if (!path.empty()) |
1141 *cache_path = path; | 1143 *cache_path = path; |
1142 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1144 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1143 prefs_->GetInteger(prefs::kDiskCacheSize); | 1145 prefs_->GetInteger(prefs::kDiskCacheSize); |
1144 } | 1146 } |
OLD | NEW |