summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 06:33:03 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-28 06:33:03 +0000
commit86a0a6e893f3827fe38a08b4e678d32ea0492903 (patch)
tree04a038d0bb2db311d119fd4272d4372f2bda9c71 /chrome
parent48dfce7f671b116966958d4e00d9ef7970afba7f (diff)
downloadchromium_src-86a0a6e893f3827fe38a08b4e678d32ea0492903.zip
chromium_src-86a0a6e893f3827fe38a08b4e678d32ea0492903.tar.gz
chromium_src-86a0a6e893f3827fe38a08b4e678d32ea0492903.tar.bz2
Allow multiple WebUIControllerFactory objects to be registered. This makes is possible to implement webui inside content.
BUG=169170 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=175822 Review URL: https://codereview.chromium.org/11783038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chrome_browser_main.cc4
-rw-r--r--chrome/browser/chrome_content_browser_client.cc5
-rw-r--r--chrome/browser/chrome_content_browser_client.h1
-rw-r--r--chrome/browser/devtools/devtools_file_helper.cc3
-rw-r--r--chrome/browser/devtools/devtools_window.cc8
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_api.cc4
-rw-r--r--chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc9
-rw-r--r--chrome/common/chrome_content_client.cc6
-rw-r--r--chrome/common/chrome_content_client.h1
-rw-r--r--chrome/common/chrome_content_client_ios.mm4
-rw-r--r--chrome/test/base/chrome_test_suite.cc12
11 files changed, 29 insertions, 28 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 76ba381..7bc48a4 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -91,6 +91,7 @@
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/uma_browsing_activity_observer.h"
#include "chrome/browser/ui/user_data_dir_dialog.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
@@ -1389,6 +1390,9 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
g_browser_process->profile_manager()->GetLastOpenedProfiles();
#endif
+ content::WebUIControllerFactory::RegisterFactory(
+ ChromeWebUIControllerFactory::GetInstance());
+
if (browser_creator_->Start(parsed_command_line(), FilePath(),
profile_, last_opened_profiles, &result_code)) {
#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index 3770f80..f9b792f 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -731,11 +731,6 @@ void ChromeContentBrowserClient::RenderProcessHostDeleted(
instant_service->RemoveInstantProcess(host->GetID());
}
-content::WebUIControllerFactory*
- ChromeContentBrowserClient::GetWebUIControllerFactory() {
- return ChromeWebUIControllerFactory::GetInstance();
-}
-
GURL ChromeContentBrowserClient::GetEffectiveURL(
content::BrowserContext* browser_context, const GURL& url) {
Profile* profile = Profile::FromBrowserContext(browser_context);
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index 6e022ad..573060f 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -66,7 +66,6 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
content::RenderProcessHost* host) OVERRIDE;
virtual void RenderProcessHostDeleted(
content::RenderProcessHost* host) OVERRIDE;
- virtual content::WebUIControllerFactory* GetWebUIControllerFactory() OVERRIDE;
virtual bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) OVERRIDE;
virtual GURL GetEffectiveURL(content::BrowserContext* browser_context,
diff --git a/chrome/browser/devtools/devtools_file_helper.cc b/chrome/browser/devtools/devtools_file_helper.cc
index 080601e..c77e5f5 100644
--- a/chrome/browser/devtools/devtools_file_helper.cc
+++ b/chrome/browser/devtools/devtools_file_helper.cc
@@ -28,6 +28,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/url_constants.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/shell_dialogs/select_file_dialog.h"
@@ -133,7 +134,7 @@ std::string RegisterFileSystem(WebContents* web_contents,
const FilePath& path,
std::string* registered_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- CHECK(content::GetContentClient()->HasWebUIScheme(web_contents->GetURL()));
+ CHECK(content::HasWebUIScheme(web_contents->GetURL()));
std::string file_system_id = isolated_context()->RegisterFileSystemForPath(
fileapi::kFileSystemTypeNativeLocal, path, registered_name);
diff --git a/chrome/browser/devtools/devtools_window.cc b/chrome/browser/devtools/devtools_window.cc
index 60200d0..86860ab 100644
--- a/chrome/browser/devtools/devtools_window.cc
+++ b/chrome/browser/devtools/devtools_window.cc
@@ -34,7 +34,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
-#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/favicon_status.h"
@@ -49,6 +48,7 @@
#include "content/public/common/bindings_policy.h"
#include "content/public/common/content_client.h"
#include "content/public/common/page_transition_types.h"
+#include "content/public/common/url_constants.h"
#include "grit/generated_resources.h"
typedef std::vector<DevToolsWindow*> DevToolsWindowList;
@@ -852,19 +852,19 @@ DictionaryValue* CreateFileSystemValue(
} // namespace
void DevToolsWindow::RequestFileSystems() {
- CHECK(content::GetContentClient()->HasWebUIScheme(web_contents_->GetURL()));
+ CHECK(content::HasWebUIScheme(web_contents_->GetURL()));
file_helper_->RequestFileSystems(
Bind(&DevToolsWindow::FileSystemsLoaded, weak_factory_.GetWeakPtr()));
}
void DevToolsWindow::AddFileSystem() {
- CHECK(content::GetContentClient()->HasWebUIScheme(web_contents_->GetURL()));
+ CHECK(content::HasWebUIScheme(web_contents_->GetURL()));
file_helper_->AddFileSystem(
Bind(&DevToolsWindow::FileSystemAdded, weak_factory_.GetWeakPtr()));
}
void DevToolsWindow::RemoveFileSystem(const std::string& file_system_path) {
- CHECK(content::GetContentClient()->HasWebUIScheme(web_contents_->GetURL()));
+ CHECK(content::HasWebUIScheme(web_contents_->GetURL()));
file_helper_->RemoveFileSystem(file_system_path);
StringValue file_system_path_value(file_system_path);
CallClientFunction("InspectorFrontendAPI.fileSystemRemoved",
diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc
index d672af7..7d4e703 100644
--- a/chrome/browser/extensions/api/debugger/debugger_api.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_api.cc
@@ -36,6 +36,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/url_constants.h"
#include "extensions/common/error_utils.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -428,8 +429,7 @@ bool DebuggerFunction::InitWebContents() {
}
contents_ = web_contents;
- if (content::GetContentClient()->HasWebUIScheme(
- contents_->GetURL())) {
+ if (content::HasWebUIScheme(contents_->GetURL())) {
error_ = ErrorUtils::FormatErrorMessage(
keys::kAttachToWebUIError,
contents_->GetURL().scheme());
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 e271659..072da22 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -36,9 +36,6 @@
#include "chrome/browser/ui/webui/local_omnibox_popup/local_omnibox_popup_ui.h"
#include "chrome/browser/ui/webui/media/media_internals_ui.h"
#include "chrome/browser/ui/webui/media/webrtc_internals_ui.h"
-#if !defined(DISABLE_NACL)
-#include "chrome/browser/ui/webui/nacl_ui.h"
-#endif
#include "chrome/browser/ui/webui/net_internals/net_internals_ui.h"
#include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
#include "chrome/browser/ui/webui/omnibox/omnibox_ui.h"
@@ -68,6 +65,10 @@
#include "ui/gfx/favicon_size.h"
#include "ui/web_dialogs/web_dialog_ui.h"
+#if !defined(DISABLE_NACL)
+#include "chrome/browser/ui/webui/nacl_ui.h"
+#endif
+
#if defined(ENABLE_CONFIGURATION_POLICY)
#include "chrome/browser/ui/webui/policy_ui.h"
#endif
@@ -564,7 +565,7 @@ base::RefCountedMemory* ChromeWebUIControllerFactory::GetFaviconResourceBytes(
}
#endif
- if (!content::GetContentClient()->HasWebUIScheme(page_url))
+ if (!content::HasWebUIScheme(page_url))
return NULL;
#if defined(OS_WIN)
diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc
index 1ff9b0a..5c4afe6 100644
--- a/chrome/common/chrome_content_client.cc
+++ b/chrome/common/chrome_content_client.cc
@@ -386,12 +386,6 @@ void ChromeContentClient::AddAdditionalSchemes(
#endif
}
-bool ChromeContentClient::HasWebUIScheme(const GURL& url) const {
- return url.SchemeIs(chrome::kChromeDevToolsScheme) ||
- url.SchemeIs(chrome::kChromeInternalScheme) ||
- url.SchemeIs(chrome::kChromeUIScheme);
-}
-
bool ChromeContentClient::CanHandleWhileSwappedOut(
const IPC::Message& msg) {
// Any Chrome-specific messages (apart from those listed in
diff --git a/chrome/common/chrome_content_client.h b/chrome/common/chrome_content_client.h
index 414d7a7..387bea2 100644
--- a/chrome/common/chrome_content_client.h
+++ b/chrome/common/chrome_content_client.h
@@ -28,7 +28,6 @@ class ChromeContentClient : public content::ContentClient {
virtual void AddAdditionalSchemes(
std::vector<std::string>* standard_schemes,
std::vector<std::string>* saveable_shemes) OVERRIDE;
- virtual bool HasWebUIScheme(const GURL& url) const OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetProduct() const OVERRIDE;
virtual std::string GetUserAgent() const OVERRIDE;
diff --git a/chrome/common/chrome_content_client_ios.mm b/chrome/common/chrome_content_client_ios.mm
index 963c1ad..f791561 100644
--- a/chrome/common/chrome_content_client_ios.mm
+++ b/chrome/common/chrome_content_client_ios.mm
@@ -42,10 +42,6 @@ void ChromeContentClient::AddAdditionalSchemes(
// No additional schemes for iOS.
}
-bool ChromeContentClient::HasWebUIScheme(const GURL& url) const {
- return url.SchemeIs(chrome::kChromeUIScheme);
-}
-
bool ChromeContentClient::CanHandleWhileSwappedOut(
const IPC::Message& msg) {
NOTIMPLEMENTED();
diff --git a/chrome/test/base/chrome_test_suite.cc b/chrome/test/base/chrome_test_suite.cc
index 872a200..73e861a 100644
--- a/chrome/test/base/chrome_test_suite.cc
+++ b/chrome/test/base/chrome_test_suite.cc
@@ -19,11 +19,13 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
+#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_browser_process.h"
+#include "content/public/test/test_launcher.h"
#include "net/base/mock_host_resolver.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
@@ -213,6 +215,16 @@ void ChromeTestSuite::Initialize() {
PathService::Override(base::DIR_MODULE, browser_dir_);
}
+#if !defined(OS_IOS)
+ if (!content::GetCurrentTestLauncherDelegate()) {
+ // Only want to do this for unit tests. For browser tests, this won't create
+ // the right object since TestChromeWebUIControllerFactory is used. That's
+ // created and registered in ChromeBrowserMainParts as in normal startup.
+ content::WebUIControllerFactory::RegisterFactory(
+ ChromeWebUIControllerFactory::GetInstance());
+ }
+#endif
+
// Disable external libraries load if we are under python process in
// ChromeOS. That means we are autotest and, if ASAN is used,
// external libraries load crashes.