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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 11783038: Allow multiple WebUIControllerFactory objects to be registered. This makes is possible to implement… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: reland after bogus revert of r175971 Created 7 years, 11 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: content/browser/web_contents/web_contents_impl.cc
===================================================================
--- content/browser/web_contents/web_contents_impl.cc (revision 179096)
+++ content/browser/web_contents/web_contents_impl.cc (working copy)
@@ -37,6 +37,7 @@
#include "content/browser/web_contents/interstitial_page_impl.h"
#include "content/browser/web_contents/navigation_entry_impl.h"
#include "content/browser/web_contents/web_contents_view_guest.h"
+#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/browser_plugin_messages.h"
#include "content/common/icon_messages.h"
@@ -65,7 +66,6 @@
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_view.h"
-#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_restriction.h"
@@ -856,13 +856,9 @@
}
WebUI* WebContentsImpl::CreateWebUI(const GURL& url) {
- WebUIControllerFactory* factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
- if (!factory)
- return NULL;
WebUIImpl* web_ui = new WebUIImpl(this);
- WebUIController* controller =
- factory->CreateWebUIControllerForURL(web_ui, url);
+ WebUIController* controller = WebUIControllerFactoryRegistry::GetInstance()->
+ CreateWebUIControllerForURL(web_ui, url);
if (controller) {
web_ui->SetController(controller);
return web_ui;
@@ -1630,13 +1626,10 @@
// For security, we should never send non-Web-UI URLs to a Web UI renderer.
// Double check that here.
int enabled_bindings = dest_render_view_host->GetEnabledBindings();
- WebUIControllerFactory* factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
bool data_urls_allowed = delegate_ && delegate_->CanLoadDataURLsInWebUI();
bool is_allowed_in_web_ui_renderer =
- factory &&
- factory->IsURLAcceptableForWebUI(GetBrowserContext(), entry.GetURL(),
- data_urls_allowed);
+ WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI(
+ GetBrowserContext(), entry.GetURL(), data_urls_allowed);
if ((enabled_bindings & BINDINGS_POLICY_WEB_UI) &&
!is_allowed_in_web_ui_renderer) {
// Log the URL to help us diagnose any future failures of this CHECK.
@@ -1913,11 +1906,8 @@
}
WebUI::TypeID WebContentsImpl::GetWebUITypeForCurrentState() {
- WebUIControllerFactory* factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
- if (!factory)
- return WebUI::kNoWebUI;
- return factory->GetWebUIType(GetBrowserContext(), GetURL());
+ return WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
+ GetBrowserContext(), GetURL());
}
WebUI* WebContentsImpl::GetWebUIForCurrentState() {

Powered by Google App Engine
This is Rietveld 408576698