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

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: Missed a merging of removed variable. 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_impl_io_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename); 723 pref_file_path = pref_file_path.Append(chrome::kPreferencesFilename);
724 return pref_file_path; 724 return pref_file_path;
725 } 725 }
726 726
727 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { 727 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
728 return io_data_.GetMainRequestContextGetter(); 728 return io_data_.GetMainRequestContextGetter();
729 } 729 }
730 730
731 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( 731 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
732 int renderer_child_id) { 732 int renderer_child_id) {
733 ExtensionService* extension_service = 733 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
734 extensions::ExtensionSystem::Get(this)->extension_service(); 734 renderer_child_id);
735 if (extension_service) { 735 content::StoragePartition* storage_partition = rph->GetStoragePartition();
736 const extensions::Extension* extension = 736
737 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 737 // TODO(nasko): Remove this conditional, once webview tag creates a proper
738 if (extension) 738 // storage partition.
739 return GetRequestContextForStoragePartition(extension->id()); 739 if (rph->IsGuest()) {
740 // For guest processes, we only allow in-memory partitions for now, so
741 // hardcode the parameter here.
742 return GetRequestContextForStoragePartition(
743 storage_partition->GetPath(), true);
740 } 744 }
741 745
742 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 746 return storage_partition->GetURLRequestContext();
743 renderer_child_id);
744 if (rph && rph->IsGuest()) {
745 // For guest processes (used by the browser tag), we need to isolate the
746 // storage.
747 // TODO(nasko): Until we have proper storage partitions, create a
748 // non-persistent context using the RPH's id.
749 std::string id("guest-");
750 id.append(base::IntToString(renderer_child_id));
751 return GetRequestContextForStoragePartition(id);
752 }
753
754 return GetRequestContext();
755 } 747 }
756 748
757 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { 749 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
758 // Return the default media context. 750 // Return the default media context.
759 return io_data_.GetMediaRequestContextGetter(); 751 return io_data_.GetMediaRequestContextGetter();
760 } 752 }
761 753
762 net::URLRequestContextGetter* 754 net::URLRequestContextGetter*
763 ProfileImpl::GetMediaRequestContextForRenderProcess( 755 ProfileImpl::GetMediaRequestContextForRenderProcess(
764 int renderer_child_id) { 756 int renderer_child_id) {
765 ExtensionService* extension_service = 757 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
766 extensions::ExtensionSystem::Get(this)->extension_service(); 758 renderer_child_id);
767 if (extension_service) { 759 content::StoragePartition* storage_partition = rph->GetStoragePartition();
768 const extensions::Extension* extension = 760
769 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 761 // TODO(nasko): Remove this conditional, once webview tag creates a proper
770 if (extension) 762 // storage partition.
771 return io_data_.GetIsolatedMediaRequestContextGetter(extension->id()); 763 if (rph->IsGuest()) {
764 // For guest processes, we only allow in-memory partitions for now, so
765 // hardcode the parameter here.
766 return GetMediaRequestContextForStoragePartition(
767 storage_partition->GetPath(), true);
772 } 768 }
773 769
774 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 770 return storage_partition->GetMediaURLRequestContext();
775 renderer_child_id);
776 if (rph && rph->IsGuest()) {
777 // For guest processes (used by the browser tag), we need to isolate the
778 // storage.
779 // TODO(nasko): Until we have proper storage partitions, create a
780 // non-persistent context using the RPH's id.
781 std::string id("guest-");
782 id.append(base::IntToString(renderer_child_id));
783 return io_data_.GetIsolatedMediaRequestContextGetter(id);
784 }
785
786 return io_data_.GetMediaRequestContextGetter();
787 } 771 }
788 772
789 net::URLRequestContextGetter* 773 net::URLRequestContextGetter*
790 ProfileImpl::GetMediaRequestContextForStoragePartition( 774 ProfileImpl::GetMediaRequestContextForStoragePartition(
791 const std::string& partition_id) { 775 const FilePath& partition_path,
792 return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); 776 bool in_memory) {
777 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path,
778 in_memory);
793 } 779 }
794 780
795 content::ResourceContext* ProfileImpl::GetResourceContext() { 781 content::ResourceContext* ProfileImpl::GetResourceContext() {
796 return io_data_.GetResourceContext(); 782 return io_data_.GetResourceContext();
797 } 783 }
798 784
799 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { 785 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
800 return io_data_.GetExtensionsRequestContextGetter(); 786 return io_data_.GetExtensionsRequestContextGetter();
801 } 787 }
802 788
803 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( 789 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition(
804 const std::string& partition_id) { 790 const FilePath& partition_path,
805 return io_data_.GetIsolatedAppRequestContextGetter(partition_id); 791 bool in_memory) {
792 return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
806 } 793 }
807 794
808 net::SSLConfigService* ProfileImpl::GetSSLConfigService() { 795 net::SSLConfigService* ProfileImpl::GetSSLConfigService() {
809 return ssl_config_service_manager_->Get(); 796 return ssl_config_service_manager_->Get();
810 } 797 }
811 798
812 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() { 799 HostContentSettingsMap* ProfileImpl::GetHostContentSettingsMap() {
813 if (!host_content_settings_map_.get()) { 800 if (!host_content_settings_map_.get()) {
814 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false); 801 host_content_settings_map_ = new HostContentSettingsMap(GetPrefs(), false);
815 } 802 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 if (!path.empty()) 1121 if (!path.empty())
1135 *cache_path = path; 1122 *cache_path = path;
1136 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1123 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1137 prefs_->GetInteger(prefs::kDiskCacheSize); 1124 prefs_->GetInteger(prefs::kDiskCacheSize);
1138 } 1125 }
1139 1126
1140 base::Callback<ChromeURLDataManagerBackend*(void)> 1127 base::Callback<ChromeURLDataManagerBackend*(void)>
1141 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1128 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1142 return io_data_.GetChromeURLDataManagerBackendGetter(); 1129 return io_data_.GetChromeURLDataManagerBackendGetter();
1143 } 1130 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | chrome/browser/profiles/profile_impl_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698