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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 11147026: Initial refactor to get profiles to propagate storage partition details. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing Android's BrowserContext. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 82376b678b16a665451080510f47755140a3c987..28580b2edb55d72be05c5c1a1143c947a5d6e319 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -735,28 +735,20 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContext() {
net::URLRequestContextGetter* ProfileImpl::GetRequestContextForRenderProcess(
int renderer_child_id) {
- 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());
- }
-
content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
renderer_child_id);
- if (rph && 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);
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
+ // TODO(nasko): Remove this conditional, once browser tag creates a proper
Charlie Reis 2012/10/30 17:47:48 nit: webview tag
nasko 2012/10/30 19:55:25 Done.
+ // storage partition.
+ if (rph->IsGuest()) {
+ // For guest processes, we only allow in-memory partitions for now, so
+ // hardcode the parameter here.
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
}
- return GetRequestContext();
+ return storage_partition->GetURLRequestContext();
}
net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
@@ -767,34 +759,28 @@ net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
net::URLRequestContextGetter*
ProfileImpl::GetMediaRequestContextForRenderProcess(
int renderer_child_id) {
- 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());
- }
-
content::RenderProcessHost* rph = content::RenderProcessHost::FromID(
renderer_child_id);
- if (rph && 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);
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
+ // TODO(nasko): Remove this conditional, once browser tag creates a proper
Charlie Reis 2012/10/30 17:47:48 ditto
nasko 2012/10/30 19:55:25 Done.
+ // storage partition.
+ if (rph->IsGuest()) {
+ // For guest processes, we only allow in-memory partitions for now, so
+ // hardcode the parameter here.
+ return GetMediaRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
}
- return io_data_.GetMediaRequestContextGetter();
+ return storage_partition->GetMediaURLRequestContext();
}
net::URLRequestContextGetter*
ProfileImpl::GetMediaRequestContextForStoragePartition(
- const std::string& partition_id) {
- return io_data_.GetIsolatedMediaRequestContextGetter(partition_id);
+ const FilePath& partition_path,
+ bool in_memory) {
+ return io_data_.GetIsolatedMediaRequestContextGetter(partition_path,
+ in_memory);
}
content::ResourceContext* ProfileImpl::GetResourceContext() {
@@ -806,8 +792,9 @@ net::URLRequestContextGetter* ProfileImpl::GetRequestContextForExtensions() {
}
net::URLRequestContextGetter* ProfileImpl::GetRequestContextForStoragePartition(
- const std::string& partition_id) {
- return io_data_.GetIsolatedAppRequestContextGetter(partition_id);
+ const FilePath& partition_path,
+ bool in_memory) {
+ return io_data_.GetIsolatedAppRequestContextGetter(partition_path, in_memory);
}
net::SSLConfigService* ProfileImpl::GetSSLConfigService() {

Powered by Google App Engine
This is Rietveld 408576698