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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 InitHostZoomMap(); | 509 InitHostZoomMap(); |
510 | 510 |
511 // Make sure we initialize the ProfileIOData after everything else has been | 511 // Make sure we initialize the ProfileIOData after everything else has been |
512 // initialized that we might be reading from the IO thread. | 512 // initialized that we might be reading from the IO thread. |
513 | 513 |
514 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 514 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
515 cache_max_size, media_cache_path, media_cache_max_size, | 515 cache_max_size, media_cache_path, media_cache_max_size, |
516 extensions_cookie_path, GetPath(), infinite_cache_path, | 516 extensions_cookie_path, GetPath(), infinite_cache_path, |
517 predictor_, | 517 predictor_, |
518 g_browser_process->local_state(), | |
519 g_browser_process->io_thread(), | |
520 restore_old_session_cookies, | 518 restore_old_session_cookies, |
521 GetSpecialStoragePolicy()); | 519 GetSpecialStoragePolicy()); |
522 | 520 |
523 #if defined(ENABLE_PLUGINS) | 521 #if defined(ENABLE_PLUGINS) |
524 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 522 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
525 PluginPrefs::GetForProfile(this), | 523 PluginPrefs::GetForProfile(this), |
526 io_data_.GetResourceContextNoInit()); | 524 io_data_.GetResourceContextNoInit()); |
527 #endif | 525 #endif |
528 | 526 |
529 // Delay README creation to not impact startup performance. | 527 // Delay README creation to not impact startup performance. |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 } | 794 } |
797 return otr_prefs_.get(); | 795 return otr_prefs_.get(); |
798 } | 796 } |
799 | 797 |
800 FilePath ProfileImpl::GetPrefFilePath() { | 798 FilePath ProfileImpl::GetPrefFilePath() { |
801 FilePath pref_file_path = path_; | 799 FilePath pref_file_path = path_; |
802 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 800 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
803 return pref_file_path; | 801 return pref_file_path; |
804 } | 802 } |
805 | 803 |
| 804 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 805 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 806 blob_protocol_handler, |
| 807 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 808 file_system_protocol_handler, |
| 809 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 810 developer_protocol_handler, |
| 811 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 812 chrome_protocol_handler, |
| 813 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 814 chrome_devtools_protocol_handler) { |
| 815 return io_data_.CreateMainRequestContextGetter( |
| 816 blob_protocol_handler.Pass(), |
| 817 file_system_protocol_handler.Pass(), |
| 818 developer_protocol_handler.Pass(), |
| 819 chrome_protocol_handler.Pass(), |
| 820 chrome_devtools_protocol_handler.Pass(), |
| 821 g_browser_process->local_state(), |
| 822 g_browser_process->io_thread()); |
| 823 } |
| 824 |
806 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 825 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
807 return io_data_.GetMainRequestContextGetter(); | 826 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
808 } | 827 } |
809 | 828 |
810 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 829 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
811 int renderer_child_id) { | 830 int renderer_child_id) { |
812 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 831 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
813 renderer_child_id); | 832 renderer_child_id); |
814 | 833 |
815 return rph->GetStoragePartition()->GetURLRequestContext(); | 834 return rph->GetStoragePartition()->GetURLRequestContext(); |
816 } | 835 } |
817 | 836 |
(...skipping 21 matching lines...) Expand all Loading... |
839 } | 858 } |
840 | 859 |
841 content::ResourceContext* ProfileImpl::GetResourceContext() { | 860 content::ResourceContext* ProfileImpl::GetResourceContext() { |
842 return io_data_.GetResourceContext(); | 861 return io_data_.GetResourceContext(); |
843 } | 862 } |
844 | 863 |
845 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 864 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
846 return io_data_.GetExtensionsRequestContextGetter(); | 865 return io_data_.GetExtensionsRequestContextGetter(); |
847 } | 866 } |
848 | 867 |
849 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 868 net::URLRequestContextGetter* |
| 869 ProfileImpl::CreateRequestContextForStoragePartition( |
850 const FilePath& partition_path, | 870 const FilePath& partition_path, |
851 bool in_memory) { | 871 bool in_memory, |
852 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 872 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 873 blob_protocol_handler, |
| 874 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 875 file_system_protocol_handler, |
| 876 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 877 developer_protocol_handler, |
| 878 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 879 chrome_protocol_handler, |
| 880 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 881 chrome_devtools_protocol_handler) { |
| 882 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 883 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 884 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 885 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
853 } | 886 } |
854 | 887 |
855 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 888 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
856 // If ssl_config_service_manager_ is null, this typically means that some | 889 // If ssl_config_service_manager_ is null, this typically means that some |
857 // ProfileKeyedService is trying to create a RequestContext at startup, but | 890 // ProfileKeyedService is trying to create a RequestContext at startup, but |
858 // SSLConfigServiceManager is not initialized until DoFinalInit() which is | 891 // SSLConfigServiceManager is not initialized until DoFinalInit() which is |
859 // invoked after all ProfileKeyedServices have been initialized (see | 892 // invoked after all ProfileKeyedServices have been initialized (see |
860 // http://crbug.com/171406). | 893 // http://crbug.com/171406). |
861 DCHECK(ssl_config_service_manager_.get()) << | 894 DCHECK(ssl_config_service_manager_.get()) << |
862 "SSLConfigServiceManager is not initialized yet"; | 895 "SSLConfigServiceManager is not initialized yet"; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 FilePath* cache_path, | 1182 FilePath* cache_path, |
1150 int* max_size) { | 1183 int* max_size) { |
1151 DCHECK(cache_path); | 1184 DCHECK(cache_path); |
1152 DCHECK(max_size); | 1185 DCHECK(max_size); |
1153 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1186 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
1154 if (!path.empty()) | 1187 if (!path.empty()) |
1155 *cache_path = path; | 1188 *cache_path = path; |
1156 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1189 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1157 prefs_->GetInteger(prefs::kDiskCacheSize); | 1190 prefs_->GetInteger(prefs::kDiskCacheSize); |
1158 } | 1191 } |
OLD | NEW |