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

Unified Diff: chrome/browser/extensions/extension_web_ui.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
Index: chrome/browser/extensions/extension_web_ui.cc
diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc
index d472a5ea43f28d377ab024732ae9e5b33281f2a8..024282ec85ba4d3bfad8881a86543d9e9cd08b31 100644
--- a/chrome/browser/extensions/extension_web_ui.cc
+++ b/chrome/browser/extensions/extension_web_ui.cc
@@ -333,12 +333,12 @@
"extensions.chrome_url_overrides";
ExtensionWebUI::ExtensionWebUI(content::WebUI* web_ui, const GURL& url)
- : WebUIController(web_ui) {
+ : WebUIController(web_ui),
+ url_(url) {
Profile* profile = Profile::FromWebUI(web_ui);
const Extension* extension = extensions::ExtensionRegistry::Get(
profile)->enabled_extensions().GetExtensionOrAppByURL(url);
DCHECK(extension);
- DCHECK_EQ(extension_misc::kBookmarkManagerId, extension->id());
// The base class defaults to enabling WebUI bindings, but we don't need
// those (this is also reflected in ChromeWebUIControllerFactory::
@@ -347,26 +347,20 @@
web_ui->SetBindings(bindings);
// Hack: A few things we specialize just for the bookmark manager.
- bookmark_manager_private_drag_event_router_.reset(
- new extensions::BookmarkManagerPrivateDragEventRouter(
- profile, web_ui->GetWebContents()));
-
- web_ui->SetLinkTransitionType(ui::PAGE_TRANSITION_AUTO_BOOKMARK);
+ if (extension->id() == extension_misc::kBookmarkManagerId) {
+ bookmark_manager_private_drag_event_router_.reset(
+ new extensions::BookmarkManagerPrivateDragEventRouter(
+ profile, web_ui->GetWebContents()));
+
+ web_ui->SetLinkTransitionType(ui::PAGE_TRANSITION_AUTO_BOOKMARK);
+ }
}
ExtensionWebUI::~ExtensionWebUI() {}
-// static
-bool ExtensionWebUI::NeedsExtensionWebUI(
- content::BrowserContext* browser_context,
- const GURL& url) {
- CHECK(browser_context);
- const Extension* extension =
- extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions().
- GetExtensionOrAppByURL(url);
- // Only use bindings for the Bookmark Manager extension, which needs it as a
- // hack (see ExtensionWebUI's constructor below).
- return extension && extension->id() == extension_misc::kBookmarkManagerId;
+extensions::BookmarkManagerPrivateDragEventRouter*
+ExtensionWebUI::bookmark_manager_private_drag_event_router() {
+ return bookmark_manager_private_drag_event_router_.get();
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/extensions/extension_web_ui.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_context_menu_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698