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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 11308024: Fixing guest processes to use the proper storage partition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment to test. 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/chrome_content_browser_client.cc
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index c755dc03e2f75c23cfe5d7160613152a8f52ea71..796761483ff45673358afe90463c8e8fd6bce0e0 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -491,6 +491,9 @@ std::string ChromeContentBrowserClient::GetStoragePartitionIdForChildProcess(
std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite(
content::BrowserContext* browser_context,
const GURL& site) {
+ if (site.SchemeIs(chrome::kGuestScheme))
Nico 2012/10/31 01:26:05 "guest" means "a process embedded in another proce
+ return "guest-" + site.host();
+
const Extension* extension = NULL;
Profile* profile = Profile::FromBrowserContext(browser_context);
ExtensionService* extension_service =
@@ -1604,10 +1607,16 @@ void ChromeContentBrowserClient::OverrideWebkitPrefs(
chrome::ViewType view_type = chrome::GetViewType(web_contents);
ExtensionService* service = profile->GetExtensionService();
if (service) {
- const Extension* extension = service->extensions()->GetByID(
- rvh->GetSiteInstance()->GetSiteURL().host());
- extension_webkit_preferences::SetPreferences(
- extension, view_type, web_prefs);
+ const GURL& url = rvh->GetSiteInstance()->GetSiteURL();
+ // Ensure that we are only granting extension preferences to URLs with the
+ // correct scheme. Without this check, guest:// schemes used by webview
+ // tags as well as hosts that happen to match the id of an install extension
+ // would get the wrong preferences.
+ if (url.SchemeIs(chrome::kExtensionScheme)) {
+ const Extension* extension = service->extensions()->GetByID(url.host());
+ extension_webkit_preferences::SetPreferences(
+ extension, view_type, web_prefs);
+ }
}
if (content::IsForceCompositingModeEnabled())
« no previous file with comments | « no previous file | chrome/browser/extensions/web_view_browsertest.cc » ('j') | chrome/browser/profiles/profile_impl_io_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698