| 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 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 } | 767 } |
| 768 | 768 |
| 769 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 769 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 770 return io_data_.GetMainRequestContextGetter(); | 770 return io_data_.GetMainRequestContextGetter(); |
| 771 } | 771 } |
| 772 | 772 |
| 773 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 773 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 774 int renderer_child_id) { | 774 int renderer_child_id) { |
| 775 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 775 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 776 renderer_child_id); | 776 renderer_child_id); |
| 777 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | |
| 778 | 777 |
| 779 // TODO(nasko): Remove this conditional, once webview tag creates a proper | 778 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 780 // storage partition. | |
| 781 if (rph->IsGuest()) { | |
| 782 // For guest processes, we only allow in-memory partitions for now, so | |
| 783 // hardcode the parameter here. | |
| 784 return GetRequestContextForStoragePartition( | |
| 785 storage_partition->GetPath(), true); | |
| 786 } | |
| 787 | |
| 788 return storage_partition->GetURLRequestContext(); | |
| 789 } | 779 } |
| 790 | 780 |
| 791 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { | 781 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { |
| 792 // Return the default media context. | 782 // Return the default media context. |
| 793 return io_data_.GetMediaRequestContextGetter(); | 783 return io_data_.GetMediaRequestContextGetter(); |
| 794 } | 784 } |
| 795 | 785 |
| 796 net::URLRequestContextGetter* | 786 net::URLRequestContextGetter* |
| 797 ProfileImpl::GetMediaRequestContextForRenderProcess( | 787 ProfileImpl::GetMediaRequestContextForRenderProcess( |
| 798 int renderer_child_id) { | 788 int renderer_child_id) { |
| 799 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 789 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 800 renderer_child_id); | 790 renderer_child_id); |
| 801 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | 791 content::StoragePartition* storage_partition = rph->GetStoragePartition(); |
| 802 | 792 |
| 803 // TODO(nasko): Remove this conditional, once webview tag creates a proper | |
| 804 // storage partition. | |
| 805 if (rph->IsGuest()) { | |
| 806 // For guest processes, we only allow in-memory partitions for now, so | |
| 807 // hardcode the parameter here. | |
| 808 return GetMediaRequestContextForStoragePartition( | |
| 809 storage_partition->GetPath(), true); | |
| 810 } | |
| 811 | |
| 812 return storage_partition->GetMediaURLRequestContext(); | 793 return storage_partition->GetMediaURLRequestContext(); |
| 813 } | 794 } |
| 814 | 795 |
| 815 net::URLRequestContextGetter* | 796 net::URLRequestContextGetter* |
| 816 ProfileImpl::GetMediaRequestContextForStoragePartition( | 797 ProfileImpl::GetMediaRequestContextForStoragePartition( |
| 817 const FilePath& partition_path, | 798 const FilePath& partition_path, |
| 818 bool in_memory) { | 799 bool in_memory) { |
| 819 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path, | 800 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path, |
| 820 in_memory); | 801 in_memory); |
| 821 } | 802 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 if (!path.empty()) | 1144 if (!path.empty()) |
| 1164 *cache_path = path; | 1145 *cache_path = path; |
| 1165 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1146 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1166 prefs_->GetInteger(prefs::kDiskCacheSize); | 1147 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1167 } | 1148 } |
| 1168 | 1149 |
| 1169 base::Callback<ChromeURLDataManagerBackend*(void)> | 1150 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1170 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1151 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1171 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1152 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1172 } | 1153 } |
| OLD | NEW |