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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
538 | 538 |
539 InitHostZoomMap(); | 539 InitHostZoomMap(); |
540 | 540 |
541 // Make sure we initialize the ProfileIOData after everything else has been | 541 // Make sure we initialize the ProfileIOData after everything else has been |
542 // initialized that we might be reading from the IO thread. | 542 // initialized that we might be reading from the IO thread. |
543 | 543 |
544 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 544 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
545 cache_max_size, media_cache_path, media_cache_max_size, | 545 cache_max_size, media_cache_path, media_cache_max_size, |
546 extensions_cookie_path, GetPath(), infinite_cache_path, | 546 extensions_cookie_path, GetPath(), infinite_cache_path, |
547 predictor_, | 547 predictor_, |
548 g_browser_process->local_state(), | |
549 g_browser_process->io_thread(), | |
550 restore_old_session_cookies, | 548 restore_old_session_cookies, |
551 GetSpecialStoragePolicy()); | 549 GetSpecialStoragePolicy()); |
552 | 550 |
553 #if defined(ENABLE_PLUGINS) | 551 #if defined(ENABLE_PLUGINS) |
554 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 552 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
555 PluginPrefs::GetForProfile(this), | 553 PluginPrefs::GetForProfile(this), |
556 io_data_.GetResourceContextNoInit()); | 554 io_data_.GetResourceContextNoInit()); |
557 #endif | 555 #endif |
558 | 556 |
559 // Delay README creation to not impact startup performance. | 557 // Delay README creation to not impact startup performance. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 } | 822 } |
825 return otr_prefs_.get(); | 823 return otr_prefs_.get(); |
826 } | 824 } |
827 | 825 |
828 FilePath ProfileImpl::GetPrefFilePath() { | 826 FilePath ProfileImpl::GetPrefFilePath() { |
829 FilePath pref_file_path = path_; | 827 FilePath pref_file_path = path_; |
830 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 828 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
831 return pref_file_path; | 829 return pref_file_path; |
832 } | 830 } |
833 | 831 |
832 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( | |
833 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
834 blob_protocol_handler, | |
835 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
836 file_system_protocol_handler, | |
837 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
838 developer_protocol_handler, | |
839 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
840 chrome_protocol_handler, | |
841 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
842 chrome_devtools_protocol_handler) { | |
843 return io_data_.CreateMainRequestContextGetter( | |
844 blob_protocol_handler.Pass(), | |
845 file_system_protocol_handler.Pass(), | |
846 developer_protocol_handler.Pass(), | |
847 chrome_protocol_handler.Pass(), | |
848 chrome_devtools_protocol_handler.Pass(), | |
849 g_browser_process->local_state(), | |
850 g_browser_process->io_thread()); | |
851 } | |
852 | |
834 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 853 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
835 return io_data_.GetMainRequestContextGetter(); | 854 content::StoragePartition* storage_partition = |
855 BrowserContext::GetStoragePartition(this, NULL); | |
awong
2013/02/02 03:26:12
GetDefaultStoragePartition()
| |
856 return storage_partition->GetURLRequestContext(); | |
836 } | 857 } |
837 | 858 |
838 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 859 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
839 int renderer_child_id) { | 860 int renderer_child_id) { |
840 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 861 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
841 renderer_child_id); | 862 renderer_child_id); |
842 | 863 |
843 return rph->GetStoragePartition()->GetURLRequestContext(); | 864 return rph->GetStoragePartition()->GetURLRequestContext(); |
844 } | 865 } |
845 | 866 |
(...skipping 21 matching lines...) Expand all Loading... | |
867 } | 888 } |
868 | 889 |
869 content::ResourceContext* ProfileImpl::GetResourceContext() { | 890 content::ResourceContext* ProfileImpl::GetResourceContext() { |
870 return io_data_.GetResourceContext(); | 891 return io_data_.GetResourceContext(); |
871 } | 892 } |
872 | 893 |
873 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 894 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
874 return io_data_.GetExtensionsRequestContextGetter(); | 895 return io_data_.GetExtensionsRequestContextGetter(); |
875 } | 896 } |
876 | 897 |
877 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 898 net::URLRequestContextGetter* |
899 ProfileImpl::CreateRequestContextForStoragePartition( | |
878 const FilePath& partition_path, | 900 const FilePath& partition_path, |
879 bool in_memory) { | 901 bool in_memory, |
880 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 902 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
903 blob_protocol_handler, | |
904 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
905 file_system_protocol_handler, | |
906 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
907 developer_protocol_handler, | |
908 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
909 chrome_protocol_handler, | |
910 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
911 chrome_devtools_protocol_handler) { | |
912 return io_data_.CreateIsolatedAppRequestContextGetter( | |
913 partition_path, in_memory, blob_protocol_handler.Pass(), | |
914 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), | |
915 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); | |
881 } | 916 } |
882 | 917 |
883 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 918 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
884 return ssl_config_service_manager_->Get(); | 919 return ssl_config_service_manager_->Get(); |
885 } | 920 } |
886 | 921 |
887 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 922 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
888 if (!host_content_settings_map_.get()) { | 923 if (!host_content_settings_map_.get()) { |
889 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 924 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
890 } | 925 } |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1166 FilePath* cache_path, | 1201 FilePath* cache_path, |
1167 int* max_size) { | 1202 int* max_size) { |
1168 DCHECK(cache_path); | 1203 DCHECK(cache_path); |
1169 DCHECK(max_size); | 1204 DCHECK(max_size); |
1170 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1205 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1171 if (!path.empty()) | 1206 if (!path.empty()) |
1172 *cache_path = path; | 1207 *cache_path = path; |
1173 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1208 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1174 prefs_->GetInteger(prefs::kDiskCacheSize); | 1209 prefs_->GetInteger(prefs::kDiskCacheSize); |
1175 } | 1210 } |
OLD | NEW |