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

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