| 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);
|
| }
|
|
|