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

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

Issue 11320018: Fixing guest processes to use the proper storage partition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 749 extension_service->GetIsolatedAppForRenderer(renderer_child_id);
750 if (extension) 750 if (extension)
751 return GetRequestContextForStoragePartition(extension->id()); 751 return GetRequestContextForStoragePartition(extension->id());
752 } 752 }
753 753
754 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 754 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
755 renderer_child_id); 755 renderer_child_id);
756 if (rph && rph->IsGuest()) { 756 if (rph && rph->IsGuest()) {
757 // For guest processes (used by the browser tag), we need to isolate the 757 // For guest processes (used by the browser tag), we need to isolate the
758 // storage. 758 // storage.
759 // TODO(nasko): Until we have proper storage partitions, create a 759 return rph->GetStoragePartition()->GetURLRequestContext();
760 // non-persistent context using the RPH's id.
761 std::string id("guest-");
762 id.append(base::IntToString(renderer_child_id));
763 return GetRequestContextForStoragePartition(id);
764 } 760 }
765 761
766 return GetRequestContext(); 762 return GetRequestContext();
767 } 763 }
768 764
769 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { 765 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
770 // Return the default media context. 766 // Return the default media context.
771 return io_data_.GetMediaRequestContextGetter(); 767 return io_data_.GetMediaRequestContextGetter();
772 } 768 }
773 769
774 net::URLRequestContextGetter* 770 net::URLRequestContextGetter*
775 ProfileImpl::GetMediaRequestContextForRenderProcess( 771 ProfileImpl::GetMediaRequestContextForRenderProcess(
776 int renderer_child_id) { 772 int renderer_child_id) {
777 ExtensionService* extension_service = 773 ExtensionService* extension_service =
778 extensions::ExtensionSystem::Get(this)->extension_service(); 774 extensions::ExtensionSystem::Get(this)->extension_service();
779 if (extension_service) { 775 if (extension_service) {
780 const extensions::Extension* extension = 776 const extensions::Extension* extension =
781 extension_service->GetIsolatedAppForRenderer(renderer_child_id); 777 extension_service->GetIsolatedAppForRenderer(renderer_child_id);
782 if (extension) 778 if (extension)
783 return io_data_.GetIsolatedMediaRequestContextGetter(extension->id()); 779 return io_data_.GetIsolatedMediaRequestContextGetter(extension->id());
784 } 780 }
785 781
786 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 782 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
787 renderer_child_id); 783 renderer_child_id);
788 if (rph && rph->IsGuest()) { 784 if (rph && rph->IsGuest()) {
789 // For guest processes (used by the browser tag), we need to isolate the 785 // For guest processes (used by the browser tag), we need to isolate the
790 // storage. 786 // storage.
791 // TODO(nasko): Until we have proper storage partitions, create a 787 return rph->GetStoragePartition()->GetMediaURLRequestContext();
792 // non-persistent context using the RPH's id.
793 std::string id("guest-");
794 id.append(base::IntToString(renderer_child_id));
795 return io_data_.GetIsolatedMediaRequestContextGetter(id);
796 } 788 }
797 789
798 return io_data_.GetMediaRequestContextGetter(); 790 return io_data_.GetMediaRequestContextGetter();
799 } 791 }
800 792
801 net::URLRequestContextGetter* 793 net::URLRequestContextGetter*
802 ProfileImpl::GetMediaRequestContextForStoragePartition( 794 ProfileImpl::GetMediaRequestContextForStoragePartition(
803 const std::string& partition_id) { 795 const std::string& partition_id) {
804 return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); 796 return io_data_.GetIsolatedMediaRequestContextGetter(partition_id);
805 } 797 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 if (!path.empty()) 1138 if (!path.empty())
1147 *cache_path = path; 1139 *cache_path = path;
1148 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1140 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1149 prefs_->GetInteger(prefs::kDiskCacheSize); 1141 prefs_->GetInteger(prefs::kDiskCacheSize);
1150 } 1142 }
1151 1143
1152 base::Callback<ChromeURLDataManagerBackend*(void)> 1144 base::Callback<ChromeURLDataManagerBackend*(void)>
1153 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1145 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1154 return io_data_.GetChromeURLDataManagerBackendGetter(); 1146 return io_data_.GetChromeURLDataManagerBackendGetter();
1155 } 1147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698