diff options
Diffstat (limited to 'chrome/browser/debugger')
-rw-r--r-- | chrome/browser/debugger/debugger_contents.cc | 24 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_contents.h | 17 |
2 files changed, 28 insertions, 13 deletions
diff --git a/chrome/browser/debugger/debugger_contents.cc b/chrome/browser/debugger/debugger_contents.cc index 19565e8..386b5d8 100644 --- a/chrome/browser/debugger/debugger_contents.cc +++ b/chrome/browser/debugger/debugger_contents.cc @@ -19,6 +19,9 @@ #include "grit/debugger_resources.h" +// DebuggerUI is accessible from chrome-ui://inspector. +static const char kDebuggerHost[] = "inspector"; + class DebuggerHTMLSource : public ChromeURLDataManager::DataSource { public: // Creates our datasource and sets our user message to a specific message @@ -86,8 +89,8 @@ class DebuggerHTMLSource : public ChromeURLDataManager::DataSource { class DebuggerHandler : public DOMMessageHandler { public: - explicit DebuggerHandler(DOMUIHost* host) { - host->RegisterMessageCallback("DebuggerHostMessage", + explicit DebuggerHandler(DOMUI* dom_ui) : DOMMessageHandler(dom_ui) { + dom_ui->RegisterMessageCallback("DebuggerHostMessage", NewCallback(this, &DebuggerHandler::HandleDebuggerHostMessage)); } @@ -118,12 +121,11 @@ class DebuggerHandler : public DOMMessageHandler { }; -DebuggerContents::DebuggerContents(Profile* profile, SiteInstance* instance) - : DOMUIHost(profile, instance, NULL) { - set_type(TAB_CONTENTS_DEBUGGER); +DebuggerContents::DebuggerContents(DOMUIContents* contents) + : DOMUI(contents) { } -void DebuggerContents::AttachMessageHandlers() { +void DebuggerContents::Init() { AddMessageHandler(new DebuggerHandler(this)); DebuggerHTMLSource* html_source = new DebuggerHTMLSource(); @@ -135,6 +137,14 @@ void DebuggerContents::AttachMessageHandlers() { // static bool DebuggerContents::IsDebuggerUrl(const GURL& url) { - return (url.SchemeIs("chrome-ui") && url.host() == "inspector"); + return (url.SchemeIs(DOMUIContents::GetScheme().c_str()) && + url.host() == kDebuggerHost); } +// static +GURL DebuggerContents::GetBaseURL() { + std::string url = DOMUIContents::GetScheme(); + url += "://"; + url += kDebuggerHost; + return GURL(url); +} diff --git a/chrome/browser/debugger/debugger_contents.h b/chrome/browser/debugger/debugger_contents.h index af29f6a..69c33fd 100644 --- a/chrome/browser/debugger/debugger_contents.h +++ b/chrome/browser/debugger/debugger_contents.h @@ -7,24 +7,29 @@ #ifndef CHROME_BROWSER_SHELL_DEBUGGER_CONTENTS_H__ #define CHROME_BROWSER_SHELL_DEBUGGER_CONTENTS_H__ -#include "chrome/browser/dom_ui/dom_ui_host.h" +#include "chrome/browser/dom_ui/dom_ui.h" -class DebuggerContents : public DOMUIHost { +class DebuggerContents : public DOMUI { public: - DebuggerContents(Profile* profile, SiteInstance* instance); + DebuggerContents(DOMUIContents* contents); + + // DOMUI Implementation + virtual void Init(); + + // Return the URL for the front page of this UI. + static GURL GetBaseURL(); static bool IsDebuggerUrl(const GURL& url); protected: + DOMUIContents* contents_; + // WebContents overrides: // We override updating history with a no-op so these pages // are not saved to history. virtual void UpdateHistoryForNavigation(const GURL& url, const ViewHostMsg_FrameNavigate_Params& params) { } - // DOMUIHost implementation. - virtual void AttachMessageHandlers(); - DISALLOW_EVIL_CONSTRUCTORS(DebuggerContents); }; |