diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 16:58:25 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-13 16:58:25 +0000 |
commit | e14c959126431fed79d444f5d33c3bd508b20663 (patch) | |
tree | da195fe3316022299b88fce805210deb19c0d270 /chrome | |
parent | 5369c1613d344187df6ed2167094435fe04da200 (diff) | |
download | chromium_src-e14c959126431fed79d444f5d33c3bd508b20663.zip chromium_src-e14c959126431fed79d444f5d33c3bd508b20663.tar.gz chromium_src-e14c959126431fed79d444f5d33c3bd508b20663.tar.bz2 |
Start splitting out WebUI into an implementation class and an interface that each page implements. This first patch moves the virtual functions in WebUI that were overridden by pages into a separate interface, content::WebUIController.
BUG=98716
Review URL: http://codereview.chromium.org/9188056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117645 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
86 files changed, 182 insertions, 155 deletions
diff --git a/chrome/browser/extensions/extension_web_ui.cc b/chrome/browser/extensions/extension_web_ui.cc index 2902e8b..0313dd1 100644 --- a/chrome/browser/extensions/extension_web_ui.cc +++ b/chrome/browser/extensions/extension_web_ui.cc @@ -128,7 +128,7 @@ const char ExtensionWebUI::kExtensionURLOverrides[] = "extensions.chrome_url_overrides"; ExtensionWebUI::ExtensionWebUI(WebContents* web_contents, const GURL& url) - : WebUI(web_contents), + : WebUI(web_contents, this), url_(url) { Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); diff --git a/chrome/browser/extensions/extension_web_ui.h b/chrome/browser/extensions/extension_web_ui.h index 05e6d19..4996c63 100644 --- a/chrome/browser/extensions/extension_web_ui.h +++ b/chrome/browser/extensions/extension_web_ui.h @@ -13,21 +13,16 @@ #include "chrome/browser/favicon/favicon_service.h" #include "chrome/common/extensions/extension.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class GURL; class PrefService; class Profile; -namespace base { -class ListValue; -class Value; -} - // This class implements WebUI for extensions and allows extensions to put UI in // the main tab contents area. For example, each extension can specify an // "options_page", and that page is displayed in the tab contents area and is // hosted by this class. -class ExtensionWebUI : public WebUI { +class ExtensionWebUI : public WebUI, public content::WebUIController { public: static const char kExtensionURLOverrides[]; diff --git a/chrome/browser/ui/webui/about_page/about_page_ui.cc b/chrome/browser/ui/webui/about_page/about_page_ui.cc index 573a6c9..633ee08 100644 --- a/chrome/browser/ui/webui/about_page/about_page_ui.cc +++ b/chrome/browser/ui/webui/about_page/about_page_ui.cc @@ -27,7 +27,8 @@ ChromeWebUIDataSource* CreateAboutPageHTMLSource() { } // namespace -AboutPageUI::AboutPageUI(content::WebContents* contents) : WebUI(contents) { +AboutPageUI::AboutPageUI(content::WebContents* contents) + : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); ChromeWebUIDataSource* source = CreateAboutPageHTMLSource(); profile->GetChromeURLDataManager()->AddDataSource(source); diff --git a/chrome/browser/ui/webui/about_page/about_page_ui.h b/chrome/browser/ui/webui/about_page/about_page_ui.h index a53181f..c9c4ce4 100644 --- a/chrome/browser/ui/webui/about_page/about_page_ui.h +++ b/chrome/browser/ui/webui/about_page/about_page_ui.h @@ -8,8 +8,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class AboutPageUI : public WebUI { +class AboutPageUI : public WebUI, public content::WebUIController { public: explicit AboutPageUI(content::WebContents* contents); virtual ~AboutPageUI(); diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 24b4752..fd17b96 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc @@ -1379,7 +1379,7 @@ std::string AboutUIHTMLSource::GetMimeType(const std::string& path) const { } AboutUI::AboutUI(WebContents* contents, const std::string& name) - : WebUI(contents) { + : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); ChromeURLDataManager::DataSource* source = new AboutUIHTMLSource(name, profile); diff --git a/chrome/browser/ui/webui/about_ui.h b/chrome/browser/ui/webui/about_ui.h index b02e105..bb4288b 100644 --- a/chrome/browser/ui/webui/about_ui.h +++ b/chrome/browser/ui/webui/about_ui.h @@ -11,6 +11,7 @@ #include "base/basictypes.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class Profile; class TabContents; @@ -43,7 +44,7 @@ class AboutUIHTMLSource : public ChromeURLDataManager::DataSource { DISALLOW_COPY_AND_ASSIGN(AboutUIHTMLSource); }; -class AboutUI : public WebUI { +class AboutUI : public WebUI, public content::WebUIController { public: explicit AboutUI(content::WebContents* contents, const std::string& host); virtual ~AboutUI() {} diff --git a/chrome/browser/ui/webui/bookmarks_ui.cc b/chrome/browser/ui/webui/bookmarks_ui.cc index e7ddc5c..42370f3 100644 --- a/chrome/browser/ui/webui/bookmarks_ui.cc +++ b/chrome/browser/ui/webui/bookmarks_ui.cc @@ -56,7 +56,7 @@ std::string BookmarksUIHTMLSource::GetMimeType(const std::string& path) const { // //////////////////////////////////////////////////////////////////////////////// -BookmarksUI::BookmarksUI(WebContents* contents) : WebUI(contents) { +BookmarksUI::BookmarksUI(WebContents* contents) : WebUI(contents, this) { BookmarksUIHTMLSource* html_source = new BookmarksUIHTMLSource(); // Set up the chrome://bookmarks/ source. diff --git a/chrome/browser/ui/webui/bookmarks_ui.h b/chrome/browser/ui/webui/bookmarks_ui.h index 6c26f54..0fce89c 100644 --- a/chrome/browser/ui/webui/bookmarks_ui.h +++ b/chrome/browser/ui/webui/bookmarks_ui.h @@ -10,6 +10,7 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class RefCountedMemory; @@ -31,7 +32,7 @@ class BookmarksUIHTMLSource : public ChromeURLDataManager::DataSource { // This class is used to hook up chrome://bookmarks/ which in turn gets // overridden by an extension. -class BookmarksUI : public WebUI { +class BookmarksUI : public WebUI, public content::WebUIController { public: explicit BookmarksUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc index 2fef4e4..50e64db 100644 --- a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc +++ b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.cc @@ -211,7 +211,7 @@ void ChooseMobileNetworkHandler::HandlePageReady(const ListValue* args) { } // namespace ChooseMobileNetworkUI::ChooseMobileNetworkUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); AddMessageHandler(handler); // Set up the "chrome://choose-mobile-network" source. diff --git a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h index 217b65e..56b79cd 100644 --- a/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h +++ b/chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h @@ -7,11 +7,12 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace chromeos { // A custom WebUI that defines datasource for choosing cellular network dialog. -class ChooseMobileNetworkUI : public WebUI { +class ChooseMobileNetworkUI : public WebUI, public content::WebUIController { public: explicit ChooseMobileNetworkUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc index 672dfd0..0fcb8de 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.cc @@ -645,7 +645,7 @@ bool WebUIHandler::CheckNetwork() { // //////////////////////////////////////////////////////////////////////////////// -ImageBurnUI::ImageBurnUI(WebContents* contents) : WebUI(contents) { +ImageBurnUI::ImageBurnUI(WebContents* contents) : WebUI(contents, this) { imageburner::WebUIHandler* handler = new imageburner::WebUIHandler(contents); AddMessageHandler(handler); diff --git a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h index 73d3f9a..1f1e141 100644 --- a/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h +++ b/chrome/browser/ui/webui/chromeos/imageburner/imageburner_ui.h @@ -6,8 +6,9 @@ #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_IMAGEBURNER_IMAGEBURNER_UI_H_ #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class ImageBurnUI : public WebUI { +class ImageBurnUI : public WebUI, public content::WebUIController { public: explicit ImageBurnUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc index c7b8f67..8c3fd678 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.cc @@ -109,7 +109,7 @@ std::string OobeUIHTMLSource::GetDataResource(int resource_id) const { // OobeUI ---------------------------------------------------------------------- OobeUI::OobeUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), update_screen_actor_(NULL), network_screen_actor_(NULL), eula_screen_actor_(NULL), diff --git a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h index 5f3d0a6..5d0a8c3 100644 --- a/chrome/browser/ui/webui/chromeos/login/oobe_ui.h +++ b/chrome/browser/ui/webui/chromeos/login/oobe_ui.h @@ -8,6 +8,7 @@ #include "chrome/browser/chromeos/login/oobe_display.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace base { class DictionaryValue; @@ -27,7 +28,7 @@ namespace chromeos { // - eula screen (CrOS (+ OEM) EULA content/TPM password/crash reporting). // - update screen. class OobeUI : public OobeDisplay, - public WebUI { + public WebUI, public content::WebUIController { public: explicit OobeUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc index 9cefa55..3219e92 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.cc @@ -1390,12 +1390,11 @@ void MobileSetupHandler::StartActivationOnUIThread() { //////////////////////////////////////////////////////////////////////////////// MobileSetupUI::MobileSetupUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), frame_load_observer_(NULL) { chromeos::CellularNetwork* network = GetCellularNetwork(); std::string service_path = network ? network->service_path() : std::string(); - MobileSetupHandler* handler = new MobileSetupHandler(service_path); - AddMessageHandler(handler); + AddMessageHandler(new MobileSetupHandler(service_path)); MobileSetupUIHTMLSource* html_source = new MobileSetupUIHTMLSource(service_path); @@ -1405,7 +1404,6 @@ MobileSetupUI::MobileSetupUI(WebContents* contents) } void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { - WebUI::RenderViewCreated(host); // Destroyed by the corresponding RenderViewHost. frame_load_observer_ = new PortalFrameLoadObserver(AsWeakPtr(), host); diff --git a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h index 539684c..ddd3881 100644 --- a/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h +++ b/chrome/browser/ui/webui/chromeos/mobile_setup_ui.h @@ -8,11 +8,13 @@ #include "base/memory/weak_ptr.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class PortalFrameLoadObserver; // A custom WebUI that defines datasource for mobile setup registration page // that is used in Chrome OS activate modem and perform plan subscription tasks. class MobileSetupUI : public WebUI, + public content::WebUIController, public base::SupportsWeakPtr<MobileSetupUI> { public: explicit MobileSetupUI(content::WebContents* contents); @@ -20,7 +22,7 @@ class MobileSetupUI : public WebUI, void OnObserverDeleted(); private: - // WebUI overrides. + // WebUIController overrides. virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; PortalFrameLoadObserver* frame_load_observer_; diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc index 1d86f02..c12eb1c 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc +++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.cc @@ -69,7 +69,7 @@ void ProxySettingsHTMLSource::StartDataRequest(const std::string& path, namespace chromeos { ProxySettingsUI::ProxySettingsUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), proxy_handler_(new ProxyHandler()) { // |localized_strings| will be owned by ProxySettingsHTMLSource. DictionaryValue* localized_strings = new DictionaryValue(); diff --git a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h index e2e3a0a..5cb9eca 100644 --- a/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h +++ b/chrome/browser/ui/webui/chromeos/proxy_settings_ui.h @@ -8,6 +8,7 @@ #include "chrome/browser/ui/webui/options/options_ui.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace chromeos { @@ -15,7 +16,7 @@ class ProxyHandler; // A WebUI to host proxy settings splitted from settings page for better // performance. -class ProxySettingsUI : public WebUI, +class ProxySettingsUI : public WebUI, public content::WebUIController, public OptionsPageUIHandlerHost { public: explicit ProxySettingsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.cc b/chrome/browser/ui/webui/chromeos/register_page_ui.cc index 2dfad53..5d19283 100644 --- a/chrome/browser/ui/webui/chromeos/register_page_ui.cc +++ b/chrome/browser/ui/webui/chromeos/register_page_ui.cc @@ -294,7 +294,7 @@ void RegisterPageHandler::SendUserInfo() { // //////////////////////////////////////////////////////////////////////////////// -RegisterPageUI::RegisterPageUI(WebContents* contents) : WebUI(contents) { +RegisterPageUI::RegisterPageUI(WebContents* contents) : WebUI(contents, this) { RegisterPageHandler* handler = new RegisterPageHandler(); AddMessageHandler(handler); RegisterPageUIHTMLSource* html_source = new RegisterPageUIHTMLSource(); diff --git a/chrome/browser/ui/webui/chromeos/register_page_ui.h b/chrome/browser/ui/webui/chromeos/register_page_ui.h index 6e53b93..f4401c4 100644 --- a/chrome/browser/ui/webui/chromeos/register_page_ui.h +++ b/chrome/browser/ui/webui/chromeos/register_page_ui.h @@ -7,10 +7,11 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // A custom WebUI that defines datasource for host registration page that // is used in Chrome OS to register product on first sign in. -class RegisterPageUI : public WebUI { +class RegisterPageUI : public WebUI, public content::WebUIController { public: explicit RegisterPageUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc index 37444c8..6058ff5 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc @@ -662,7 +662,7 @@ void SimUnlockHandler::UpdatePage(const chromeos::NetworkDevice* cellular, // SimUnlockUI ----------------------------------------------------------------- -SimUnlockUI::SimUnlockUI(WebContents* contents) : WebUI(contents) { +SimUnlockUI::SimUnlockUI(WebContents* contents) : WebUI(contents, this) { SimUnlockHandler* handler = new SimUnlockHandler(); AddMessageHandler(handler); SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); diff --git a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.h b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.h index 0036e64..6bed044 100644 --- a/chrome/browser/ui/webui/chromeos/sim_unlock_ui.h +++ b/chrome/browser/ui/webui/chromeos/sim_unlock_ui.h @@ -7,6 +7,7 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace chromeos { @@ -14,7 +15,7 @@ namespace chromeos { // in Chrome OS for specific tasks: // - Unlock SIM card (enter PIN/PUK codes). // - Display "SIM card is blocked" message when there're no PUK tries left. -class SimUnlockUI : public WebUI { +class SimUnlockUI : public WebUI, public content::WebUIController { public: explicit SimUnlockUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/chromeos/system_info_ui.cc b/chrome/browser/ui/webui/chromeos/system_info_ui.cc index bf67039..415416d 100644 --- a/chrome/browser/ui/webui/chromeos/system_info_ui.cc +++ b/chrome/browser/ui/webui/chromeos/system_info_ui.cc @@ -172,7 +172,7 @@ void SystemInfoHandler::RegisterMessages() { // //////////////////////////////////////////////////////////////////////////////// -SystemInfoUI::SystemInfoUI(WebContents* contents) : WebUI(contents) { +SystemInfoUI::SystemInfoUI(WebContents* contents) : WebUI(contents, this) { SystemInfoHandler* handler = new SystemInfoHandler(); AddMessageHandler(handler); SystemInfoUIHTMLSource* html_source = new SystemInfoUIHTMLSource(); diff --git a/chrome/browser/ui/webui/chromeos/system_info_ui.h b/chrome/browser/ui/webui/chromeos/system_info_ui.h index 192f718..3e038bd 100644 --- a/chrome/browser/ui/webui/chromeos/system_info_ui.h +++ b/chrome/browser/ui/webui/chromeos/system_info_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class SystemInfoUI : public WebUI { +class SystemInfoUI : public WebUI, public content::WebUIController { public: explicit SystemInfoUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/conflicts_ui.cc b/chrome/browser/ui/webui/conflicts_ui.cc index 83e790e..6094cf4 100644 --- a/chrome/browser/ui/webui/conflicts_ui.cc +++ b/chrome/browser/ui/webui/conflicts_ui.cc @@ -159,7 +159,7 @@ void ConflictsDOMHandler::Observe(int type, // /////////////////////////////////////////////////////////////////////////////// -ConflictsUI::ConflictsUI(WebContents* contents) : WebUI(contents) { +ConflictsUI::ConflictsUI(WebContents* contents) : WebUI(contents, this) { content::RecordAction(UserMetricsAction("ViewAboutConflicts")); AddMessageHandler(new ConflictsDOMHandler()); diff --git a/chrome/browser/ui/webui/conflicts_ui.h b/chrome/browser/ui/webui/conflicts_ui.h index f265f58..3f26af7 100644 --- a/chrome/browser/ui/webui/conflicts_ui.h +++ b/chrome/browser/ui/webui/conflicts_ui.h @@ -7,13 +7,14 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" #if defined(OS_WIN) class RefCountedMemory; // The Web UI handler for about:conflicts. -class ConflictsUI : public WebUI { +class ConflictsUI : public WebUI, public content::WebUIController { public: explicit ConflictsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/constrained_html_ui.cc b/chrome/browser/ui/webui/constrained_html_ui.cc index cc7c2ef..c4b961f 100644 --- a/chrome/browser/ui/webui/constrained_html_ui.cc +++ b/chrome/browser/ui/webui/constrained_html_ui.cc @@ -25,15 +25,13 @@ static base::LazyInstance<base::PropertyAccessor<ConstrainedHtmlUIDelegate*> > g_constrained_html_ui_property_accessor = LAZY_INSTANCE_INITIALIZER; ConstrainedHtmlUI::ConstrainedHtmlUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { } ConstrainedHtmlUI::~ConstrainedHtmlUI() { } void ConstrainedHtmlUI::RenderViewCreated(RenderViewHost* render_view_host) { - WebUI::RenderViewCreated(render_view_host); - ConstrainedHtmlUIDelegate* delegate = GetConstrainedDelegate(); if (!delegate) return; diff --git a/chrome/browser/ui/webui/constrained_html_ui.h b/chrome/browser/ui/webui/constrained_html_ui.h index a6d7d49..46519a2 100644 --- a/chrome/browser/ui/webui/constrained_html_ui.h +++ b/chrome/browser/ui/webui/constrained_html_ui.h @@ -7,6 +7,7 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class ConstrainedWindow; class HtmlDialogUIDelegate; @@ -47,11 +48,12 @@ class ConstrainedHtmlUIDelegate { // // Since ConstrainedWindow requires platform-specific delegate // implementations, this class is just a factory stub. -class ConstrainedHtmlUI : public WebUI { +class ConstrainedHtmlUI : public WebUI, public content::WebUIController { public: explicit ConstrainedHtmlUI(content::WebContents* contents); virtual ~ConstrainedHtmlUI(); + // WebUIController implementation: virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; // Create a constrained HTML dialog. The actual object that gets created diff --git a/chrome/browser/ui/webui/crashes_ui.cc b/chrome/browser/ui/webui/crashes_ui.cc index 813ec8b..c0c1ed8 100644 --- a/chrome/browser/ui/webui/crashes_ui.cc +++ b/chrome/browser/ui/webui/crashes_ui.cc @@ -159,7 +159,7 @@ void CrashesDOMHandler::UpdateUI() { // /////////////////////////////////////////////////////////////////////////////// -CrashesUI::CrashesUI(WebContents* contents) : WebUI(contents) { +CrashesUI::CrashesUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new CrashesDOMHandler()); // Set up the chrome://crashes/ source. diff --git a/chrome/browser/ui/webui/crashes_ui.h b/chrome/browser/ui/webui/crashes_ui.h index 2501a70..4b7609d 100644 --- a/chrome/browser/ui/webui/crashes_ui.h +++ b/chrome/browser/ui/webui/crashes_ui.h @@ -7,10 +7,11 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class RefCountedMemory; -class CrashesUI : public WebUI { +class CrashesUI : public WebUI, public content::WebUIController { public: explicit CrashesUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/devtools_ui.cc b/chrome/browser/ui/webui/devtools_ui.cc index d9d6229..f870a8a 100644 --- a/chrome/browser/ui/webui/devtools_ui.cc +++ b/chrome/browser/ui/webui/devtools_ui.cc @@ -100,7 +100,7 @@ void DevToolsUI::RegisterDevToolsDataSource(Profile* profile) { } } -DevToolsUI::DevToolsUI(WebContents* contents) : WebUI(contents) { +DevToolsUI::DevToolsUI(WebContents* contents) : WebUI(contents, this) { DevToolsDataSource* data_source = new DevToolsDataSource(); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); profile->GetChromeURLDataManager()->AddDataSource(data_source); @@ -108,5 +108,4 @@ DevToolsUI::DevToolsUI(WebContents* contents) : WebUI(contents) { void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) { content::DevToolsClientHost::SetupDevToolsFrontendClient(render_view_host); - WebUI::RenderViewCreated(render_view_host); } diff --git a/chrome/browser/ui/webui/devtools_ui.h b/chrome/browser/ui/webui/devtools_ui.h index 567b47a..0643fff 100644 --- a/chrome/browser/ui/webui/devtools_ui.h +++ b/chrome/browser/ui/webui/devtools_ui.h @@ -7,16 +7,17 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class Profile; -class DevToolsUI : public WebUI { +class DevToolsUI : public WebUI, public content::WebUIController { public: static void RegisterDevToolsDataSource(Profile* profile); explicit DevToolsUI(content::WebContents* contents); - // WebUI + // WebUIController virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; private: diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc index f930f7ab..8b965d7 100644 --- a/chrome/browser/ui/webui/downloads_ui.cc +++ b/chrome/browser/ui/webui/downloads_ui.cc @@ -84,7 +84,7 @@ ChromeWebUIDataSource* CreateDownloadsUIHTMLSource() { // /////////////////////////////////////////////////////////////////////////////// -DownloadsUI::DownloadsUI(WebContents* contents) : WebUI(contents) { +DownloadsUI::DownloadsUI(WebContents* contents) : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); DownloadManager* dlm = DownloadServiceFactory::GetForProfile(profile)->GetDownloadManager(); diff --git a/chrome/browser/ui/webui/downloads_ui.h b/chrome/browser/ui/webui/downloads_ui.h index 4ee9f1a..8489c85 100644 --- a/chrome/browser/ui/webui/downloads_ui.h +++ b/chrome/browser/ui/webui/downloads_ui.h @@ -7,10 +7,11 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class RefCountedMemory; -class DownloadsUI : public WebUI { +class DownloadsUI : public WebUI, public content::WebUIController { public: explicit DownloadsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index 1b5020a..0450e44 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc @@ -30,7 +30,7 @@ ChromeWebUIDataSource* CreateExtensionsHTMLSource() { } // namespace -ExtensionsUI::ExtensionsUI(WebContents* contents) : WebUI(contents) { +ExtensionsUI::ExtensionsUI(WebContents* contents) : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); ChromeWebUIDataSource* source = CreateExtensionsHTMLSource(); profile->GetChromeURLDataManager()->AddDataSource(source); diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.h b/chrome/browser/ui/webui/extensions/extensions_ui.h index d5be20a..476a5a9 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.h +++ b/chrome/browser/ui/webui/extensions/extensions_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class ExtensionsUI : public WebUI { +class ExtensionsUI : public WebUI, public content::WebUIController { public: explicit ExtensionsUI(content::WebContents* contents); virtual ~ExtensionsUI(); diff --git a/chrome/browser/ui/webui/flags_ui.cc b/chrome/browser/ui/webui/flags_ui.cc index f203602..7901e1b 100644 --- a/chrome/browser/ui/webui/flags_ui.cc +++ b/chrome/browser/ui/webui/flags_ui.cc @@ -159,7 +159,7 @@ void FlagsDOMHandler::HandleRestartBrowser(const ListValue* args) { // /////////////////////////////////////////////////////////////////////////////// -FlagsUI::FlagsUI(WebContents* contents) : WebUI(contents) { +FlagsUI::FlagsUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new FlagsDOMHandler()); // Set up the about:flags source. diff --git a/chrome/browser/ui/webui/flags_ui.h b/chrome/browser/ui/webui/flags_ui.h index b559568..a3b7642 100644 --- a/chrome/browser/ui/webui/flags_ui.h +++ b/chrome/browser/ui/webui/flags_ui.h @@ -7,11 +7,12 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class PrefService; class RefCountedMemory; -class FlagsUI : public WebUI { +class FlagsUI : public WebUI, public content::WebUIController { public: explicit FlagsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/flash_ui.cc b/chrome/browser/ui/webui/flash_ui.cc index 726e59c..61b57ab 100644 --- a/chrome/browser/ui/webui/flash_ui.cc +++ b/chrome/browser/ui/webui/flash_ui.cc @@ -367,7 +367,7 @@ void FlashDOMHandler::MaybeRespondToPage() { // /////////////////////////////////////////////////////////////////////////////// -FlashUI::FlashUI(WebContents* contents) : WebUI(contents) { +FlashUI::FlashUI(WebContents* contents) : WebUI(contents, this) { content::RecordAction( UserMetricsAction("ViewAboutFlash")); diff --git a/chrome/browser/ui/webui/flash_ui.h b/chrome/browser/ui/webui/flash_ui.h index 54c71c5..b02c3d4 100644 --- a/chrome/browser/ui/webui/flash_ui.h +++ b/chrome/browser/ui/webui/flash_ui.h @@ -7,11 +7,12 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class RefCountedMemory; // The Web UI handler for about:flash. -class FlashUI : public WebUI { +class FlashUI : public WebUI, public content::WebUIController { public: explicit FlashUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc index e93ebaf..9f969b4 100644 --- a/chrome/browser/ui/webui/gpu_internals_ui.cc +++ b/chrome/browser/ui/webui/gpu_internals_ui.cc @@ -239,7 +239,7 @@ void GpuMessageHandler::OnGpuInfoUpdate() { // //////////////////////////////////////////////////////////////////////////////// -GpuInternalsUI::GpuInternalsUI(WebContents* contents) : WebUI(contents) { +GpuInternalsUI::GpuInternalsUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new GpuMessageHandler()); // Set up the chrome://gpu-internals/ source. diff --git a/chrome/browser/ui/webui/gpu_internals_ui.h b/chrome/browser/ui/webui/gpu_internals_ui.h index c820b38..66dffcd 100644 --- a/chrome/browser/ui/webui/gpu_internals_ui.h +++ b/chrome/browser/ui/webui/gpu_internals_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class GpuInternalsUI : public WebUI { +class GpuInternalsUI : public WebUI, public content::WebUIController { public: explicit GpuInternalsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index cdd156b..dd8277c 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -423,7 +423,7 @@ void BrowsingHistoryHandler::Observe( // //////////////////////////////////////////////////////////////////////////////// -HistoryUI::HistoryUI(WebContents* contents) : WebUI(contents) { +HistoryUI::HistoryUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new BrowsingHistoryHandler()); HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); diff --git a/chrome/browser/ui/webui/history_ui.h b/chrome/browser/ui/webui/history_ui.h index e03dd09..b576e79 100644 --- a/chrome/browser/ui/webui/history_ui.h +++ b/chrome/browser/ui/webui/history_ui.h @@ -14,10 +14,9 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "content/browser/webui/web_ui.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_message_handler.h" -class GURL; - // The handler for Javascript messages related to the "history" view. class BrowsingHistoryHandler : public content::WebUIMessageHandler, public content::NotificationObserver { @@ -78,7 +77,7 @@ class BrowsingHistoryHandler : public content::WebUIMessageHandler, DISALLOW_COPY_AND_ASSIGN(BrowsingHistoryHandler); }; -class HistoryUI : public WebUI { +class HistoryUI : public WebUI, public content::WebUIController { public: explicit HistoryUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/html_dialog_ui.cc b/chrome/browser/ui/webui/html_dialog_ui.cc index 31abaa1..e207538 100644 --- a/chrome/browser/ui/webui/html_dialog_ui.cc +++ b/chrome/browser/ui/webui/html_dialog_ui.cc @@ -23,7 +23,7 @@ static base::LazyInstance<base::PropertyAccessor<HtmlDialogUIDelegate*> > g_html_dialog_ui_property_accessor = LAZY_INSTANCE_INITIALIZER; HtmlDialogUI::HtmlDialogUI(WebContents* web_contents) - : WebUI(web_contents) { + : WebUI(web_contents, this) { } HtmlDialogUI::~HtmlDialogUI() { @@ -77,8 +77,6 @@ void HtmlDialogUI::RenderViewCreated(RenderViewHost* render_view_host) { chrome::NOTIFICATION_HTML_DIALOG_SHOWN, content::Source<WebUI>(this), content::Details<RenderViewHost>(render_view_host)); - - WebUI::RenderViewCreated(render_view_host); } void HtmlDialogUI::OnDialogClosed(const ListValue* args) { diff --git a/chrome/browser/ui/webui/html_dialog_ui.h b/chrome/browser/ui/webui/html_dialog_ui.h index 3253c91..322242e 100644 --- a/chrome/browser/ui/webui/html_dialog_ui.h +++ b/chrome/browser/ui/webui/html_dialog_ui.h @@ -11,6 +11,7 @@ #include "base/string16.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" #include "googleurl/src/gurl.h" #include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" @@ -95,7 +96,7 @@ class HtmlDialogUIDelegate { // there and call it back. This is a bit of a hack to allow the dialog to pass // its delegate to the Web UI without having nasty accessors on the WebContents. // The correct design using RVH directly would avoid all of this. -class HtmlDialogUI : public WebUI { +class HtmlDialogUI : public WebUI, public content::WebUIController { public: struct HtmlDialogParams { // The URL for the content that will be loaded in the dialog. @@ -120,7 +121,7 @@ class HtmlDialogUI : public WebUI { static base::PropertyAccessor<HtmlDialogUIDelegate*>& GetPropertyAccessor(); private: - // WebUI + // WebUIController virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; // JS message handler. diff --git a/chrome/browser/ui/webui/keyboard_ui.cc b/chrome/browser/ui/webui/keyboard_ui.cc index 5b21b62..1644d1a 100644 --- a/chrome/browser/ui/webui/keyboard_ui.cc +++ b/chrome/browser/ui/webui/keyboard_ui.cc @@ -19,7 +19,7 @@ using content::WebContents; // KeyboardUI KeyboardUI::KeyboardUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { KeyboardHTMLSource* html_source = new KeyboardHTMLSource(); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); profile->GetChromeURLDataManager()->AddDataSource(html_source); diff --git a/chrome/browser/ui/webui/keyboard_ui.h b/chrome/browser/ui/webui/keyboard_ui.h index 82cd495..dc6eaba 100644 --- a/chrome/browser/ui/webui/keyboard_ui.h +++ b/chrome/browser/ui/webui/keyboard_ui.h @@ -10,9 +10,10 @@ #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // The TabContents used for the keyboard page. -class KeyboardUI : public WebUI { +class KeyboardUI : public WebUI, public content::WebUIController { public: explicit KeyboardUI(content::WebContents* manager); virtual ~KeyboardUI(); diff --git a/chrome/browser/ui/webui/media/media_internals_ui.cc b/chrome/browser/ui/webui/media/media_internals_ui.cc index 3fdc900..92c175f 100644 --- a/chrome/browser/ui/webui/media/media_internals_ui.cc +++ b/chrome/browser/ui/webui/media/media_internals_ui.cc @@ -39,7 +39,7 @@ ChromeWebUIDataSource* CreateMediaInternalsHTMLSource() { //////////////////////////////////////////////////////////////////////////////// MediaInternalsUI::MediaInternalsUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { AddMessageHandler(new MediaInternalsMessageHandler()); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); diff --git a/chrome/browser/ui/webui/media/media_internals_ui.h b/chrome/browser/ui/webui/media/media_internals_ui.h index 9e31f24..b3951de 100644 --- a/chrome/browser/ui/webui/media/media_internals_ui.h +++ b/chrome/browser/ui/webui/media/media_internals_ui.h @@ -7,9 +7,10 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // The implementation for the chrome://media-internals page. -class MediaInternalsUI : public WebUI { +class MediaInternalsUI : public WebUI, public content::WebUIController { public: explicit MediaInternalsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc index 028ad48..b19a6c4 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc @@ -1637,7 +1637,7 @@ Value* NetInternalsUI::GetConstants() { return constants_dict; } -NetInternalsUI::NetInternalsUI(WebContents* contents) : WebUI(contents) { +NetInternalsUI::NetInternalsUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new NetInternalsMessageHandler()); // Set up the chrome://net-internals/ source. diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.h b/chrome/browser/ui/webui/net_internals/net_internals_ui.h index 948758d..11b5c51 100644 --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.h +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.h @@ -7,12 +7,13 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace base { class Value; } -class NetInternalsUI : public WebUI { +class NetInternalsUI : public WebUI, public content::WebUIController { public: explicit NetInternalsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.cc b/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.cc index 877b5b2..36fdd46 100644 --- a/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.cc +++ b/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.cc @@ -26,7 +26,7 @@ ChromeWebUIDataSource* CreateNetworkActionPredictorUIHTMLSource() { NetworkActionPredictorUI::NetworkActionPredictorUI( content::WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); AddMessageHandler(new NetworkActionPredictorDOMHandler(profile)); profile->GetChromeURLDataManager()->AddDataSource( diff --git a/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.h b/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.h index 185ab87..68d4115 100644 --- a/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.h +++ b/chrome/browser/ui/webui/network_action_predictor/network_action_predictor_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class NetworkActionPredictorUI : public WebUI { +class NetworkActionPredictorUI : public WebUI, public content::WebUIController { public: explicit NetworkActionPredictorUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.cc b/chrome/browser/ui/webui/ntp/new_tab_ui.cc index 36e0d21..3b76dc9 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.cc +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.cc @@ -75,7 +75,7 @@ static base::LazyInstance<std::set<const WebUI*> > g_live_new_tabs; // NewTabUI NewTabUI::NewTabUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { g_live_new_tabs.Pointer()->insert(this); // Override some options on the Web UI. hide_favicon_ = true; @@ -172,12 +172,10 @@ bool NewTabUI::CanShowBookmarkBar() const { void NewTabUI::RenderViewCreated(RenderViewHost* render_view_host) { StartTimingPaint(render_view_host); - WebUI::RenderViewCreated(render_view_host); } void NewTabUI::RenderViewReused(RenderViewHost* render_view_host) { StartTimingPaint(render_view_host); - WebUI::RenderViewReused(render_view_host); } void NewTabUI::Observe(int type, diff --git a/chrome/browser/ui/webui/ntp/new_tab_ui.h b/chrome/browser/ui/webui/ntp/new_tab_ui.h index e8c07cd..c2d1cc9 100644 --- a/chrome/browser/ui/webui/ntp/new_tab_ui.h +++ b/chrome/browser/ui/webui/ntp/new_tab_ui.h @@ -16,13 +16,14 @@ #include "content/browser/webui/web_ui.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "content/public/browser/web_ui_controller.h" class GURL; class PrefService; class Profile; // The TabContents used for the New Tab page. -class NewTabUI : public WebUI, +class NewTabUI : public WebUI, public content::WebUIController, public content::NotificationObserver { public: explicit NewTabUI(content::WebContents* manager); @@ -42,8 +43,7 @@ class NewTabUI : public WebUI, // The current preference version. static int current_pref_version() { return current_pref_version_; } - // Override WebUI methods so we can hook up the paint timer to the render - // view host. + // WebUIController implementation: virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; diff --git a/chrome/browser/ui/webui/options/options_ui.cc b/chrome/browser/ui/webui/options/options_ui.cc index e9a9dd8..e20419b 100644 --- a/chrome/browser/ui/webui/options/options_ui.cc +++ b/chrome/browser/ui/webui/options/options_ui.cc @@ -199,7 +199,7 @@ void OptionsPageUIHandler::RegisterTitle(DictionaryValue* localized_strings, //////////////////////////////////////////////////////////////////////////////// OptionsUI::OptionsUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), initialized_handlers_(false) { DictionaryValue* localized_strings = new DictionaryValue(); @@ -302,12 +302,10 @@ OptionsUI::~OptionsUI() { // Override. void OptionsUI::RenderViewCreated(RenderViewHost* render_view_host) { SetCommandLineString(render_view_host); - WebUI::RenderViewCreated(render_view_host); } void OptionsUI::RenderViewReused(RenderViewHost* render_view_host) { SetCommandLineString(render_view_host); - WebUI::RenderViewReused(render_view_host); } void OptionsUI::DidBecomeActiveForReusedRenderView() { @@ -318,8 +316,6 @@ void OptionsUI::DidBecomeActiveForReusedRenderView() { // happens, call reinitializeCore (which is a no-op unless the DOM was already // initialized). CallJavascriptFunction("OptionsPage.reinitializeCore"); - - WebUI::DidBecomeActiveForReusedRenderView(); } // static diff --git a/chrome/browser/ui/webui/options/options_ui.h b/chrome/browser/ui/webui/options/options_ui.h index 7b4f6af..fbb99f6 100644 --- a/chrome/browser/ui/webui/options/options_ui.h +++ b/chrome/browser/ui/webui/options/options_ui.h @@ -15,6 +15,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_message_handler.h" // The base class handler of Javascript messages of options pages. @@ -79,7 +80,7 @@ class OptionsPageUIHandlerHost { }; // The WebUI for chrome:settings. -class OptionsUI : public WebUI, +class OptionsUI : public WebUI, public content::WebUIController, public OptionsPageUIHandlerHost { public: explicit OptionsUI(content::WebContents* contents); @@ -87,7 +88,7 @@ class OptionsUI : public WebUI, static RefCountedMemory* GetFaviconResourceBytes(); - // WebUI implementation. + // WebUIController implementation. virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; diff --git a/chrome/browser/ui/webui/options2/options_ui2.cc b/chrome/browser/ui/webui/options2/options_ui2.cc index a56f512..c679d976 100644 --- a/chrome/browser/ui/webui/options2/options_ui2.cc +++ b/chrome/browser/ui/webui/options2/options_ui2.cc @@ -196,7 +196,7 @@ void OptionsPageUIHandler::RegisterTitle(DictionaryValue* localized_strings, //////////////////////////////////////////////////////////////////////////////// OptionsUI::OptionsUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), initialized_handlers_(false) { DictionaryValue* localized_strings = new DictionaryValue(); @@ -294,15 +294,12 @@ OptionsUI::~OptionsUI() { } } -// Override. void OptionsUI::RenderViewCreated(RenderViewHost* render_view_host) { SetCommandLineString(render_view_host); - WebUI::RenderViewCreated(render_view_host); } void OptionsUI::RenderViewReused(RenderViewHost* render_view_host) { SetCommandLineString(render_view_host); - WebUI::RenderViewReused(render_view_host); } void OptionsUI::DidBecomeActiveForReusedRenderView() { @@ -313,8 +310,6 @@ void OptionsUI::DidBecomeActiveForReusedRenderView() { // happens, call reinitializeCore (which is a no-op unless the DOM was already // initialized). CallJavascriptFunction("OptionsPage.reinitializeCore"); - - WebUI::DidBecomeActiveForReusedRenderView(); } // static diff --git a/chrome/browser/ui/webui/options2/options_ui2.h b/chrome/browser/ui/webui/options2/options_ui2.h index f443c21..8a4885a 100644 --- a/chrome/browser/ui/webui/options2/options_ui2.h +++ b/chrome/browser/ui/webui/options2/options_ui2.h @@ -15,6 +15,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "content/public/browser/notification_types.h" +#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_message_handler.h" namespace options2 { @@ -81,7 +82,7 @@ class OptionsPageUIHandlerHost { }; // The WebUI for chrome:settings-frame. -class OptionsUI : public WebUI, +class OptionsUI : public WebUI, public content::WebUIController, public OptionsPageUIHandlerHost { public: explicit OptionsUI(content::WebContents* contents); @@ -89,7 +90,7 @@ class OptionsUI : public WebUI, static RefCountedMemory* GetFaviconResourceBytes(); - // WebUI implementation. + // WebUIController implementation. virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; virtual void RenderViewReused(RenderViewHost* render_view_host) OVERRIDE; virtual void DidBecomeActiveForReusedRenderView() OVERRIDE; diff --git a/chrome/browser/ui/webui/plugins_ui.cc b/chrome/browser/ui/webui/plugins_ui.cc index be3bb9d..d8db51f 100644 --- a/chrome/browser/ui/webui/plugins_ui.cc +++ b/chrome/browser/ui/webui/plugins_ui.cc @@ -374,7 +374,7 @@ void PluginsDOMHandler::PluginsLoaded(const std::vector<PluginGroup>& groups) { // /////////////////////////////////////////////////////////////////////////////// -PluginsUI::PluginsUI(WebContents* contents) : WebUI(contents) { +PluginsUI::PluginsUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new PluginsDOMHandler()); // Set up the chrome://plugins/ source. diff --git a/chrome/browser/ui/webui/plugins_ui.h b/chrome/browser/ui/webui/plugins_ui.h index 3c2b010..1f1ecfc46 100644 --- a/chrome/browser/ui/webui/plugins_ui.h +++ b/chrome/browser/ui/webui/plugins_ui.h @@ -7,11 +7,12 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class PrefService; class RefCountedMemory; -class PluginsUI : public WebUI { +class PluginsUI : public WebUI, public content::WebUIController { public: explicit PluginsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/policy_ui.cc b/chrome/browser/ui/webui/policy_ui.cc index 875823e..ea470a5 100644 --- a/chrome/browser/ui/webui/policy_ui.cc +++ b/chrome/browser/ui/webui/policy_ui.cc @@ -233,7 +233,7 @@ string16 PolicyUIHandler::CreateStatusMessageString( // //////////////////////////////////////////////////////////////////////////////// -PolicyUI::PolicyUI(WebContents* contents) : WebUI(contents) { +PolicyUI::PolicyUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new PolicyUIHandler); // Set up the chrome://policy/ source. diff --git a/chrome/browser/ui/webui/policy_ui.h b/chrome/browser/ui/webui/policy_ui.h index 943be7e..e59a1a3 100644 --- a/chrome/browser/ui/webui/policy_ui.h +++ b/chrome/browser/ui/webui/policy_ui.h @@ -11,6 +11,7 @@ #include "chrome/browser/policy/cloud_policy_subsystem.h" #include "chrome/browser/policy/configuration_policy_reader.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_message_handler.h" namespace policy { @@ -70,7 +71,7 @@ class PolicyUIHandler : public content::WebUIMessageHandler, }; // The Web UI handler for about:policy. -class PolicyUI : public WebUI { +class PolicyUI : public WebUI, public content::WebUIController { public: explicit PolicyUI(content::WebContents* contents); virtual ~PolicyUI(); diff --git a/chrome/browser/ui/webui/profiler_ui.cc b/chrome/browser/ui/webui/profiler_ui.cc index b42980a..40ad021 100644 --- a/chrome/browser/ui/webui/profiler_ui.cc +++ b/chrome/browser/ui/webui/profiler_ui.cc @@ -144,7 +144,7 @@ void ProfilerMessageHandler::OnResetData(const ListValue* list) { } // namespace -ProfilerUI::ProfilerUI(WebContents* contents) : WebUI(contents) { +ProfilerUI::ProfilerUI(WebContents* contents) : WebUI(contents, this) { ui_weak_ptr_factory_.reset(new base::WeakPtrFactory<ProfilerUI>(this)); ui_weak_ptr_ = ui_weak_ptr_factory_->GetWeakPtr(); diff --git a/chrome/browser/ui/webui/profiler_ui.h b/chrome/browser/ui/webui/profiler_ui.h index 604d47c..caa486c 100644 --- a/chrome/browser/ui/webui/profiler_ui.h +++ b/chrome/browser/ui/webui/profiler_ui.h @@ -10,9 +10,10 @@ #include "base/memory/weak_ptr.h" #include "base/values.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // The C++ back-end for the chrome://profiler webui page. -class ProfilerUI : public WebUI { +class ProfilerUI : public WebUI, public content::WebUIController { public: explicit ProfilerUI(content::WebContents* contents); virtual ~ProfilerUI(); diff --git a/chrome/browser/ui/webui/quota_internals_ui.cc b/chrome/browser/ui/webui/quota_internals_ui.cc index 3f05655..d5ab701 100644 --- a/chrome/browser/ui/webui/quota_internals_ui.cc +++ b/chrome/browser/ui/webui/quota_internals_ui.cc @@ -37,7 +37,7 @@ ChromeWebUIDataSource* CreateQuotaInternalsHTMLSource() { } // namespace QuotaInternalsUI::QuotaInternalsUI(WebContents* contents) - : WebUI(contents) { + : WebUI(contents, this) { AddMessageHandler(new quota_internals::QuotaInternalsHandler); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); profile->GetChromeURLDataManager()->AddDataSource( diff --git a/chrome/browser/ui/webui/quota_internals_ui.h b/chrome/browser/ui/webui/quota_internals_ui.h index dabbda3..786f009 100644 --- a/chrome/browser/ui/webui/quota_internals_ui.h +++ b/chrome/browser/ui/webui/quota_internals_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class QuotaInternalsUI : public WebUI { +class QuotaInternalsUI : public WebUI, public content::WebUIController { public: explicit QuotaInternalsUI(content::WebContents* contents); virtual ~QuotaInternalsUI() {} diff --git a/chrome/browser/ui/webui/sessions_ui.cc b/chrome/browser/ui/webui/sessions_ui.cc index fd04f30..3d45a19 100644 --- a/chrome/browser/ui/webui/sessions_ui.cc +++ b/chrome/browser/ui/webui/sessions_ui.cc @@ -257,7 +257,7 @@ void SessionsDOMHandler::UpdateUI() { // /////////////////////////////////////////////////////////////////////////////// -SessionsUI::SessionsUI(WebContents* contents) : WebUI(contents) { +SessionsUI::SessionsUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new SessionsDOMHandler()); // Set up the chrome://sessions/ source. diff --git a/chrome/browser/ui/webui/sessions_ui.h b/chrome/browser/ui/webui/sessions_ui.h index 5a3e489..479e8bf 100644 --- a/chrome/browser/ui/webui/sessions_ui.h +++ b/chrome/browser/ui/webui/sessions_ui.h @@ -7,10 +7,11 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class RefCountedMemory; -class SessionsUI : public WebUI { +class SessionsUI : public WebUI, public content::WebUIController { public: explicit SessionsUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/sync_internals_ui.cc b/chrome/browser/ui/webui/sync_internals_ui.cc index 249fd09..a68d380 100644 --- a/chrome/browser/ui/webui/sync_internals_ui.cc +++ b/chrome/browser/ui/webui/sync_internals_ui.cc @@ -73,7 +73,7 @@ ProfileSyncService* GetProfileSyncService(Profile* profile) { } // namespace SyncInternalsUI::SyncInternalsUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { // TODO(akalin): Fix. Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); @@ -94,9 +94,9 @@ SyncInternalsUI::~SyncInternalsUI() { } } -void SyncInternalsUI::OnWebUISend(const GURL& source_url, - const std::string& name, - const ListValue& content) { +bool SyncInternalsUI::OverrideHandleWebUIMessage(const GURL& source_url, + const std::string& name, + const ListValue& content) { scoped_ptr<ListValue> content_copy(content.DeepCopy()); JsArgList args(content_copy.get()); VLOG(1) << "Received message: " << name << " with args " @@ -122,6 +122,7 @@ void SyncInternalsUI::OnWebUISend(const GURL& source_url, << " with args " << args.ToString(); } } + return true; } void SyncInternalsUI::HandleJsEvent( diff --git a/chrome/browser/ui/webui/sync_internals_ui.h b/chrome/browser/ui/webui/sync_internals_ui.h index 21a7982..bf6567d 100644 --- a/chrome/browser/ui/webui/sync_internals_ui.h +++ b/chrome/browser/ui/webui/sync_internals_ui.h @@ -14,20 +14,21 @@ #include "chrome/browser/sync/js/js_event_handler.h" #include "chrome/browser/sync/js/js_reply_handler.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" namespace browser_sync { class JsController; } // namespace browser_sync // The implementation for the chrome://sync-internals page. -class SyncInternalsUI : public WebUI, +class SyncInternalsUI : public WebUI, public content::WebUIController, public browser_sync::JsEventHandler, public browser_sync::JsReplyHandler { public: explicit SyncInternalsUI(content::WebContents* contents); virtual ~SyncInternalsUI(); - // WebUI implementation. + // WebUIController implementation. // // The following messages are processed: // @@ -40,9 +41,9 @@ class SyncInternalsUI : public WebUI, // // TODO(akalin): Add a simple isSyncEnabled() message and make // getAboutInfo() be handled by the sync service. - virtual void OnWebUISend(const GURL& source_url, - const std::string& name, - const base::ListValue& args) OVERRIDE; + virtual bool OverrideHandleWebUIMessage(const GURL& source_url, + const std::string& name, + const base::ListValue& args) OVERRIDE; // browser_sync::JsEventHandler implementation. virtual void HandleJsEvent( diff --git a/chrome/browser/ui/webui/sync_internals_ui_unittest.cc b/chrome/browser/ui/webui/sync_internals_ui_unittest.cc index 9e5fe31..96e41da 100644 --- a/chrome/browser/ui/webui/sync_internals_ui_unittest.cc +++ b/chrome/browser/ui/webui/sync_internals_ui_unittest.cc @@ -17,6 +17,7 @@ #include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/profile_mock.h" #include "content/browser/tab_contents/test_tab_contents.h" +#include "content/public/browser/web_ui_controller.h" #include "content/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -121,7 +122,8 @@ TEST_F(SyncInternalsUITestWithService, OnWebUISendBasic) { EXPECT_CALL(mock_js_controller_, ProcessJsMessage(name, HasArgsAsList(args), _)); - test_sync_internals_ui_->OnWebUISend(GURL(), name, args); + test_sync_internals_ui_->controller()->OverrideHandleWebUIMessage( + GURL(), name, args); } // Tests with NULL ProfileSyncService. @@ -183,7 +185,8 @@ TEST_F(SyncInternalsUITestWithoutService, OnWebUISendBasic) { args.Append(Value::CreateIntegerValue(5)); // Should drop the message. - test_sync_internals_ui_->OnWebUISend(GURL(), name, args); + test_sync_internals_ui_->controller()->OverrideHandleWebUIMessage( + GURL(), name, args); } // TODO(lipalani) - add a test case to test about:sync with a non null @@ -195,7 +198,8 @@ TEST_F(SyncInternalsUITestWithoutService, OnWebUISendGetAboutInfo) { ExecuteJavascript(ASCIIToUTF16(kAboutInfoCall))); ListValue args; - test_sync_internals_ui_->OnWebUISend(GURL(), "getAboutInfo", args); + test_sync_internals_ui_->controller()->OverrideHandleWebUIMessage( + GURL(), "getAboutInfo", args); } } // namespace diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc index 0bf5cb4..4a88294 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc @@ -105,7 +105,7 @@ bool GetValueForKeyInQuery(const GURL& url, const std::string& search_key, } // namespace -SyncPromoUI::SyncPromoUI(WebContents* contents) : WebUI(contents) { +SyncPromoUI::SyncPromoUI(WebContents* contents) : WebUI(contents, this) { should_hide_url_ = true; SyncPromoHandler* handler = new SyncPromoHandler( diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h index ec43711..b4764c9 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h @@ -7,12 +7,13 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" class Profile; class PrefService; // The Web UI handler for chrome://syncpromo. -class SyncPromoUI : public WebUI { +class SyncPromoUI : public WebUI, public content::WebUIController { public: // Constructs a SyncPromoUI. |contents| is the WebContents that this WebUI is // associated with. |contents| may not be NULL. diff --git a/chrome/browser/ui/webui/task_manager_ui.cc b/chrome/browser/ui/webui/task_manager_ui.cc index b569938..998c688 100644 --- a/chrome/browser/ui/webui/task_manager_ui.cc +++ b/chrome/browser/ui/webui/task_manager_ui.cc @@ -77,7 +77,7 @@ ChromeWebUIDataSource* CreateTaskManagerUIHTMLSource() { // /////////////////////////////////////////////////////////////////////////////// -TaskManagerUI::TaskManagerUI(WebContents* contents) : WebUI(contents) { +TaskManagerUI::TaskManagerUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new TaskManagerHandler(TaskManager::GetInstance())); // Set up the chrome://taskmanager/ source. diff --git a/chrome/browser/ui/webui/task_manager_ui.h b/chrome/browser/ui/webui/task_manager_ui.h index 0c51718..4d3425b 100644 --- a/chrome/browser/ui/webui/task_manager_ui.h +++ b/chrome/browser/ui/webui/task_manager_ui.h @@ -7,8 +7,9 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class TaskManagerUI : public WebUI { +class TaskManagerUI : public WebUI, public content::WebUIController { public: explicit TaskManagerUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/test_chrome_web_ui_factory_browsertest.cc b/chrome/browser/ui/webui/test_chrome_web_ui_factory_browsertest.cc index ad58c4e..399bf653 100644 --- a/chrome/browser/ui/webui/test_chrome_web_ui_factory_browsertest.cc +++ b/chrome/browser/ui/webui/test_chrome_web_ui_factory_browsertest.cc @@ -4,6 +4,7 @@ #include "chrome/browser/ui/webui/chrome_web_ui.h" #include "chrome/browser/ui/webui/test_chrome_web_ui_factory.h" +#include "content/public/browser/web_ui_controller.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "googleurl/src/gurl.h" @@ -19,7 +20,8 @@ namespace { // Returns a new WebUI object for the TabContents from |arg0|. ACTION(ReturnNewWebUI) { - return new WebUI(arg0); + static content::WebUIController temp_controller; + return new WebUI(arg0, &temp_controller); } // Mock the TestChromeWebUIFactory::WebUIProvider to prove that we are called as diff --git a/chrome/browser/ui/webui/tracing_ui.cc b/chrome/browser/ui/webui/tracing_ui.cc index cab2742..100d8d5 100644 --- a/chrome/browser/ui/webui/tracing_ui.cc +++ b/chrome/browser/ui/webui/tracing_ui.cc @@ -411,7 +411,7 @@ void TracingMessageHandler::OnTraceBufferPercentFullReply(float percent_full) { // //////////////////////////////////////////////////////////////////////////////// -TracingUI::TracingUI(WebContents* contents) : WebUI(contents) { +TracingUI::TracingUI(WebContents* contents) : WebUI(contents, this) { AddMessageHandler(new TracingMessageHandler()); // Set up the chrome://tracing/ source. diff --git a/chrome/browser/ui/webui/tracing_ui.h b/chrome/browser/ui/webui/tracing_ui.h index 93d7a7c..1598f70 100644 --- a/chrome/browser/ui/webui/tracing_ui.h +++ b/chrome/browser/ui/webui/tracing_ui.h @@ -7,9 +7,10 @@ #pragma once #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // The C++ back-end for the chrome://tracing webui page. -class TracingUI : public WebUI { +class TracingUI : public WebUI, public content::WebUIController { public: explicit TracingUI(content::WebContents* contents); diff --git a/chrome/browser/ui/webui/uber/uber_ui.cc b/chrome/browser/ui/webui/uber/uber_ui.cc index e2e76b9..5920a6f 100644 --- a/chrome/browser/ui/webui/uber/uber_ui.cc +++ b/chrome/browser/ui/webui/uber/uber_ui.cc @@ -50,7 +50,7 @@ ChromeWebUIDataSource* CreateUberHTMLSource() { } // namespace -UberUI::UberUI(WebContents* contents) : WebUI(contents) { +UberUI::UberUI(WebContents* contents) : WebUI(contents, this) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); profile->GetChromeURLDataManager()->AddDataSource(CreateUberHTMLSource()); @@ -76,41 +76,36 @@ void UberUI::RegisterSubpage(const std::string& page_url) { void UberUI::RenderViewCreated(RenderViewHost* render_view_host) { for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end(); ++iter) { - iter->second->RenderViewCreated(render_view_host); + iter->second->controller()->RenderViewCreated(render_view_host); } - - WebUI::RenderViewCreated(render_view_host); } void UberUI::RenderViewReused(RenderViewHost* render_view_host) { for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end(); ++iter) { - iter->second->RenderViewReused(render_view_host); + iter->second->controller()->RenderViewReused(render_view_host); } - - WebUI::RenderViewReused(render_view_host); } void UberUI::DidBecomeActiveForReusedRenderView() { for (SubpageMap::iterator iter = sub_uis_.begin(); iter != sub_uis_.end(); ++iter) { - iter->second->DidBecomeActiveForReusedRenderView(); + iter->second->controller()->DidBecomeActiveForReusedRenderView(); } - - WebUI::DidBecomeActiveForReusedRenderView(); } -void UberUI::OnWebUISend(const GURL& source_url, - const std::string& message, - const ListValue& args) { +bool UberUI::OverrideHandleWebUIMessage(const GURL& source_url, + const std::string& message, + const ListValue& args) { // Find the appropriate subpage and forward the message. SubpageMap::iterator subpage = sub_uis_.find(source_url.GetOrigin().spec()); if (subpage == sub_uis_.end()) { // The message was sent from the uber page itself. DCHECK_EQ(std::string(chrome::kChromeUIUberHost), source_url.host()); - WebUI::OnWebUISend(source_url, message, args); - } else { - // The message was sent from a subpage. - subpage->second->OnWebUISend(source_url, message, args); + return false; } + + // The message was sent from a subpage. + return subpage->second->controller()->OverrideHandleWebUIMessage( + source_url, message, args); } diff --git a/chrome/browser/ui/webui/uber/uber_ui.h b/chrome/browser/ui/webui/uber/uber_ui.h index ce077af..5a39bd2 100644 --- a/chrome/browser/ui/webui/uber/uber_ui.h +++ b/chrome/browser/ui/webui/uber/uber_ui.h @@ -11,19 +11,20 @@ #include "base/memory/scoped_vector.h" #include "base/values.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" // The WebUI class for the uber page (chrome://chrome). It manages the UI for // the uber page (navigation bar and so forth) as well as WebUI objects for // pages that appear in the uber page. -class UberUI : public WebUI { +class UberUI : public WebUI, public content::WebUIController { public: explicit UberUI(content::WebContents* contents); virtual ~UberUI(); - // WebUI implementation. - virtual void OnWebUISend(const GURL& source_url, - const std::string& message, - const ListValue& args) OVERRIDE; + // WebUIController implementation. + virtual bool OverrideHandleWebUIMessage(const GURL& source_url, + const std::string& message, + const ListValue& args) OVERRIDE; // We forward these to |sub_uis_|. virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; diff --git a/chrome/browser/ui/webui/web_ui_browsertest.cc b/chrome/browser/ui/webui/web_ui_browsertest.cc index 83939fe..37af967 100644 --- a/chrome/browser/ui/webui/web_ui_browsertest.cc +++ b/chrome/browser/ui/webui/web_ui_browsertest.cc @@ -27,6 +27,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui_controller.h" #include "content/public/browser/web_ui_message_handler.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest-spi.h" @@ -288,7 +289,8 @@ class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider { // Returns a new WebUI WebUI* NewWebUI(WebContents* web_contents, const GURL& url) OVERRIDE { - return new MockWebUI(web_contents); + static content::WebUIController temp_controller; + return new MockWebUI(web_contents, &temp_controller); } private: diff --git a/chrome/browser/ui/webui/workers_ui.cc b/chrome/browser/ui/webui/workers_ui.cc index 77982d6..35e4a69 100644 --- a/chrome/browser/ui/webui/workers_ui.cc +++ b/chrome/browser/ui/webui/workers_ui.cc @@ -253,7 +253,7 @@ class WorkersUI::WorkerCreationDestructionListener }; WorkersUI::WorkersUI(WebContents* contents) - : WebUI(contents), + : WebUI(contents, this), observer_(new WorkerCreationDestructionListener(this)){ AddMessageHandler(new WorkersDOMHandler()); diff --git a/chrome/browser/ui/webui/workers_ui.h b/chrome/browser/ui/webui/workers_ui.h index 94e80b0..e08686b 100644 --- a/chrome/browser/ui/webui/workers_ui.h +++ b/chrome/browser/ui/webui/workers_ui.h @@ -8,8 +8,9 @@ #include "base/memory/ref_counted.h" #include "content/browser/webui/web_ui.h" +#include "content/public/browser/web_ui_controller.h" -class WorkersUI : public WebUI { +class WorkersUI : public WebUI, public content::WebUIController { public: explicit WorkersUI(content::WebContents* contents); virtual ~WorkersUI(); diff --git a/chrome/renderer/chrome_ppb_pdf_impl.cc b/chrome/renderer/chrome_ppb_pdf_impl.cc index 880d8c2..ba7e127 100644 --- a/chrome/renderer/chrome_ppb_pdf_impl.cc +++ b/chrome/renderer/chrome_ppb_pdf_impl.cc @@ -9,6 +9,7 @@ #include "build/build_config.h" #include "chrome/common/render_messages.h" #include "content/public/common/child_process_sandbox_support_linux.h" +#include "content/public/common/content_client.h" #include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" #include "grit/webkit_resources.h" @@ -123,7 +124,8 @@ static const ResourceImageInfo kResourceImageMap[] = { PP_Var GetLocalizedString(PP_Instance instance_id, PP_ResourceString string_id) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = + content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return PP_MakeUndefined(); @@ -159,7 +161,7 @@ PP_Resource GetResourceImage(PP_Instance instance_id, ResourceBundle::GetSharedInstance().GetBitmapNamed(res_id); // Validate the instance. - if (!HostGlobals::Get()->GetInstance(instance_id)) + if (!content::GetHostGlobals()->GetInstance(instance_id)) return 0; scoped_refptr<webkit::ppapi::PPB_ImageData_Impl> image_data( new webkit::ppapi::PPB_ImageData_Impl(instance_id)); @@ -187,7 +189,7 @@ PP_Resource GetFontFileWithFallback( PP_PrivateFontCharset charset) { #if defined(OS_LINUX) || defined(OS_OPENBSD) // Validate the instance before using it below. - if (!HostGlobals::Get()->GetInstance(instance_id)) + if (!content::GetHostGlobals()->GetInstance(instance_id)) return 0; scoped_refptr<ppapi::StringVar> face_name(ppapi::StringVar::FromPPVar( @@ -281,21 +283,23 @@ void SearchString(PP_Instance instance, } void DidStartLoading(PP_Instance instance_id) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return; instance->delegate()->DidStartLoading(); } void DidStopLoading(PP_Instance instance_id) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = + content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return; instance->delegate()->DidStopLoading(); } void SetContentRestriction(PP_Instance instance_id, int restrictions) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = + content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return; instance->delegate()->SetContentRestriction(restrictions); @@ -313,7 +317,8 @@ void UserMetricsRecordAction(PP_Var action) { } void HasUnsupportedFeature(PP_Instance instance_id) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = + content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return; @@ -328,7 +333,8 @@ void HasUnsupportedFeature(PP_Instance instance_id) { } void SaveAs(PP_Instance instance_id) { - PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); + PluginInstance* instance = + content::GetHostGlobals()->GetInstance(instance_id); if (!instance) return; instance->delegate()->SaveURLAs(instance->plugin_url()); |