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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 | 496 |
497 InitHostZoomMap(); | 497 InitHostZoomMap(); |
498 | 498 |
499 // Make sure we initialize the ProfileIOData after everything else has been | 499 // Make sure we initialize the ProfileIOData after everything else has been |
500 // initialized that we might be reading from the IO thread. | 500 // initialized that we might be reading from the IO thread. |
501 | 501 |
502 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 502 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
503 cache_max_size, media_cache_path, media_cache_max_size, | 503 cache_max_size, media_cache_path, media_cache_max_size, |
504 extensions_cookie_path, GetPath(), infinite_cache_path, | 504 extensions_cookie_path, GetPath(), infinite_cache_path, |
505 predictor_, | 505 predictor_, |
506 g_browser_process->local_state(), | |
507 g_browser_process->io_thread(), | |
508 restore_old_session_cookies, | 506 restore_old_session_cookies, |
509 GetSpecialStoragePolicy()); | 507 GetSpecialStoragePolicy()); |
510 | 508 |
511 #if defined(ENABLE_PLUGINS) | 509 #if defined(ENABLE_PLUGINS) |
512 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 510 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
513 PluginPrefs::GetForProfile(this), | 511 PluginPrefs::GetForProfile(this), |
514 io_data_.GetResourceContextNoInit()); | 512 io_data_.GetResourceContextNoInit()); |
515 #endif | 513 #endif |
516 | 514 |
517 // Delay README creation to not impact startup performance. | 515 // Delay README creation to not impact startup performance. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
782 } | 780 } |
783 return otr_prefs_.get(); | 781 return otr_prefs_.get(); |
784 } | 782 } |
785 | 783 |
786 FilePath ProfileImpl::GetPrefFilePath() { | 784 FilePath ProfileImpl::GetPrefFilePath() { |
787 FilePath pref_file_path = path_; | 785 FilePath pref_file_path = path_; |
788 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 786 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
789 return pref_file_path; | 787 return pref_file_path; |
790 } | 788 } |
791 | 789 |
790 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( | |
791 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
792 blob_protocol_handler, | |
793 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
794 file_system_protocol_handler, | |
795 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
796 developer_protocol_handler) { | |
797 return io_data_.CreateMainRequestContextGetter( | |
798 blob_protocol_handler.Pass(), | |
799 file_system_protocol_handler.Pass(), | |
800 developer_protocol_handler.Pass(), | |
801 g_browser_process->local_state(), | |
802 g_browser_process->io_thread()); | |
803 } | |
804 | |
792 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 805 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
793 return io_data_.GetMainRequestContextGetter(); | 806 content::StoragePartition* storage_partition = |
807 BrowserContext::GetStoragePartition(this, NULL); | |
awong
2013/01/19 00:43:42
Use BrowserContext::GetDefaultStoragePartition() i
pauljensen
2013/01/21 06:24:56
Your comment about that function is pretty inhibit
| |
808 return storage_partition->GetURLRequestContext(); | |
794 } | 809 } |
795 | 810 |
796 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 811 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
797 int renderer_child_id) { | 812 int renderer_child_id) { |
798 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 813 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
799 renderer_child_id); | 814 renderer_child_id); |
800 | 815 |
801 return rph->GetStoragePartition()->GetURLRequestContext(); | 816 return rph->GetStoragePartition()->GetURLRequestContext(); |
802 } | 817 } |
803 | 818 |
(...skipping 21 matching lines...) Expand all Loading... | |
825 } | 840 } |
826 | 841 |
827 content::ResourceContext* ProfileImpl::GetResourceContext() { | 842 content::ResourceContext* ProfileImpl::GetResourceContext() { |
828 return io_data_.GetResourceContext(); | 843 return io_data_.GetResourceContext(); |
829 } | 844 } |
830 | 845 |
831 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 846 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
832 return io_data_.GetExtensionsRequestContextGetter(); | 847 return io_data_.GetExtensionsRequestContextGetter(); |
833 } | 848 } |
834 | 849 |
835 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 850 net::URLRequestContextGetter* |
851 ProfileImpl::CreateRequestContextForStoragePartition( | |
836 const FilePath& partition_path, | 852 const FilePath& partition_path, |
837 bool in_memory) { | 853 bool in_memory, |
838 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 854 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
855 blob_protocol_handler, | |
856 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
857 file_system_protocol_handler, | |
858 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
859 developer_protocol_handler) { | |
860 return io_data_.CreateIsolatedAppRequestContextGetter( | |
861 partition_path, in_memory, blob_protocol_handler.Pass(), | |
862 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); | |
839 } | 863 } |
840 | 864 |
841 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 865 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
842 return ssl_config_service_manager_->Get(); | 866 return ssl_config_service_manager_->Get(); |
843 } | 867 } |
844 | 868 |
845 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 869 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
846 if (!host_content_settings_map_.get()) { | 870 if (!host_content_settings_map_.get()) { |
847 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 871 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
848 } | 872 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1135 if (!path.empty()) | 1159 if (!path.empty()) |
1136 *cache_path = path; | 1160 *cache_path = path; |
1137 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1161 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1138 prefs_->GetInteger(prefs::kDiskCacheSize); | 1162 prefs_->GetInteger(prefs::kDiskCacheSize); |
1139 } | 1163 } |
1140 | 1164 |
1141 base::Callback<ChromeURLDataManagerBackend*(void)> | 1165 base::Callback<ChromeURLDataManagerBackend*(void)> |
1142 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1166 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1143 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1167 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1144 } | 1168 } |
OLD | NEW |