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

Unified Diff: chrome/browser/chrome_content_browser_client.cc

Issue 15017018: Prevent unauthorized commits of the Chrome Web Store URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment Created 7 years, 7 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 24403ca7f90c2fe1c066cbc181245ddee16a349e..0abbc1add2b430cabfca725b42511788432001f1 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -882,6 +882,33 @@ bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) {
return ProfileIOData::IsHandledURL(url);
}
+bool ChromeContentBrowserClient::CanCommitURL(
+ content::RenderProcessHost* process_host,
+ const GURL& url) {
+ // We need to let most extension URLs commit in any process, since this can
+ // be allowed due to web_accessible_resources. Most hosted app URLs may also
+ // load in any process (e.g., in an iframe). However, the Chrome Web Store
+ // cannot be loaded in iframes and should never be requested outside its
+ // process.
+ Profile* profile =
+ Profile::FromBrowserContext(process_host->GetBrowserContext());
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ if (!service)
+ return true;
+ const Extension* new_extension =
+ service->extensions()->GetExtensionOrAppByURL(ExtensionURLInfo(url));
+ if (new_extension &&
+ new_extension->is_hosted_app() &&
+ new_extension->id() == extension_misc::kWebStoreAppId &&
+ !service->process_map()->Contains(new_extension->id(),
+ process_host->GetID())) {
+ return false;
+ }
+
+ return true;
+}
+
bool ChromeContentBrowserClient::IsSuitableHost(
content::RenderProcessHost* process_host,
const GURL& site_url) {
« no previous file with comments | « chrome/browser/chrome_content_browser_client.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698