summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_dom_ui.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 08:46:25 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-01 08:46:25 +0000
commit811bfe371c3518e58664fb5191a6962314f8f05f (patch)
tree6dc3cb4264f9d87c93a2313fa856c1ea7e6e23e8 /chrome/browser/extensions/extension_dom_ui.cc
parent20fdbc31d0e998ba81d8337259b43e57e2ff02b7 (diff)
downloadchromium_src-811bfe371c3518e58664fb5191a6962314f8f05f.zip
chromium_src-811bfe371c3518e58664fb5191a6962314f8f05f.tar.gz
chromium_src-811bfe371c3518e58664fb5191a6962314f8f05f.tar.bz2
In this episode, we implement the DOMUI interface for extension views that are rendered in the main tab contents area. This gets us loaded and unloaded at the right place and removes many special cases for extensions from the RenderViewHost and RenderViewHostDelegate hierarchy.
BUG=13936 Review URL: http://codereview.chromium.org/126137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19717 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_dom_ui.cc')
-rw-r--r--chrome/browser/extensions/extension_dom_ui.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_dom_ui.cc b/chrome/browser/extensions/extension_dom_ui.cc
new file mode 100644
index 0000000..0d24345
--- /dev/null
+++ b/chrome/browser/extensions/extension_dom_ui.cc
@@ -0,0 +1,31 @@
+#include "chrome/browser/extensions/extension_dom_ui.h"
+
+#include "chrome/browser/browser.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/bindings_policy.h"
+
+ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents)
+ : DOMUI(tab_contents) {
+ // TODO(aa): It would be cool to show the extension's icon in here.
+ hide_favicon_ = true;
+ should_hide_url_ = true;
+ bindings_ = BindingsPolicy::EXTENSION;
+}
+
+void ExtensionDOMUI::RenderViewCreated(RenderViewHost* render_view_host) {
+ extension_function_dispatcher_.reset(
+ new ExtensionFunctionDispatcher(render_view_host, this,
+ tab_contents()->GetURL()));
+}
+
+void ExtensionDOMUI::ProcessDOMUIMessage(const std::string& message,
+ const std::string& content,
+ int request_id,
+ bool has_callback) {
+ extension_function_dispatcher_->HandleRequest(message, content, request_id,
+ has_callback);
+}
+
+Browser* ExtensionDOMUI::GetBrowser() {
+ return static_cast<Browser*>(tab_contents()->delegate());
+}