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

Side by Side 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: Initial version 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 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 return io_data_.GetMainRequestContextGetter(); 676 return io_data_.GetMainRequestContextGetter();
677 } 677 }
678 678
679 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( 679 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
680 int renderer_child_id) { 680 int renderer_child_id) {
681 ExtensionService* extension_service = 681 ExtensionService* extension_service =
682 extensions::ExtensionSystem::Get(this)->extension_service(); 682 extensions::ExtensionSystem::Get(this)->extension_service();
683 if (extension_service) { 683 if (extension_service) {
684 const extensions::Extension* installed_app = extension_service-> 684 const extensions::Extension* installed_app = extension_service->
685 GetInstalledAppForRenderer(renderer_child_id); 685 GetInstalledAppForRenderer(renderer_child_id);
686 if (installed_app != NULL && installed_app->is_storage_isolated()) { 686 if (installed_app != NULL && installed_app->is_storage_isolated())
687 return GetRequestContextForIsolatedApp(installed_app->id()); 687 return GetRequestContextForIsolatedApp(installed_app->id());
688 }
689 } 688 }
690 689
691 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( 690 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
692 renderer_child_id); 691 renderer_child_id);
693 if (rph && rph->IsGuest()) { 692 if (rph && rph->IsGuest()) {
694 // For guest processes (used by the browser tag), we need to isolate the 693 // For guest processes (used by the browser tag), we need to isolate the
695 // storage. 694 // storage.
696 // TODO(nasko): Until we have proper storage partitions, create a 695 // TODO(nasko): Until we have proper storage partitions, create a
697 // non-persistent context using the RPH's id. 696 // non-persistent context using the RPH's id.
698 std::string id("guest-"); 697 std::string id("guest-");
699 id.append(base::IntToString(renderer_child_id)); 698 id.append(base::IntToString(renderer_child_id));
700 return GetRequestContextForIsolatedApp(id); 699 return GetRequestContextForIsolatedApp(id);
701 } 700 }
702 701
703 return GetRequestContext(); 702 return GetRequestContext();
704 } 703 }
705 704
706 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia() { 705 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForMedia(
706 int renderer_child_id) {
707 ExtensionService* extension_service =
708 extensions::ExtensionSystem::Get(this)->extension_service();
709 if (extension_service) {
710 const extensions::Extension* installed_app = extension_service->
711 GetInstalledAppForRenderer(renderer_child_id);
712 if (installed_app != NULL && installed_app->is_storage_isolated())
713 return io_data_.GetIsolatedMediaRequestContextGetter(installed_app->id());
714 }
715
716 content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
717 renderer_child_id);
718 if (rph && rph->IsGuest()) {
719 // For guest processes (used by the browser tag), we need to isolate the
720 // storage.
721 // TODO(nasko): Until we have proper storage partitions, create a
722 // non-persistent context using the RPH's id.
723 std::string id("guest-");
724 id.append(base::IntToString(renderer_child_id));
725 return io_data_.GetIsolatedMediaRequestContextGetter(id);
726 }
727
707 return io_data_.GetMediaRequestContextGetter(); 728 return io_data_.GetMediaRequestContextGetter();
708 } 729 }
709 730
710 content::ResourceContext* ProfileImpl::GetResourceContext() { 731 content::ResourceContext* ProfileImpl::GetResourceContext() {
711 return io_data_.GetResourceContext(); 732 return io_data_.GetResourceContext();
712 } 733 }
713 734
714 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) { 735 FaviconService* ProfileImpl::GetFaviconService(ServiceAccessType sat) {
715 if (!favicon_service_created_) { 736 if (!favicon_service_created_) {
716 favicon_service_created_ = true; 737 favicon_service_created_ = true;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 if (!path.empty()) 1096 if (!path.empty())
1076 *cache_path = path; 1097 *cache_path = path;
1077 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1098 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1078 prefs_->GetInteger(prefs::kDiskCacheSize); 1099 prefs_->GetInteger(prefs::kDiskCacheSize);
1079 } 1100 }
1080 1101
1081 base::Callback<ChromeURLDataManagerBackend*(void)> 1102 base::Callback<ChromeURLDataManagerBackend*(void)>
1082 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { 1103 ProfileImpl::GetChromeURLDataManagerBackendGetter() const {
1083 return io_data_.GetChromeURLDataManagerBackendGetter(); 1104 return io_data_.GetChromeURLDataManagerBackendGetter();
1084 } 1105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698