| 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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 InitHostZoomMap(); | 538 InitHostZoomMap(); |
| 539 | 539 |
| 540 // Make sure we initialize the ProfileIOData after everything else has been | 540 // Make sure we initialize the ProfileIOData after everything else has been |
| 541 // initialized that we might be reading from the IO thread. | 541 // initialized that we might be reading from the IO thread. |
| 542 | 542 |
| 543 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 543 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
| 544 cache_max_size, media_cache_path, media_cache_max_size, | 544 cache_max_size, media_cache_path, media_cache_max_size, |
| 545 extensions_cookie_path, GetPath(), infinite_cache_path, | 545 extensions_cookie_path, GetPath(), infinite_cache_path, |
| 546 predictor_, | 546 predictor_, |
| 547 g_browser_process->local_state(), | |
| 548 g_browser_process->io_thread(), | |
| 549 restore_old_session_cookies, | 547 restore_old_session_cookies, |
| 550 GetSpecialStoragePolicy()); | 548 GetSpecialStoragePolicy()); |
| 551 | 549 |
| 552 #if defined(ENABLE_PLUGINS) | 550 #if defined(ENABLE_PLUGINS) |
| 553 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 551 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 554 PluginPrefs::GetForProfile(this), | 552 PluginPrefs::GetForProfile(this), |
| 555 io_data_.GetResourceContextNoInit()); | 553 io_data_.GetResourceContextNoInit()); |
| 556 #endif | 554 #endif |
| 557 | 555 |
| 558 // Delay README creation to not impact startup performance. | 556 // Delay README creation to not impact startup performance. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 821 } |
| 824 return otr_prefs_.get(); | 822 return otr_prefs_.get(); |
| 825 } | 823 } |
| 826 | 824 |
| 827 FilePath ProfileImpl::GetPrefFilePath() { | 825 FilePath ProfileImpl::GetPrefFilePath() { |
| 828 FilePath pref_file_path = path_; | 826 FilePath pref_file_path = path_; |
| 829 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 827 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
| 830 return pref_file_path; | 828 return pref_file_path; |
| 831 } | 829 } |
| 832 | 830 |
| 831 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 832 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 833 blob_protocol_handler, |
| 834 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 835 file_system_protocol_handler, |
| 836 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 837 developer_protocol_handler, |
| 838 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 839 chrome_protocol_handler, |
| 840 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 841 chrome_devtools_protocol_handler) { |
| 842 return io_data_.CreateMainRequestContextGetter( |
| 843 blob_protocol_handler.Pass(), |
| 844 file_system_protocol_handler.Pass(), |
| 845 developer_protocol_handler.Pass(), |
| 846 chrome_protocol_handler.Pass(), |
| 847 chrome_devtools_protocol_handler.Pass(), |
| 848 g_browser_process->local_state(), |
| 849 g_browser_process->io_thread()); |
| 850 } |
| 851 |
| 833 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 852 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 834 return io_data_.GetMainRequestContextGetter(); | 853 return GetDefaultStoragePartition(this)->GetURLRequestContext(); |
| 835 } | 854 } |
| 836 | 855 |
| 837 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 856 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 838 int renderer_child_id) { | 857 int renderer_child_id) { |
| 839 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 858 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 840 renderer_child_id); | 859 renderer_child_id); |
| 841 | 860 |
| 842 return rph->GetStoragePartition()->GetURLRequestContext(); | 861 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 843 } | 862 } |
| 844 | 863 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 866 } | 885 } |
| 867 | 886 |
| 868 content::ResourceContext* ProfileImpl::GetResourceContext() { | 887 content::ResourceContext* ProfileImpl::GetResourceContext() { |
| 869 return io_data_.GetResourceContext(); | 888 return io_data_.GetResourceContext(); |
| 870 } | 889 } |
| 871 | 890 |
| 872 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 891 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 873 return io_data_.GetExtensionsRequestContextGetter(); | 892 return io_data_.GetExtensionsRequestContextGetter(); |
| 874 } | 893 } |
| 875 | 894 |
| 876 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 895 net::URLRequestContextGetter* |
| 896 ProfileImpl::CreateRequestContextForStoragePartition( |
| 877 const FilePath& partition_path, | 897 const FilePath& partition_path, |
| 878 bool in_memory) { | 898 bool in_memory, |
| 879 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 899 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 900 blob_protocol_handler, |
| 901 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 902 file_system_protocol_handler, |
| 903 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 904 developer_protocol_handler, |
| 905 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 906 chrome_protocol_handler, |
| 907 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 908 chrome_devtools_protocol_handler) { |
| 909 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 910 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 911 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass(), |
| 912 chrome_protocol_handler.Pass(), chrome_devtools_protocol_handler.Pass()); |
| 880 } | 913 } |
| 881 | 914 |
| 882 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 915 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 883 // If ssl_config_service_manager_ is null, this typically means that some | 916 // If ssl_config_service_manager_ is null, this typically means that some |
| 884 // ProfileKeyedService is trying to create a RequestContext at startup, but | 917 // ProfileKeyedService is trying to create a RequestContext at startup, but |
| 885 // SSLConfigServiceManager is not initialized until DoFinalInit() which is | 918 // SSLConfigServiceManager is not initialized until DoFinalInit() which is |
| 886 // invoked after all ProfileKeyedServices have been initialized (see | 919 // invoked after all ProfileKeyedServices have been initialized (see |
| 887 // http://crbug.com/171406). | 920 // http://crbug.com/171406). |
| 888 DCHECK(ssl_config_service_manager_.get()) << | 921 DCHECK(ssl_config_service_manager_.get()) << |
| 889 "SSLConfigServiceManager is not initialized yet"; | 922 "SSLConfigServiceManager is not initialized yet"; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 FilePath* cache_path, | 1205 FilePath* cache_path, |
| 1173 int* max_size) { | 1206 int* max_size) { |
| 1174 DCHECK(cache_path); | 1207 DCHECK(cache_path); |
| 1175 DCHECK(max_size); | 1208 DCHECK(max_size); |
| 1176 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); | 1209 FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); |
| 1177 if (!path.empty()) | 1210 if (!path.empty()) |
| 1178 *cache_path = path; | 1211 *cache_path = path; |
| 1179 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1212 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1180 prefs_->GetInteger(prefs::kDiskCacheSize); | 1213 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1181 } | 1214 } |
| OLD | NEW |