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

Unified Diff: content/browser/web_contents/render_view_host_manager.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/render_view_host_manager.cc
===================================================================
--- content/browser/web_contents/render_view_host_manager.cc (revision 179096)
+++ content/browser/web_contents/render_view_host_manager.cc (working copy)
@@ -16,6 +16,7 @@
#include "content/browser/web_contents/interstitial_page_impl.h"
#include "content/browser/web_contents/navigation_controller_impl.h"
#include "content/browser/web_contents/navigation_entry_impl.h"
+#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/view_messages.h"
#include "content/port/browser/render_widget_host_view_port.h"
@@ -24,7 +25,6 @@
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_ui_controller.h"
-#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
@@ -414,20 +414,20 @@
render_view_host_->GetSiteInstance()->GetSiteURL();
BrowserContext* browser_context =
delegate_->GetControllerForRenderManager().GetBrowserContext();
- const WebUIControllerFactory* web_ui_factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
- if (web_ui_factory) {
- if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) {
- // Force swap if it's not an acceptable URL for Web UI.
- // Here, data URLs are never allowed.
- if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context,
- new_entry->GetURL(), false))
- return true;
- } else {
- // Force swap if it's a Web UI URL.
- if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL()))
- return true;
+ if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
+ browser_context, current_url)) {
+ // Force swap if it's not an acceptable URL for Web UI.
+ // Here, data URLs are never allowed.
+ if (!WebUIControllerFactoryRegistry::GetInstance()->IsURLAcceptableForWebUI(
+ browser_context, new_entry->GetURL(), false)) {
+ return true;
}
+ } else {
+ // Force swap if it's a Web UI URL.
+ if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
+ browser_context, new_entry->GetURL())) {
+ return true;
+ }
}
if (GetContentClient()->browser()->ShouldSwapProcessesForNavigation(
@@ -453,13 +453,11 @@
const NavigationEntryImpl* new_entry) const {
NavigationControllerImpl& controller =
delegate_->GetControllerForRenderManager();
- WebUIControllerFactory* factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
return curr_entry && web_ui_.get() &&
- (factory->GetWebUIType(controller.GetBrowserContext(),
- curr_entry->GetURL()) ==
- factory->GetWebUIType(controller.GetBrowserContext(),
- new_entry->GetURL()));
+ (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
+ controller.GetBrowserContext(), curr_entry->GetURL()) ==
+ WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
+ controller.GetBrowserContext(), new_entry->GetURL()));
}
SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
@@ -534,10 +532,8 @@
// If we are navigating from a blank SiteInstance to a WebUI, make sure we
// create a new SiteInstance.
- const WebUIControllerFactory* web_ui_factory =
- GetContentClient()->browser()->GetWebUIControllerFactory();
- if (web_ui_factory &&
- web_ui_factory->UseWebUIForURL(browser_context, dest_url)) {
+ if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIForURL(
+ browser_context, dest_url)) {
return SiteInstance::CreateForURL(browser_context, dest_url);
}
« no previous file with comments | « content/browser/site_instance_impl_unittest.cc ('k') | content/browser/web_contents/render_view_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698