summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 02:05:50 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-27 02:05:50 +0000
commit863f70aa8b46421f442a089b21e1bd97a446785c (patch)
treed3468b7ab02aaaf80c7602e7c671ea37dc7672f1 /content
parenta3b85d85e73b838e5bc6599a779a6a725980ce6e (diff)
downloadchromium_src-863f70aa8b46421f442a089b21e1bd97a446785c.zip
chromium_src-863f70aa8b46421f442a089b21e1bd97a446785c.tar.gz
chromium_src-863f70aa8b46421f442a089b21e1bd97a446785c.tar.bz2
Rename WebUIFactory to WebUIControllerFactory since that's what it creates now.
I've removed EmptyWebUIFactory, since that doesn't fit in well with Content API now. There were only a few places in the code that called it, and handling NULL wasn't much work. BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9288074 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119341 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/browsing_instance.cc8
-rw-r--r--content/browser/mock_content_browser_client.cc6
-rw-r--r--content/browser/mock_content_browser_client.h2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc12
-rw-r--r--content/browser/site_instance_impl_unittest.cc36
-rw-r--r--content/browser/tab_contents/render_view_host_manager.cc27
-rw-r--r--content/browser/tab_contents/render_view_host_manager_unittest.cc37
-rw-r--r--content/browser/tab_contents/tab_contents.cc25
-rw-r--r--content/browser/tab_contents/tab_contents_unittest.cc32
-rw-r--r--content/browser/webui/empty_web_ui_factory.cc50
-rw-r--r--content/browser/webui/empty_web_ui_factory.h42
-rw-r--r--content/content_browser.gypi4
-rw-r--r--content/public/browser/content_browser_client.h7
-rw-r--r--content/public/browser/web_ui_controller_factory.h (renamed from content/public/browser/web_ui_factory.h)22
-rw-r--r--content/shell/shell_content_browser_client.cc6
-rw-r--r--content/shell/shell_content_browser_client.h2
16 files changed, 141 insertions, 177 deletions
diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc
index b82ef96..ae42e29 100644
--- a/content/browser/browsing_instance.cc
+++ b/content/browser/browsing_instance.cc
@@ -9,11 +9,12 @@
#include "content/browser/site_instance_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/content_browser_client.h"
-#include "content/public/browser/web_ui_factory.h"
+#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
using content::SiteInstance;
+using content::WebUIControllerFactory;
// static
base::LazyInstance<BrowsingInstance::ContextSiteInstanceMap>::Leaky
@@ -43,8 +44,9 @@ bool BrowsingInstance::ShouldUseProcessPerSite(const GURL& url) {
return true;
// DevTools pages have WebUI type but should not reuse the same host.
- if (content::GetContentClient()->browser()->GetWebUIFactory()->
- UseWebUIForURL(browser_context_, url) &&
+ WebUIControllerFactory* factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ if (factory && factory->UseWebUIForURL(browser_context_, url) &&
!url.SchemeIs(chrome::kChromeDevToolsScheme)) {
return true;
}
diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc
index 87614a2..34e05a7 100644
--- a/content/browser/mock_content_browser_client.cc
+++ b/content/browser/mock_content_browser_client.cc
@@ -8,7 +8,6 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/test/test_web_contents_view.h"
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -41,9 +40,8 @@ void MockContentBrowserClient::RenderProcessHostCreated(
RenderProcessHost* host) {
}
-WebUIFactory* MockContentBrowserClient::GetWebUIFactory() {
- // Return an empty factory so callsites don't have to check for NULL.
- return EmptyWebUIFactory::GetInstance();
+WebUIControllerFactory* MockContentBrowserClient::GetWebUIControllerFactory() {
+ return NULL;
}
GURL MockContentBrowserClient::GetEffectiveURL(
diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h
index b441703..1502c2f 100644
--- a/content/browser/mock_content_browser_client.h
+++ b/content/browser/mock_content_browser_client.h
@@ -29,7 +29,7 @@ class MockContentBrowserClient : public ContentBrowserClient {
RenderViewHost* render_view_host) OVERRIDE;
virtual void RenderProcessHostCreated(
RenderProcessHost* host) OVERRIDE;
- virtual WebUIFactory* GetWebUIFactory() OVERRIDE;
+ virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE;
virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
const GURL& url) OVERRIDE;
virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context,
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 38103c9..2c291d7 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -89,7 +89,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/user_metrics.h"
-#include "content/public/browser/web_ui_factory.h"
+#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/process_type.h"
@@ -119,6 +119,7 @@ using content::BrowserThread;
using content::ChildProcessHost;
using content::ChildProcessHostImpl;
using content::UserMetricsAction;
+using content::WebUIControllerFactory;
// This class creates the IO thread for the renderer when running in
// single-process mode. It's not used in multi-process mode.
@@ -1092,11 +1093,14 @@ bool RenderProcessHostImpl::IsSuitableHost(
if (host->GetBrowserContext() != browser_context)
return false;
- if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
+ WebUIControllerFactory* factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ if (factory &&
+ ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(
host->GetID()) !=
- content::GetContentClient()->browser()->GetWebUIFactory()->
- UseWebUIBindingsForURL(browser_context, site_url))
+ factory->UseWebUIBindingsForURL(browser_context, site_url)) {
return false;
+ }
return content::GetContentClient()->browser()->IsSuitableHost(host, site_url);
}
diff --git a/content/browser/site_instance_impl_unittest.cc b/content/browser/site_instance_impl_unittest.cc
index f45baf7..77ae33c 100644
--- a/content/browser/site_instance_impl_unittest.cc
+++ b/content/browser/site_instance_impl_unittest.cc
@@ -15,7 +15,7 @@
#include "content/browser/site_instance_impl.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/tab_contents.h"
-#include "content/browser/webui/empty_web_ui_factory.h"
+#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/url_constants.h"
@@ -23,11 +23,14 @@
#include "googleurl/src/url_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+using content::BrowserContext;
using content::BrowserThread;
using content::BrowserThreadImpl;
using content::NavigationEntry;
using content::NavigationEntryImpl;
using content::SiteInstance;
+using content::WebUI;
+using content::WebUIController;
namespace {
@@ -35,19 +38,32 @@ const char kSameAsAnyInstanceURL[] = "about:internets";
const char kPrivilegedScheme[] = "privileged";
-class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory {
+class SiteInstanceTestWebUIControllerFactory
+ : public content::WebUIControllerFactory {
public:
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
+ virtual WebUIController* CreateWebUIControllerForURL(
+ WebUI* web_ui, const GURL& url) const OVERRIDE {
+ return NULL;
+ }
+ virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return WebUI::kNoWebUI;
+ }
+ virtual bool UseWebUIForURL(BrowserContext* browser_context,
const GURL& url) const OVERRIDE {
return HasWebUIScheme(url);
}
- virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
+ virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context,
const GURL& url) const OVERRIDE {
return HasWebUIScheme(url);
}
virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
return url.SchemeIs(chrome::kChromeUIScheme);
}
+ virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return false;
+ }
};
class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient {
@@ -56,11 +72,12 @@ class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient {
: privileged_process_id_(-1) {
}
- virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE {
+ virtual content::WebUIControllerFactory*
+ GetWebUIControllerFactory() OVERRIDE {
return &factory_;
}
- virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
+ virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context,
const GURL& effective_url) OVERRIDE {
return false;
}
@@ -81,7 +98,7 @@ class SiteInstanceTestBrowserClient : public content::MockContentBrowserClient {
}
private:
- SiteInstanceTestWebUIFactory factory_;
+ SiteInstanceTestWebUIControllerFactory factory_;
int privileged_process_id_;
};
@@ -117,8 +134,7 @@ class SiteInstanceTest : public testing::Test {
class TestBrowsingInstance : public BrowsingInstance {
public:
- TestBrowsingInstance(content::BrowserContext* browser_context,
- int* delete_counter)
+ TestBrowsingInstance(BrowserContext* browser_context, int* delete_counter)
: BrowsingInstance(browser_context),
use_process_per_site_(false),
delete_counter_(delete_counter) {
@@ -156,7 +172,7 @@ class TestBrowsingInstance : public BrowsingInstance {
class TestSiteInstance : public SiteInstanceImpl {
public:
static TestSiteInstance* CreateTestSiteInstance(
- content::BrowserContext* browser_context,
+ BrowserContext* browser_context,
int* site_delete_counter,
int* browsing_delete_counter) {
TestBrowsingInstance* browsing_instance =
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index f517479..30c6396b 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -23,7 +23,7 @@
#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_ui_controller.h"
-#include "content/public/browser/web_ui_factory.h"
+#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
@@ -31,6 +31,7 @@ using content::NavigationController;
using content::NavigationEntry;
using content::NavigationEntryImpl;
using content::SiteInstance;
+using content::WebUIControllerFactory;
RenderViewHostManager::RenderViewHostManager(
content::RenderViewHostDelegate* render_view_delegate,
@@ -349,17 +350,19 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
render_view_host_->site_instance()->GetSite();
content::BrowserContext* browser_context =
delegate_->GetControllerForRenderManager().GetBrowserContext();
- const content::WebUIFactory* web_ui_factory =
- content::GetContentClient()->browser()->GetWebUIFactory();
- if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) {
- // Force swap if it's not an acceptable URL for Web UI.
- if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context,
- new_entry->GetURL()))
- return true;
- } else {
- // Force swap if it's a Web UI URL.
- if (web_ui_factory->UseWebUIForURL(browser_context, new_entry->GetURL()))
- return true;
+ const WebUIControllerFactory* web_ui_factory =
+ content::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.
+ if (!web_ui_factory->IsURLAcceptableForWebUI(browser_context,
+ new_entry->GetURL()))
+ 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 (content::GetContentClient()->browser()->ShouldSwapProcessesForNavigation(
diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc
index 78e3e5d..978fe90 100644
--- a/content/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -11,13 +11,13 @@
#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/render_view_host_manager.h"
#include "content/browser/tab_contents/test_tab_contents.h"
-#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/common/test_url_constants.h"
#include "content/common/view_messages.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_ui_controller.h"
+#include "content/public/browser/web_ui_controller_factory.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/url_constants.h"
#include "content/test/test_browser_context.h"
@@ -26,6 +26,7 @@
#include "googleurl/src/url_util.h"
#include "webkit/glue/webkit_glue.h"
+using content::BrowserContext;
using content::BrowserThread;
using content::BrowserThreadImpl;
using content::NavigationController;
@@ -33,38 +34,44 @@ using content::NavigationEntry;
using content::NavigationEntryImpl;
using content::SiteInstance;
using content::WebContents;
+using content::WebUI;
using content::WebUIController;
namespace {
const char kChromeUISchemeButNotWebUIURL[] = "chrome://not-webui";
-class RenderViewHostManagerTestWebUIFactory
- : public content::EmptyWebUIFactory {
+class RenderViewHostManagerTestWebUIControllerFactory
+ : public content::WebUIControllerFactory {
public:
- RenderViewHostManagerTestWebUIFactory()
+ RenderViewHostManagerTestWebUIControllerFactory()
: should_create_webui_(false) {
}
- virtual ~RenderViewHostManagerTestWebUIFactory() {}
+ virtual ~RenderViewHostManagerTestWebUIControllerFactory() {}
void set_should_create_webui(bool should_create_webui) {
should_create_webui_ = should_create_webui;
}
// WebUIFactory implementation.
- virtual WebUIController* CreateWebUIForURL(content::WebUI* web_ui,
- const GURL& url) const OVERRIDE {
+ virtual WebUIController* CreateWebUIControllerForURL(
+ WebUI* web_ui, const GURL& url) const OVERRIDE {
if (!(should_create_webui_ && HasWebUIScheme(url)))
return NULL;
return new WebUIController(web_ui);
}
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
+ virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return WebUI::kNoWebUI;
+ }
+
+ virtual bool UseWebUIForURL(BrowserContext* browser_context,
const GURL& url) const OVERRIDE {
return HasWebUIScheme(url);
}
- virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
+ virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context,
const GURL& url) const OVERRIDE {
return HasWebUIScheme(url);
}
@@ -74,10 +81,15 @@ class RenderViewHostManagerTestWebUIFactory
url.spec() != kChromeUISchemeButNotWebUIURL;
}
+ virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return false;
+ }
+
private:
bool should_create_webui_;
- DISALLOW_COPY_AND_ASSIGN(RenderViewHostManagerTestWebUIFactory);
+ DISALLOW_COPY_AND_ASSIGN(RenderViewHostManagerTestWebUIControllerFactory);
};
class RenderViewHostManagerTestBrowserClient
@@ -91,12 +103,13 @@ class RenderViewHostManagerTestBrowserClient
}
// content::MockContentBrowserClient implementation.
- virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE {
+ virtual content::WebUIControllerFactory*
+ GetWebUIControllerFactory() OVERRIDE {
return &factory_;
}
private:
- RenderViewHostManagerTestWebUIFactory factory_;
+ RenderViewHostManagerTestWebUIControllerFactory factory_;
DISALLOW_COPY_AND_ASSIGN(RenderViewHostManagerTestBrowserClient);
};
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 8edcdf3..cf79d60 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -46,7 +46,7 @@
#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_factory.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"
@@ -122,6 +122,7 @@ using content::WebContents;
using content::WebContentsObserver;
using content::WebUI;
using content::WebUIController;
+using content::WebUIControllerFactory;
namespace {
@@ -435,10 +436,13 @@ content::WebContentsView* TabContents::GetView() const {
}
content::WebUI* TabContents::CreateWebUI(const GURL& url) {
+ WebUIControllerFactory* factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ if (!factory)
+ return NULL;
WebUIImpl* web_ui = new WebUIImpl(this);
WebUIController* controller =
- content::GetContentClient()->browser()->GetWebUIFactory()->
- CreateWebUIForURL(web_ui, url);
+ factory->CreateWebUIControllerForURL(web_ui, url);
if (controller) {
web_ui->SetController(controller);
return web_ui;
@@ -828,9 +832,11 @@ bool TabContents::NavigateToEntry(
// 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->enabled_bindings();
- bool is_allowed_in_web_ui_renderer = content::GetContentClient()->
- browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(GetBrowserContext(),
- entry.GetURL());
+ WebUIControllerFactory* factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ bool is_allowed_in_web_ui_renderer =
+ factory &&
+ factory->IsURLAcceptableForWebUI(GetBrowserContext(), entry.GetURL());
#if defined(OS_CHROMEOS)
is_allowed_in_web_ui_renderer |= entry.GetURL().SchemeIs(chrome::kDataScheme);
#endif
@@ -1098,8 +1104,11 @@ int TabContents::GetContentRestrictions() const {
}
WebUI::TypeID TabContents::GetWebUITypeForCurrentState() {
- return content::GetContentClient()->browser()->GetWebUIFactory()->
- GetWebUIType(GetBrowserContext(), GetURL());
+ WebUIControllerFactory* factory =
+ content::GetContentClient()->browser()->GetWebUIControllerFactory();
+ if (!factory)
+ return WebUI::kNoWebUI;
+ return factory->GetWebUIType(GetBrowserContext(), GetURL());
}
content::WebUI* TabContents::GetWebUIForCurrentState() {
diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc
index d943c1f..bb7c7d469 100644
--- a/content/browser/tab_contents/tab_contents_unittest.cc
+++ b/content/browser/tab_contents/tab_contents_unittest.cc
@@ -12,13 +12,13 @@
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/browser/tab_contents/navigation_entry_impl.h"
#include "content/browser/tab_contents/test_tab_contents.h"
-#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/common/view_messages.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_ui_controller.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/url_constants.h"
@@ -26,37 +26,50 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/glue/webkit_glue.h"
+using content::BrowserContext;
using content::BrowserThread;
using content::NavigationEntry;
using content::NavigationEntryImpl;
using content::SiteInstance;
using content::WebContents;
+using content::WebUI;
using content::WebUIController;
using webkit::forms::PasswordForm;
namespace {
-class TabContentsTestWebUIFactory : public content::EmptyWebUIFactory {
+class TabContentsTestWebUIControllerFactory
+ : public content::WebUIControllerFactory {
public:
- virtual WebUIController* CreateWebUIForURL(content::WebUI* web_ui,
- const GURL& url) const OVERRIDE {
+ virtual WebUIController* CreateWebUIControllerForURL(
+ content::WebUI* web_ui, const GURL& url) const OVERRIDE {
if (!HasWebUIScheme(url))
return NULL;
return new WebUIController(web_ui);
}
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
+ virtual WebUI::TypeID GetWebUIType(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return WebUI::kNoWebUI;
+ }
+
+ virtual bool UseWebUIForURL(BrowserContext* browser_context,
const GURL& url) const OVERRIDE {
return HasWebUIScheme(url);
}
+ virtual bool UseWebUIBindingsForURL(BrowserContext* browser_context,
+ const GURL& url) const OVERRIDE {
+ return HasWebUIScheme(url);
+ }
+
virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE {
return url.SchemeIs("tabcontentstest");
}
- virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context,
- const GURL& url) const {
+ virtual bool IsURLAcceptableForWebUI(
+ BrowserContext* browser_context, const GURL& url) const {
return HasWebUIScheme(url);
}
};
@@ -66,12 +79,13 @@ class TabContentsTestBrowserClient : public content::MockContentBrowserClient {
TabContentsTestBrowserClient() {
}
- virtual content::WebUIFactory* GetWebUIFactory() OVERRIDE {
+ virtual content::WebUIControllerFactory*
+ GetWebUIControllerFactory() OVERRIDE {
return &factory_;
}
private:
- TabContentsTestWebUIFactory factory_;
+ TabContentsTestWebUIControllerFactory factory_;
};
class TestInterstitialPage : public InterstitialPage {
diff --git a/content/browser/webui/empty_web_ui_factory.cc b/content/browser/webui/empty_web_ui_factory.cc
deleted file mode 100644
index e5ede37..0000000
--- a/content/browser/webui/empty_web_ui_factory.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/browser/webui/empty_web_ui_factory.h"
-
-namespace content {
-
-EmptyWebUIFactory::EmptyWebUIFactory() {
-}
-
-EmptyWebUIFactory::~EmptyWebUIFactory() {
-}
-
-WebUIController* EmptyWebUIFactory::CreateWebUIForURL(WebUI* web_ui,
- const GURL& url) const {
- return NULL;
-}
-
-WebUI::TypeID EmptyWebUIFactory::GetWebUIType(
- content::BrowserContext* browser_context, const GURL& url) const {
- return WebUI::kNoWebUI;
-}
-
-bool EmptyWebUIFactory::UseWebUIForURL(
- content::BrowserContext* browser_context, const GURL& url) const {
- return false;
-}
-
-bool EmptyWebUIFactory::UseWebUIBindingsForURL(
- content::BrowserContext* browser_context, const GURL& url) const {
- return false;
-}
-
-bool EmptyWebUIFactory::HasWebUIScheme(const GURL& url) const {
- return false;
-}
-
-bool EmptyWebUIFactory::IsURLAcceptableForWebUI(
- content::BrowserContext* browser_context,
- const GURL& url) const {
- return false;
-}
-
-// static
-EmptyWebUIFactory* EmptyWebUIFactory::GetInstance() {
- return Singleton<EmptyWebUIFactory>::get();
-}
-
-} // namespace content
diff --git a/content/browser/webui/empty_web_ui_factory.h b/content/browser/webui/empty_web_ui_factory.h
deleted file mode 100644
index a6d8084..0000000
--- a/content/browser/webui/empty_web_ui_factory.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_BROWSER_WEBUI_EMPTY_WEB_UI_FACTORY_H_
-#define CONTENT_BROWSER_WEBUI_EMPTY_WEB_UI_FACTORY_H_
-
-#include "base/memory/singleton.h"
-#include "content/common/content_export.h"
-#include "content/public/browser/web_ui_factory.h"
-
-namespace content {
-
-// A stubbed out version of WebUIFactory.
-class CONTENT_EXPORT EmptyWebUIFactory : public content::WebUIFactory {
- public:
- // Returns the singleton instance.
- static EmptyWebUIFactory* GetInstance();
-
- virtual WebUIController* CreateWebUIForURL(WebUI* web_ui,
- const GURL& url) const OVERRIDE;
- virtual WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE;
- virtual bool UseWebUIForURL(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE;
- virtual bool UseWebUIBindingsForURL(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE;
- virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE;
- virtual bool IsURLAcceptableForWebUI(content::BrowserContext* browser_context,
- const GURL& url) const OVERRIDE;
-
- protected:
- EmptyWebUIFactory();
- virtual ~EmptyWebUIFactory();
-
- private:
- friend struct DefaultSingletonTraits<EmptyWebUIFactory>;
-};
-
-} // namespace content
-
-#endif // CONTENT_BROWSER_WEBUI_EMPTY_WEB_UI_FACTORY_H_
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 2e7b62d..a527fc0 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -106,7 +106,7 @@
'public/browser/web_ui.h',
'public/browser/web_ui_controller.cc',
'public/browser/web_ui_controller.h',
- 'public/browser/web_ui_factory.h',
+ 'public/browser/web_ui_controller_factory.h',
'public/browser/web_ui_message_handler.h',
'public/browser/worker_service.h',
'public/browser/worker_service_observer.h',
@@ -654,8 +654,6 @@
'browser/user_metrics.cc',
'browser/utility_process_host.cc',
'browser/utility_process_host.h',
- 'browser/webui/empty_web_ui_factory.cc',
- 'browser/webui/empty_web_ui_factory.h',
'browser/webui/generic_handler.cc',
'browser/webui/generic_handler.h',
'browser/webui/web_ui_impl.cc',
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index d008bc0..b3205bc 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -65,7 +65,7 @@ namespace content {
class BrowserContext;
class ResourceContext;
-class WebUIFactory;
+class WebUIControllerFactory;
// Embedder API (or SPI) for participating in browser logic, to be implemented
// by the client of the content browser. See ChromeContentBrowserClient for the
@@ -96,8 +96,9 @@ class ContentBrowserClient {
virtual void RenderProcessHostCreated(
content::RenderProcessHost* host) = 0;
- // Gets the WebUIFactory which will be responsible for generating WebUIs.
- virtual WebUIFactory* GetWebUIFactory() = 0;
+ // Gets the WebUIControllerFactory which will be responsible for generating
+ // WebUIs. Can return NULL if the embedder doesn't need WebUI support.
+ virtual WebUIControllerFactory* GetWebUIControllerFactory() = 0;
// Get the effective URL for the given actual URL, to allow an embedder to
// group different url schemes in the same SiteInstance.
diff --git a/content/public/browser/web_ui_factory.h b/content/public/browser/web_ui_controller_factory.h
index 6821a93..fe5853e 100644
--- a/content/public/browser/web_ui_factory.h
+++ b/content/public/browser/web_ui_controller_factory.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_FACTORY_H_
-#define CONTENT_PUBLIC_BROWSER_WEB_UI_FACTORY_H_
+#ifndef CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
+#define CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
#pragma once
#include "content/common/content_export.h"
@@ -18,13 +18,15 @@ class WebContents;
class WebUIController;
// Interface for an object which controls which URLs are considered WebUI URLs
-// and creates WebUI instances for given URLs.
-class CONTENT_EXPORT WebUIFactory {
+// and creates WebUIController instances for given URLs.
+class CONTENT_EXPORT WebUIControllerFactory {
public:
- // Returns a WebUI instance for the given URL, or NULL if the URL doesn't
- // correspond to a WebUI.
- virtual WebUIController* CreateWebUIForURL(WebUI* web_ui,
- const GURL& url) const = 0;
+ virtual ~WebUIControllerFactory() {}
+
+ // Returns a WebUIController instance for the given URL, or NULL if the URL
+ // doesn't correspond to a WebUI.
+ virtual WebUIController* CreateWebUIControllerForURL(
+ WebUI* web_ui, const GURL& url) const = 0;
// Gets the WebUI type for the given URL. This will return kNoWebUI if the
// corresponding call to CreateWebUIForURL would fail, or something non-NULL
@@ -50,10 +52,8 @@ class CONTENT_EXPORT WebUIFactory {
// normal tabs such as javascript: URLs or about:hang.
virtual bool IsURLAcceptableForWebUI(BrowserContext* browser_context,
const GURL& url) const = 0;
-
- virtual ~WebUIFactory() {}
};
} // namespace content
-#endif // CONTENT_PUBLIC_BROWSER_WEB_UI_FACTORY_H_
+#endif // CONTENT_PUBLIC_BROWSER_WEB_UI_CONTROLLER_FACTORY_H_
diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc
index 79d9be7..65e784b 100644
--- a/content/shell/shell_content_browser_client.cc
+++ b/content/shell/shell_content_browser_client.cc
@@ -5,7 +5,6 @@
#include "content/shell/shell_content_browser_client.h"
#include "base/file_path.h"
-#include "content/browser/webui/empty_web_ui_factory.h"
#include "content/shell/shell.h"
#include "content/shell/shell_browser_main.h"
#include "googleurl/src/gurl.h"
@@ -53,9 +52,8 @@ void ShellContentBrowserClient::RenderProcessHostCreated(
RenderProcessHost* host) {
}
-WebUIFactory* ShellContentBrowserClient::GetWebUIFactory() {
- // Return an empty factory so callsites don't have to check for NULL.
- return EmptyWebUIFactory::GetInstance();
+WebUIControllerFactory* ShellContentBrowserClient::GetWebUIControllerFactory() {
+ return NULL;
}
GURL ShellContentBrowserClient::GetEffectiveURL(
diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h
index f9238cc..26ccebe 100644
--- a/content/shell/shell_content_browser_client.h
+++ b/content/shell/shell_content_browser_client.h
@@ -33,7 +33,7 @@ class ShellContentBrowserClient : public ContentBrowserClient {
RenderViewHost* render_view_host) OVERRIDE;
virtual void RenderProcessHostCreated(
RenderProcessHost* host) OVERRIDE;
- virtual WebUIFactory* GetWebUIFactory() OVERRIDE;
+ virtual WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE;
virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
const GURL& url) OVERRIDE;
virtual bool ShouldUseProcessPerSite(BrowserContext* browser_context,