Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed macro and InMemory. Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/environment.h" 10 #include "base/environment.h"
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); 754 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
755 return pref_file_path; 755 return pref_file_path;
756 } 756 }
757 757
758 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { 758 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
759 return io_data_.GetMainRequestContextGetter(); 759 return io_data_.GetMainRequestContextGetter();
760 } 760 }
761 761
762 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( 762 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
763 int renderer_child_id) { 763 int renderer_child_id) {
764 ExtensionService* extension_service = 764 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
765 extensions::ExtensionSystem::Get(this)->extension_service(); 765 renderer_child_id);
766 if (extension_service) { 766 CHECK(rph);
767 const extensions::Extension* extension = 767 content::StoragePartition* storage_partition = rph->GetStoragePartition();
768 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 768
769 if (extension) 769 // TODO(nasko): Remove this conditional, once browser tag creates a proper
770 return GetRequestContextForStoragePartition(extension->id()); 770 // storage partition.
771 if (rph->IsGuest()) {
772 return GetRequestContextForStoragePartition(
773 storage_partition->GetPath(), true);
771 } 774 }
772 775
773 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 776 return storage_partition->GetURLRequestContext();
774 renderer_child_id);
775 if (rph && rph->IsGuest()) {
776 // For guest processes (used by the browser tag), we need to isolate the
777 // storage.
778 // TODO(nasko): Until we have proper storage partitions, create a
779 // non-persistent context using the RPH's id.
780 std::string id("guest-");
781 id.append(base::IntToString(renderer_child_id));
782 return GetRequestContextForStoragePartition(id);
783 }
784
785 return GetRequestContext();
786 } 777 }
787 778
788 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { 779 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
789 // Return the default media context. 780 // Return the default media context.
790 return io_data_.GetMediaRequestContextGetter(); 781 return io_data_.GetMediaRequestContextGetter();
791 } 782 }
792 783
793 net::URLRequestContextGetter* 784 net::URLRequestContextGetter*
794 ProfileImpl::GetMediaRequestContextForRenderProcess( 785 ProfileImpl::GetMediaRequestContextForRenderProcess(
795 int renderer_child_id) { 786 int renderer_child_id) {
796 ExtensionService* extension_service = 787 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
797 extensions::ExtensionSystem::Get(this)->extension_service(); 788 renderer_child_id);
798 if (extension_service) { 789 CHECK(rph);
awong 2012/10/19 23:26:50 remove superfluous CHECK()
nasko 2012/10/19 23:55:16 Done.
799 const extensions::Extension* extension = 790 content::StoragePartition* storage_partition = rph->GetStoragePartition();
800 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 791
801 if (extension) 792 // TODO(nasko): Remove this conditional, once browser tag creates a proper
802 return io_data_.GetIsolatedMediaRequestContextGetter(extension->id()); 793 // storage partition.
794 if (rph->IsGuest()) {
795 return GetRequestContextForStoragePartition(
796 storage_partition->GetPath(), true);
803 } 797 }
804 798
805 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 799 return storage_partition->GetMediaURLRequestContext();
806 renderer_child_id);
807 if (rph && rph->IsGuest()) {
808 // For guest processes (used by the browser tag), we need to isolate the
809 // storage.
810 // TODO(nasko): Until we have proper storage partitions, create a
811 // non-persistent context using the RPH's id.
812 std::string id("guest-");
813 id.append(base::IntToString(renderer_child_id));
814 return io_data_.GetIsolatedMediaRequestContextGetter(id);
815 }
816
817 return io_data_.GetMediaRequestContextGetter();
818 } 800 }
819 801
820 net::URLRequestContextGetter* 802 net::URLRequestContextGetter*
821 ProfileImpl::GetMediaRequestContextForStoragePartition( 803 ProfileImpl::GetMediaRequestContextForStoragePartition(
822 const std::string& partition_id) { 804 const FilePath& partition_path,
823 return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); 805 bool in_memory) {
806 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path,
807 in_memory);
824 } 808 }
825 809
826 content::ResourceContext* ProfileImpl::GetResourceContext() { 810 content::ResourceContext* ProfileImpl::GetResourceContext() {
827 return io_data_.GetResourceContext(); 811 return io_data_.GetResourceContext();
828 } 812 }
829 813
830 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { 814 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
831 return io_data_.GetExtensionsRequestContextGetter(); 815 return io_data_.GetExtensionsRequestContextGetter();
832 } 816 }
833 817
834 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( 818 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition(
835 const std::string& partition_id) { 819 const FilePath& partition_path,
836 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 820 bool in_memory) {
821 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
837 } 822 }
838 823
839 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { 824 net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
840 return ssl_config_service_manager_->Get(); 825 return ssl_config_service_manager_->Get();
841 } 826 }
842 827
843 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { 828 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
844 if (!host_content_settings_map_.get()) { 829 if (!host_content_settings_map_.get()) {
845 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); 830 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false);
846 } 831 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 if (!path.empty()) 1150 if (!path.empty())
1166 *cache_path = path; 1151 *cache_path = path;
1167 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1152 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1168 prefs_->GetInteger(prefs::kDiskCacheSize); 1153 prefs_->GetInteger(prefs::kDiskCacheSize);
1169 } 1154 }
1170 1155
1171 base::Callback<ChromeURLDataManagerBackend*(void)> 1156 base::Callback<ChromeURLDataManagerBackend*(void)>
1172 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1157 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1173 return io_data_.GetChromeURLDataManagerBackendGetter(); 1158 return io_data_.GetChromeURLDataManagerBackendGetter();
1174 } 1159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698