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

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: Fixed the order in the gypi file. 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 735cba8acb25dc9e8cff36bb2870cc7a987155a7..0f4b8a077d509a4c685abc1838d37916f3d3c6ca 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -761,28 +761,19 @@ 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);
+ CHECK(rph);
awong 2012/10/29 23:37:40 remove CHECK() since you immediately use it below.
nasko 2012/10/30 00:32:59 Done.
+ content::StoragePartition* storage_partition = rph->GetStoragePartition();
+
+ // TODO(nasko): Remove this conditional, once browser tag creates a proper
+ // storage partition.
+ if (rph->IsGuest()) {
+ return GetRequestContextForStoragePartition(
+ storage_partition->GetPath(), true);
awong 2012/10/29 23:37:40 Add a comment explaining the current behavior. I
nasko 2012/10/30 00:32:59 Done.
}
- return GetRequestContext();
+ return storage_partition->GetURLRequestContext();
}
net::URLRequestContextGetter* ProfileImpl::GetMediaRequestContext() {
@@ -793,34 +784,26 @@ 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
+ // storage partition.
+ if (rph->IsGuest()) {
+ return GetRequestContextForStoragePartition(
awong 2012/10/29 23:37:40 Should this somehow get the MediaRequestContext?
nasko 2012/10/30 00:32:59 Oh, good catch! It should be getting the media con
+ 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() {
@@ -832,8 +815,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