summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dev_tools_ui.cc23
-rw-r--r--chrome/browser/dom_ui/dev_tools_ui.h26
-rw-r--r--chrome/browser/dom_ui/dom_ui.h3
-rw-r--r--chrome/browser/dom_ui/dom_ui_contents.cc8
-rw-r--r--chrome/browser/dom_ui/dom_ui_contents.h6
5 files changed, 64 insertions, 2 deletions
diff --git a/chrome/browser/dom_ui/dev_tools_ui.cc b/chrome/browser/dom_ui/dev_tools_ui.cc
new file mode 100644
index 0000000..327cd87
--- /dev/null
+++ b/chrome/browser/dom_ui/dev_tools_ui.cc
@@ -0,0 +1,23 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/dom_ui/dev_tools_ui.h"
+
+#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/common/render_messages.h"
+
+// DevToolsUI is accessible from chrome-ui://devtools.
+static const char kDevToolsHost[] = "devtools";
+
+// static
+GURL DevToolsUI::GetBaseURL() {
+ return GURL(DOMUIContents::GetScheme() + "://" + kDevToolsHost);
+}
+
+void DevToolsUI::RenderViewCreated(RenderViewHost* render_view_host) {
+ render_view_host->Send(new ViewMsg_SetupDevToolsClient(
+ render_view_host->routing_id()));
+}
+
+
diff --git a/chrome/browser/dom_ui/dev_tools_ui.h b/chrome/browser/dom_ui/dev_tools_ui.h
new file mode 100644
index 0000000..a13af96
--- /dev/null
+++ b/chrome/browser/dom_ui/dev_tools_ui.h
@@ -0,0 +1,26 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_DOM_UI_DEV_TOOLS_UI_H_
+#define CHROME_BROWSER_DOM_UI_DEV_TOOLS_UI_H_
+
+#include "chrome/browser/dom_ui/dom_ui.h"
+
+class DevToolsUI : public DOMUI {
+ public:
+ explicit DevToolsUI(DOMUIContents* contents) : DOMUI(contents) {}
+
+ // Return the URL for the front page of this UI.
+ static GURL GetBaseURL();
+
+ // DOMUI Implementation
+ virtual void Init() {}
+ virtual void RenderViewCreated(RenderViewHost* render_view_host);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DevToolsUI);
+};
+
+#endif // CHROME_BROWSER_DOM_UI_DEV_TOOLS_UI_H_
+
diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h
index 1de9c42..c9d34ed 100644
--- a/chrome/browser/dom_ui/dom_ui.h
+++ b/chrome/browser/dom_ui/dom_ui.h
@@ -10,6 +10,7 @@
class DictionaryValue;
class DOMMessageHandler;
+class RenderViewHost;
class Value;
// A DOMUI sets up the datasources and message handlers for a given HTML-based
@@ -21,6 +22,8 @@ class DOMUI {
virtual ~DOMUI();
virtual void Init() = 0;
+ virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
+
// Called from DOMUIContents.
void ProcessDOMUIMessage(const std::string& message,
const std::string& content);
diff --git a/chrome/browser/dom_ui/dom_ui_contents.cc b/chrome/browser/dom_ui/dom_ui_contents.cc
index f7b83a2..68b05d9 100644
--- a/chrome/browser/dom_ui/dom_ui_contents.cc
+++ b/chrome/browser/dom_ui/dom_ui_contents.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/dom_ui/dom_ui_contents.h"
#include "chrome/browser/debugger/debugger_contents.h"
+#include "chrome/browser/dom_ui/dev_tools_ui.h"
#include "chrome/browser/dom_ui/dom_ui.h"
#include "chrome/browser/dom_ui/downloads_ui.h"
#include "chrome/browser/dom_ui/history_ui.h"
@@ -167,6 +168,11 @@ WebPreferences DOMUIContents::GetWebkitPrefs() {
return web_prefs;
}
+void DOMUIContents::RenderViewCreated(RenderViewHost* render_view_host) {
+ DCHECK(current_ui_);
+ current_ui_->RenderViewCreated(render_view_host);
+}
+
bool DOMUIContents::ShouldDisplayFavIcon() {
if (current_ui_)
return current_ui_->ShouldDisplayFavIcon();
@@ -238,6 +244,8 @@ DOMUI* DOMUIContents::GetDOMUIForURL(const GURL &url) {
return new DownloadsUI(this);
} else if (url.host() == DebuggerContents::GetBaseURL().host()) {
return new DebuggerContents(this);
+ } else if (url.host() == DevToolsUI::GetBaseURL().host()) {
+ return new DevToolsUI(this);
}
#else
NOTIMPLEMENTED();
diff --git a/chrome/browser/dom_ui/dom_ui_contents.h b/chrome/browser/dom_ui/dom_ui_contents.h
index 8220b175c..948ea6f 100644
--- a/chrome/browser/dom_ui/dom_ui_contents.h
+++ b/chrome/browser/dom_ui/dom_ui_contents.h
@@ -12,7 +12,7 @@
#include "webkit/glue/webpreferences.h"
class DOMUI;
-class render_view_host;
+class RenderViewHost;
// FavIconSource is the gateway between network-level chrome:
// requests for favicons and the history backend that serves these.
@@ -113,6 +113,8 @@ class DOMUIContents : public WebContents {
virtual void RequestOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition);
+ virtual void RenderViewCreated(RenderViewHost* render_view_host);
+
//
// TabContents overrides
//
@@ -120,7 +122,7 @@ class DOMUIContents : public WebContents {
const ViewHostMsg_FrameNavigate_Params& params) { }
virtual bool NavigateToPendingEntry(bool reload);
- // Return the scheme used. We currently use chrome:
+ // Return the scheme used. We currently use chrome-ui:
static const std::string GetScheme();
private: