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