| 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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 | 507 |
| 508 InitHostZoomMap(); | 508 InitHostZoomMap(); |
| 509 | 509 |
| 510 // Make sure we initialize the ProfileIOData after everything else has been | 510 // Make sure we initialize the ProfileIOData after everything else has been |
| 511 // initialized that we might be reading from the IO thread. | 511 // initialized that we might be reading from the IO thread. |
| 512 | 512 |
| 513 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, | 513 io_data_.Init(cookie_path, server_bound_cert_path, cache_path, |
| 514 cache_max_size, media_cache_path, media_cache_max_size, | 514 cache_max_size, media_cache_path, media_cache_max_size, |
| 515 extensions_cookie_path, GetPath(), infinite_cache_path, | 515 extensions_cookie_path, GetPath(), infinite_cache_path, |
| 516 predictor_, | 516 predictor_, |
| 517 g_browser_process->local_state(), | |
| 518 g_browser_process->io_thread(), | |
| 519 restore_old_session_cookies, | 517 restore_old_session_cookies, |
| 520 GetSpecialStoragePolicy()); | 518 GetSpecialStoragePolicy()); |
| 521 | 519 |
| 522 #if defined(ENABLE_PLUGINS) | 520 #if defined(ENABLE_PLUGINS) |
| 523 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( | 521 ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| 524 PluginPrefs::GetForProfile(this), | 522 PluginPrefs::GetForProfile(this), |
| 525 io_data_.GetResourceContextNoInit()); | 523 io_data_.GetResourceContextNoInit()); |
| 526 #endif | 524 #endif |
| 527 | 525 |
| 528 // Delay README creation to not impact startup performance. | 526 // Delay README creation to not impact startup performance. |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 } | 791 } |
| 794 return otr_prefs_.get(); | 792 return otr_prefs_.get(); |
| 795 } | 793 } |
| 796 | 794 |
| 797 FilePath ProfileImpl::GetPrefFilePath() { | 795 FilePath ProfileImpl::GetPrefFilePath() { |
| 798 FilePath pref_file_path = path_; | 796 FilePath pref_file_path = path_; |
| 799 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); | 797 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); |
| 800 return pref_file_path; | 798 return pref_file_path; |
| 801 } | 799 } |
| 802 | 800 |
| 801 net::URLRequestContextGetter* ProfileImpl::CreateRequestContext( |
| 802 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 803 blob_protocol_handler, |
| 804 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 805 file_system_protocol_handler, |
| 806 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 807 developer_protocol_handler) { |
| 808 return io_data_.CreateMainRequestContextGetter( |
| 809 blob_protocol_handler.Pass(), |
| 810 file_system_protocol_handler.Pass(), |
| 811 developer_protocol_handler.Pass(), |
| 812 g_browser_process->local_state(), |
| 813 g_browser_process->io_thread()); |
| 814 } |
| 815 |
| 803 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 816 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 804 return io_data_.GetMainRequestContextGetter(); | 817 content::StoragePartition* storage_partition = |
| 818 BrowserContext::GetStoragePartition(this, NULL); |
| 819 return storage_partition->GetURLRequestContext(); |
| 805 } | 820 } |
| 806 | 821 |
| 807 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 822 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 808 int renderer_child_id) { | 823 int renderer_child_id) { |
| 809 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 824 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 810 renderer_child_id); | 825 renderer_child_id); |
| 811 | 826 |
| 812 return rph->GetStoragePartition()->GetURLRequestContext(); | 827 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 813 } | 828 } |
| 814 | 829 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 836 } | 851 } |
| 837 | 852 |
| 838 content::ResourceContext* ProfileImpl::GetResourceContext() { | 853 content::ResourceContext* ProfileImpl::GetResourceContext() { |
| 839 return io_data_.GetResourceContext(); | 854 return io_data_.GetResourceContext(); |
| 840 } | 855 } |
| 841 | 856 |
| 842 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 857 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| 843 return io_data_.GetExtensionsRequestContextGetter(); | 858 return io_data_.GetExtensionsRequestContextGetter(); |
| 844 } | 859 } |
| 845 | 860 |
| 846 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 861 net::URLRequestContextGetter* |
| 862 ProfileImpl::CreateRequestContextForStoragePartition( |
| 847 const FilePath& partition_path, | 863 const FilePath& partition_path, |
| 848 bool in_memory) { | 864 bool in_memory, |
| 849 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 865 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 866 blob_protocol_handler, |
| 867 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 868 file_system_protocol_handler, |
| 869 scoped_ptr<net::URLRequestJobFactory::Interceptor> |
| 870 developer_protocol_handler) { |
| 871 return io_data_.CreateIsolatedAppRequestContextGetter( |
| 872 partition_path, in_memory, blob_protocol_handler.Pass(), |
| 873 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); |
| 850 } | 874 } |
| 851 | 875 |
| 852 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 876 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
| 853 return ssl_config_service_manager_->Get(); | 877 return ssl_config_service_manager_->Get(); |
| 854 } | 878 } |
| 855 | 879 |
| 856 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 880 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
| 857 if (!host_content_settings_map_.get()) { | 881 if (!host_content_settings_map_.get()) { |
| 858 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 882 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
| 859 } | 883 } |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1146 if (!path.empty()) | 1170 if (!path.empty()) |
| 1147 *cache_path = path; | 1171 *cache_path = path; |
| 1148 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1172 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1149 prefs_->GetInteger(prefs::kDiskCacheSize); | 1173 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1150 } | 1174 } |
| 1151 | 1175 |
| 1152 base::Callback<ChromeURLDataManagerBackend*(void)> | 1176 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1153 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1177 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1154 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1178 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1155 } | 1179 } |
| OLD | NEW |