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 return io_data_.GetMainRequestContextGetter(); |
mmenke
2013/01/08 17:19:26
Now that we're separating out creation from initia
awong
2013/01/16 21:31:50
At a surface level, this sounds fine to me. I thin
mmenke
2013/01/16 23:40:36
My understanding from what you said earlier is tha
mmenke
2013/01/16 23:45:28
Oh, and while I agree it's a little circular, I th
pauljensen
2013/01/21 06:24:56
I adjusted GetRequestContext() as described. I co
| |
794 } | 807 } |
795 | 808 |
796 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 809 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
797 int renderer_child_id) { | 810 int renderer_child_id) { |
798 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 811 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
799 renderer_child_id); | 812 renderer_child_id); |
800 | 813 |
801 return rph->GetStoragePartition()->GetURLRequestContext(); | 814 return rph->GetStoragePartition()->GetURLRequestContext(); |
802 } | 815 } |
803 | 816 |
(...skipping 21 matching lines...) Expand all Loading... | |
825 } | 838 } |
826 | 839 |
827 content::ResourceContext* ProfileImpl::GetResourceContext() { | 840 content::ResourceContext* ProfileImpl::GetResourceContext() { |
828 return io_data_.GetResourceContext(); | 841 return io_data_.GetResourceContext(); |
829 } | 842 } |
830 | 843 |
831 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { | 844 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
832 return io_data_.GetExtensionsRequestContextGetter(); | 845 return io_data_.GetExtensionsRequestContextGetter(); |
833 } | 846 } |
834 | 847 |
835 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( | 848 net::URLRequestContextGetter* |
849 ProfileImpl::CreateRequestContextForStoragePartition( | |
836 const FilePath& partition_path, | 850 const FilePath& partition_path, |
837 bool in_memory) { | 851 bool in_memory, |
838 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory); | 852 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> |
853 blob_protocol_handler, | |
854 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> | |
855 file_system_protocol_handler, | |
856 scoped_ptr<net::URLRequestJobFactory::Interceptor> | |
857 developer_protocol_handler) { | |
858 return io_data_.CreateIsolatedAppRequestContextGetter( | |
859 partition_path, in_memory, blob_protocol_handler.Pass(), | |
860 file_system_protocol_handler.Pass(), developer_protocol_handler.Pass()); | |
839 } | 861 } |
840 | 862 |
841 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { | 863 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |
842 return ssl_config_service_manager_->Get(); | 864 return ssl_config_service_manager_->Get(); |
843 } | 865 } |
844 | 866 |
845 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { | 867 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { |
846 if (!host_content_settings_map_.get()) { | 868 if (!host_content_settings_map_.get()) { |
847 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); | 869 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); |
848 } | 870 } |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1139 if (!path.empty()) | 1161 if (!path.empty()) |
1140 *cache_path = path; | 1162 *cache_path = path; |
1141 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1163 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
1142 prefs_->GetInteger(prefs::kDiskCacheSize); | 1164 prefs_->GetInteger(prefs::kDiskCacheSize); |
1143 } | 1165 } |
1144 | 1166 |
1145 base::Callback<ChromeURLDataManagerBackend*(void)> | 1167 base::Callback<ChromeURLDataManagerBackend*(void)> |
1146 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1168 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
1147 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1169 return io_data_.GetChromeURLDataManagerBackendGetter(); |
1148 } | 1170 } |
OLD | NEW |