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

Unified Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 2463153003: Revert of [Extensions] Limit Extension WebUI (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 5ccd82ac30b10d8c1af19e4b42aae1ad7258a972..53e9ea51637328d1bcd70dbfd6a275d05264c6d5 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -285,6 +285,23 @@
}
#endif // defined(OS_WIN)
+#if defined(ENABLE_EXTENSIONS)
+// Only create ExtensionWebUI for URLs that are allowed extension bindings,
+// hosted by actual tabs.
+bool NeedsExtensionWebUI(Profile* profile, const GURL& url) {
+ if (!profile)
+ return false;
+
+ const extensions::Extension* extension =
+ extensions::ExtensionRegistry::Get(profile)->enabled_extensions().
+ GetExtensionOrAppByURL(url);
+ // Allow bindings for all packaged extensions and component hosted apps.
+ return extension &&
+ (!extension->is_hosted_app() ||
+ extension->location() == extensions::Manifest::COMPONENT);
+}
+#endif
+
bool IsAboutUI(const GURL& url) {
return (url.host() == chrome::kChromeUIChromeURLsHost ||
url.host() == chrome::kChromeUICreditsHost ||
@@ -312,7 +329,7 @@
Profile* profile,
const GURL& url) {
#if defined(ENABLE_EXTENSIONS)
- if (ExtensionWebUI::NeedsExtensionWebUI(profile, url))
+ if (NeedsExtensionWebUI(profile, url))
return &NewWebUI<ExtensionWebUI>;
#endif
@@ -675,7 +692,7 @@
// Extensions are rendered via WebUI in tabs, but don't actually need WebUI
// bindings (see the ExtensionWebUI constructor).
needs_extensions_web_ui =
- ExtensionWebUI::NeedsExtensionWebUI(browser_context, url);
+ NeedsExtensionWebUI(Profile::FromBrowserContext(browser_context), url);
#endif
return !needs_extensions_web_ui && UseWebUIForURL(browser_context, url);
}
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698