Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl.cc |
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
| index 735cba8acb25dc9e8cff36bb2870cc7a987155a7..0a273b4b8a5e189e77c05b0c3a9371503fbc045a 100644 |
| --- a/chrome/browser/profiles/profile_impl.cc |
| +++ b/chrome/browser/profiles/profile_impl.cc |
| @@ -62,6 +62,7 @@ |
| #include "chrome/browser/search_engines/template_url_fetcher.h" |
| #include "chrome/browser/sessions/session_service_factory.h" |
| #include "chrome/browser/speech/chrome_speech_recognition_preferences.h" |
| +#include "chrome/browser/storage_partition_details.h" |
| #include "chrome/browser/sync/profile_sync_service_factory.h" |
| #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| @@ -761,25 +762,29 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContext() { |
| net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess( |
| int renderer_child_id) { |
| + content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| + renderer_child_id); |
| + CHECK(rph); |
| + content::StoragePartition* storage_partition = rph->GetStoragePartition(); |
|
awong
2012/10/18 22:36:15
If we're already reading out of the StoragePartiti
nasko
2012/10/19 17:29:14
I'm going to keep the guest check temporarily, unt
awong
2012/10/19 21:20:24
It's more to undersatnd when a function is just de
|
| + |
| ExtensionService* extension_service = |
| extensions::ExtensionSystem::Get(this)->extension_service(); |
| if (extension_service) { |
| const extensions::Extension* extension = |
| extension_service->GetIsolatedAppForRenderer(renderer_child_id); |
| if (extension) |
| - return GetRequestContextForStoragePartition(extension->id()); |
| + return GetRequestContextForStoragePartition( |
| + storage_partition->GetPath(), |
| + storage_partition->IsInMemoryOnly()); |
| } |
| - content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| - renderer_child_id); |
| - if (rph && rph->IsGuest()) { |
| + if (rph->IsGuest()) { |
| // For guest processes (used by the browser tag), we need to isolate the |
| // storage. |
| - // TODO(nasko): Until we have proper storage partitions, create a |
| - // non-persistent context using the RPH's id. |
| - std::string id("guest-"); |
| - id.append(base::IntToString(renderer_child_id)); |
| - return GetRequestContextForStoragePartition(id); |
| + // TODO(nasko): Pass the proper value for in_memory when the browser tag |
| + // is wired properly with storage partition. |
| + return GetRequestContextForStoragePartition( |
| + storage_partition->GetPath(), true); |
| } |
| return GetRequestContext(); |
| @@ -793,25 +798,30 @@ net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() { |
| net::URLRequestContextGetter* |
| ProfileImpl::GetMediaRequestContextForRenderProcess( |
| int renderer_child_id) { |
| + content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
|
awong
2012/10/18 22:36:15
Same comment as for GetRequestContextForRenderProc
nasko
2012/10/19 17:29:14
Done.
|
| + renderer_child_id); |
| + CHECK(rph); |
| + content::StoragePartition* storage_partition = rph->GetStoragePartition(); |
| + |
| ExtensionService* extension_service = |
| extensions::ExtensionSystem::Get(this)->extension_service(); |
| if (extension_service) { |
| const extensions::Extension* extension = |
| extension_service->GetIsolatedAppForRenderer(renderer_child_id); |
| - if (extension) |
| - return io_data_.GetIsolatedMediaRequestContextGetter(extension->id()); |
| + if (extension) { |
| + StoragePartitionDetails details(storage_partition->GetPath(), |
| + storage_partition->IsInMemoryOnly()); |
|
awong
2012/10/18 22:36:15
Wouldn't it be cleaner to just keep this struct in
nasko
2012/10/19 17:29:14
Done.
|
| + return io_data_.GetIsolatedMediaRequestContextGetter(details); |
| + } |
| } |
| - content::RenderProcessHost* rph = content::RenderProcessHost::FromID( |
| - renderer_child_id); |
| - if (rph && rph->IsGuest()) { |
| + if (rph->IsGuest()) { |
| // For guest processes (used by the browser tag), we need to isolate the |
| // storage. |
| - // TODO(nasko): Until we have proper storage partitions, create a |
| - // non-persistent context using the RPH's id. |
| - std::string id("guest-"); |
| - id.append(base::IntToString(renderer_child_id)); |
| - return io_data_.GetIsolatedMediaRequestContextGetter(id); |
| + // TODO(nasko): Pass the proper value for in_memory when the browser tag |
| + // is wired properly with storage partition. |
| + StoragePartitionDetails details(storage_partition->GetPath(), true); |
| + return io_data_.GetIsolatedMediaRequestContextGetter(details); |
| } |
| return io_data_.GetMediaRequestContextGetter(); |
| @@ -819,8 +829,10 @@ ProfileImpl::GetMediaRequestContextForRenderProcess( |
| net::URLRequestContextGetter* |
| ProfileImpl::GetMediaRequestContextForStoragePartition( |
| - const std::string& partition_id) { |
| - return io_data_.GetIsolatedMediaRequestContextGetter(partition_id); |
| + const FilePath& partition_path, |
| + const bool& in_memory) { |
| + StoragePartitionDetails details(partition_path, in_memory); |
| + return io_data_.GetIsolatedMediaRequestContextGetter(details); |
| } |
| content::ResourceContext* ProfileImpl::GetResourceContext() { |
| @@ -832,8 +844,10 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() { |
| } |
| net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition( |
| - const std::string& partition_id) { |
| - return io_data_.GetIsolatedAppRequestContextGetter(partition_id); |
| + const FilePath& partition_path, |
| + const bool& in_memory) { |
| + StoragePartitionDetails details(partition_path, in_memory); |
| + return io_data_.GetIsolatedAppRequestContextGetter(details); |
| } |
| net::SSLConfigService* ProfileImpl::GetSSLConfigService() { |