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

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: Fixing Android's BrowserContext. Created 8 years, 1 month 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); 728 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
729 return pref_file_path; 729 return pref_file_path;
730 } 730 }
731 731
732 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { 732 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
733 return io_data_.GetMainRequestContextGetter(); 733 return io_data_.GetMainRequestContextGetter();
734 } 734 }
735 735
736 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( 736 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
737 int renderer_child_id) { 737 int renderer_child_id) {
738 ExtensionService* extension_service = 738 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
739 extensions::ExtensionSystem::Get(this)->extension_service(); 739 renderer_child_id);
740 if (extension_service) { 740 content::StoragePartition* storage_partition = rph->GetStoragePartition();
741 const extensions::Extension* extension = 741
742 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 742 // TODO(nasko): Remove this conditional, once browser tag creates a proper
Charlie Reis 2012/10/30 17:47:48 nit: webview tag
nasko 2012/10/30 19:55:25 Done.
743 if (extension) 743 // storage partition.
744 return GetRequestContextForStoragePartition(extension->id()); 744 if (rph->IsGuest()) {
745 // For guest processes, we only allow in-memory partitions for now, so
746 // hardcode the parameter here.
747 return GetRequestContextForStoragePartition(
748 storage_partition->GetPath(), true);
745 } 749 }
746 750
747 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 751 return storage_partition->GetURLRequestContext();
748 renderer_child_id);
749 if (rph && rph->IsGuest()) {
750 // For guest processes (used by the browser tag), we need to isolate the
751 // storage.
752 // TODO(nasko): Until we have proper storage partitions, create a
753 // non-persistent context using the RPH's id.
754 std::string id("guest-");
755 id.append(base::IntToString(renderer_child_id));
756 return GetRequestContextForStoragePartition(id);
757 }
758
759 return GetRequestContext();
760 } 752 }
761 753
762 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { 754 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
763 // Return the default media context. 755 // Return the default media context.
764 return io_data_.GetMediaRequestContextGetter(); 756 return io_data_.GetMediaRequestContextGetter();
765 } 757 }
766 758
767 net::URLRequestContextGetter* 759 net::URLRequestContextGetter*
768 ProfileImpl::GetMediaRequestContextForRenderProcess( 760 ProfileImpl::GetMediaRequestContextForRenderProcess(
769 int renderer_child_id) { 761 int renderer_child_id) {
770 ExtensionService* extension_service = 762 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
771 extensions::ExtensionSystem::Get(this)->extension_service(); 763 renderer_child_id);
772 if (extension_service) { 764 content::StoragePartition* storage_partition = rph->GetStoragePartition();
773 const extensions::Extension* extension = 765
774 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 766 // TODO(nasko): Remove this conditional, once browser tag creates a proper
Charlie Reis 2012/10/30 17:47:48 ditto
nasko 2012/10/30 19:55:25 Done.
775 if (extension) 767 // storage partition.
776 return io_data_.GetIsolatedMediaRequestContextGetter(extension->id()); 768 if (rph->IsGuest()) {
769 // For guest processes, we only allow in-memory partitions for now, so
770 // hardcode the parameter here.
771 return GetMediaRequestContextForStoragePartition(
772 storage_partition->GetPath(), true);
777 } 773 }
778 774
779 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 775 return storage_partition->GetMediaURLRequestContext();
780 renderer_child_id);
781 if (rph && rph->IsGuest()) {
782 // For guest processes (used by the browser tag), we need to isolate the
783 // storage.
784 // TODO(nasko): Until we have proper storage partitions, create a
785 // non-persistent context using the RPH's id.
786 std::string id("guest-");
787 id.append(base::IntToString(renderer_child_id));
788 return io_data_.GetIsolatedMediaRequestContextGetter(id);
789 }
790
791 return io_data_.GetMediaRequestContextGetter();
792 } 776 }
793 777
794 net::URLRequestContextGetter* 778 net::URLRequestContextGetter*
795 ProfileImpl::GetMediaRequestContextForStoragePartition( 779 ProfileImpl::GetMediaRequestContextForStoragePartition(
796 const std::string& partition_id) { 780 const FilePath& partition_path,
797 return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); 781 bool in_memory) {
782 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path,
783 in_memory);
798 } 784 }
799 785
800 content::ResourceContext* ProfileImpl::GetResourceContext() { 786 content::ResourceContext* ProfileImpl::GetResourceContext() {
801 return io_data_.GetResourceContext(); 787 return io_data_.GetResourceContext();
802 } 788 }
803 789
804 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { 790 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
805 return io_data_.GetExtensionsRequestContextGetter(); 791 return io_data_.GetExtensionsRequestContextGetter();
806 } 792 }
807 793
808 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( 794 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition(
809 const std::string& partition_id) { 795 const FilePath& partition_path,
810 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 796 bool in_memory) {
797 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
811 } 798 }
812 799
813 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { 800 net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
814 return ssl_config_service_manager_->Get(); 801 return ssl_config_service_manager_->Get();
815 } 802 }
816 803
817 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { 804 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
818 if (!host_content_settings_map_.get()) { 805 if (!host_content_settings_map_.get()) {
819 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); 806 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false);
820 } 807 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 if (!path.empty()) 1126 if (!path.empty())
1140 *cache_path = path; 1127 *cache_path = path;
1141 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1128 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1142 prefs_->GetInteger(prefs::kDiskCacheSize); 1129 prefs_->GetInteger(prefs::kDiskCacheSize);
1143 } 1130 }
1144 1131
1145 base::Callback<ChromeURLDataManagerBackend*(void)> 1132 base::Callback<ChromeURLDataManagerBackend*(void)>
1146 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1133 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1147 return io_data_.GetChromeURLDataManagerBackendGetter(); 1134 return io_data_.GetChromeURLDataManagerBackendGetter();
1148 } 1135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698