| 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/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 728 } | 728 } |
| 729 | 729 |
| 730 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { | 730 net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| 731 return io_data_.GetMainRequestContextGetter(); | 731 return io_data_.GetMainRequestContextGetter(); |
| 732 } | 732 } |
| 733 | 733 |
| 734 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( | 734 net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| 735 int renderer_child_id) { | 735 int renderer_child_id) { |
| 736 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 736 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 737 renderer_child_id); | 737 renderer_child_id); |
| 738 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | |
| 739 | 738 |
| 740 // TODO(nasko): Remove this conditional, once webview tag creates a proper | 739 return rph->GetStoragePartition()->GetURLRequestContext(); |
| 741 // storage partition. | |
| 742 if (rph->IsGuest()) { | |
| 743 // For guest processes, we only allow in-memory partitions for now, so | |
| 744 // hardcode the parameter here. | |
| 745 return GetRequestContextForStoragePartition( | |
| 746 storage_partition->GetPath(), true); | |
| 747 } | |
| 748 | |
| 749 return storage_partition->GetURLRequestContext(); | |
| 750 } | 740 } |
| 751 | 741 |
| 752 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { | 742 net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { |
| 753 // Return the default media context. | 743 // Return the default media context. |
| 754 return io_data_.GetMediaRequestContextGetter(); | 744 return io_data_.GetMediaRequestContextGetter(); |
| 755 } | 745 } |
| 756 | 746 |
| 757 net::URLRequestContextGetter* | 747 net::URLRequestContextGetter* |
| 758 ProfileImpl::GetMediaRequestContextForRenderProcess( | 748 ProfileImpl::GetMediaRequestContextForRenderProcess( |
| 759 int renderer_child_id) { | 749 int renderer_child_id) { |
| 760 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( | 750 content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| 761 renderer_child_id); | 751 renderer_child_id); |
| 762 content::StoragePartition* storage_partition = rph->GetStoragePartition(); | 752 content::StoragePartition* storage_partition = rph->GetStoragePartition(); |
| 763 | 753 |
| 764 // TODO(nasko): Remove this conditional, once webview tag creates a proper | |
| 765 // storage partition. | |
| 766 if (rph->IsGuest()) { | |
| 767 // For guest processes, we only allow in-memory partitions for now, so | |
| 768 // hardcode the parameter here. | |
| 769 return GetMediaRequestContextForStoragePartition( | |
| 770 storage_partition->GetPath(), true); | |
| 771 } | |
| 772 | |
| 773 return storage_partition->GetMediaURLRequestContext(); | 754 return storage_partition->GetMediaURLRequestContext(); |
| 774 } | 755 } |
| 775 | 756 |
| 776 net::URLRequestContextGetter* | 757 net::URLRequestContextGetter* |
| 777 ProfileImpl::GetMediaRequestContextForStoragePartition( | 758 ProfileImpl::GetMediaRequestContextForStoragePartition( |
| 778 const FilePath& partition_path, | 759 const FilePath& partition_path, |
| 779 bool in_memory) { | 760 bool in_memory) { |
| 780 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path, | 761 return io_data_.GetIsolatedMediaRequestContextGetter(partition_path, |
| 781 in_memory); | 762 in_memory); |
| 782 } | 763 } |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 if (!path.empty()) | 1095 if (!path.empty()) |
| 1115 *cache_path = path; | 1096 *cache_path = path; |
| 1116 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : | 1097 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : |
| 1117 prefs_->GetInteger(prefs::kDiskCacheSize); | 1098 prefs_->GetInteger(prefs::kDiskCacheSize); |
| 1118 } | 1099 } |
| 1119 | 1100 |
| 1120 base::Callback<ChromeURLDataManagerBackend*(void)> | 1101 base::Callback<ChromeURLDataManagerBackend*(void)> |
| 1121 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { | 1102 ProfileImpl::GetChromeURLDataManagerBackendGetter() const { |
| 1122 return io_data_.GetChromeURLDataManagerBackendGetter(); | 1103 return io_data_.GetChromeURLDataManagerBackendGetter(); |
| 1123 } | 1104 } |
| OLD | NEW |