From 86a0a6e893f3827fe38a08b4e678d32ea0492903 Mon Sep 17 00:00:00 2001 From: "jam@chromium.org" Date: Mon, 28 Jan 2013 06:33:03 +0000 Subject: 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 --- chrome/browser/chrome_browser_main.cc | 4 ++++ chrome/browser/chrome_content_browser_client.cc | 5 ----- chrome/browser/chrome_content_browser_client.h | 1 - chrome/browser/devtools/devtools_file_helper.cc | 3 ++- chrome/browser/devtools/devtools_window.cc | 8 ++++---- chrome/browser/extensions/api/debugger/debugger_api.cc | 4 ++-- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc | 9 +++++---- 7 files changed, 17 insertions(+), 17 deletions(-) (limited to 'chrome/browser') 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 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) -- cgit v1.1