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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 10836305: Ensure that isolated apps use the right cookies for media requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 259a4e0d336313865bc4deefe8ba63f3ea4aac7f..7ef9f17337b2af4b7add329e8edc496e6e3256ea 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -683,9 +683,8 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
if (extension_service) {
const extensions::Extension* installed_app = extension_service->
GetInstalledAppForRenderer(renderer_child_id);
- if (installed_app != NULL && installed_app->is_storage_isolated()) {
+ if (installed_app != NULL && installed_app->is_storage_isolated())
return GetRequestContextForIsolatedApp(installed_app->id());
- }
}
content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
@@ -703,7 +702,34 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
return GetRequestContext();
}
-net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() {
+net::URLRequestContextGetter* ProfileImpl::GetDefaultRequestContextForMedia() {
+ // Return the default media context.
+ return io_data_.GetMediaRequestContextGetter();
+}
+
+net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia(
+ int renderer_child_id) {
+ ExtensionService* extension_service =
+ extensions::ExtensionSystem::Get(this)->extension_service();
+ if (extension_service) {
+ const extensions::Extension* installed_app = extension_service->
+ GetInstalledAppForRenderer(renderer_child_id);
+ if (installed_app != NULL && installed_app->is_storage_isolated())
awong 2012/08/20 19:46:28 nit: I think this is more often written as: if (
Charlie Reis 2012/08/20 20:21:01 Done, here and above.
+ return io_data_.GetIsolatedMediaRequestContextGetter(installed_app->id());
+ }
+
+ content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
+ renderer_child_id);
+ if (rph && rph->IsGuest()) {
+ // For guest processes (used by the browser tag), we need to isolate the
+ // storage.
+ // TODO(nasko): Until we have proper storage partitions, create a
+ // non-persistent context using the RPH's id.
+ std::string id("guest-");
+ id.append(base::IntToString(renderer_child_id));
+ return io_data_.GetIsolatedMediaRequestContextGetter(id);
+ }
+
return io_data_.GetMediaRequestContextGetter();
}

Powered by Google App Engine
This is Rietveld 408576698