summaryrefslogtreecommitdiffstats
path: root/chrome/browser/dom_ui
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/dom_ui
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/dom_ui')
-rw-r--r--chrome/browser/dom_ui/dom_ui.cc6
-rw-r--r--chrome/browser/dom_ui/dom_ui.h12
-rw-r--r--chrome/browser/dom_ui/dom_ui_factory.cc10
3 files changed, 24 insertions, 4 deletions
diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc
index 3a7b221..3b0472b 100644
--- a/chrome/browser/dom_ui/dom_ui.cc
+++ b/chrome/browser/dom_ui/dom_ui.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
+#include "chrome/common/bindings_policy.h"
DOMUI::DOMUI(TabContents* contents)
: hide_favicon_(false),
@@ -20,6 +21,7 @@ DOMUI::DOMUI(TabContents* contents)
focus_location_bar_by_default_(false),
should_hide_url_(false),
link_transition_type_(PageTransition::LINK),
+ bindings_(BindingsPolicy::DOM_UI),
tab_contents_(contents) {
}
@@ -32,7 +34,9 @@ DOMUI::~DOMUI() {
// DOMUI, public: -------------------------------------------------------------
void DOMUI::ProcessDOMUIMessage(const std::string& message,
- const std::string& content) {
+ const std::string& content,
+ int request_id,
+ bool has_callback) {
// Look up the callback for this message.
MessageCallbackMap::const_iterator callback =
message_callbacks_.find(message);
diff --git a/chrome/browser/dom_ui/dom_ui.h b/chrome/browser/dom_ui/dom_ui.h
index f7bb0e7..fad04e5 100644
--- a/chrome/browser/dom_ui/dom_ui.h
+++ b/chrome/browser/dom_ui/dom_ui.h
@@ -32,8 +32,10 @@ class DOMUI {
virtual void RenderViewCreated(RenderViewHost* render_view_host) {}
// Called from DOMUIContents.
- void ProcessDOMUIMessage(const std::string& message,
- const std::string& content);
+ virtual void ProcessDOMUIMessage(const std::string& message,
+ const std::string& content,
+ int request_id,
+ bool has_callback);
// Used by DOMMessageHandlers.
typedef Callback1<const Value*>::Type MessageCallback;
@@ -77,6 +79,10 @@ class DOMUI {
return link_transition_type_;
}
+ const int bindings() const {
+ return bindings_;
+ }
+
// Call a Javascript function by sending its name and arguments down to
// the renderer. This is asynchronous; there's no way to get the result
// of the call, and should be thought of more like sending a message to
@@ -106,6 +112,8 @@ class DOMUI {
bool should_hide_url_;
string16 overridden_title_; // Defaults to empty string.
PageTransition::Type link_transition_type_; // Defaults to LINK.
+ int bindings_; // The bindings from BindingsPolicy that should be enabled for
+ // this page.
private:
// Execute a string of raw Javascript on the page.
diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc
index c5576cf..8827c02 100644
--- a/chrome/browser/dom_ui/dom_ui_factory.cc
+++ b/chrome/browser/dom_ui/dom_ui_factory.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/dom_ui/html_dialog_ui.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/extensions/extensions_ui.h"
+#include "chrome/browser/extensions/extension_dom_ui.h"
#include "chrome/common/url_constants.h"
#ifdef CHROME_PERSONALIZATION
#include "chrome/personalization/personalization.h"
@@ -34,6 +35,12 @@ static bool CreateDOMUI(const GURL& url, TabContents* tab_contents,
return true;
}
+ if (url.SchemeIs(chrome::kExtensionScheme)) {
+ if (new_ui)
+ *new_ui = new ExtensionDOMUI(tab_contents);
+ return true;
+ }
+
#ifdef CHROME_PERSONALIZATION
if (Personalization::NeedsDOMUI(url)) {
if (new_ui)
@@ -91,7 +98,8 @@ static bool CreateDOMUI(const GURL& url, TabContents* tab_contents,
// static
bool DOMUIFactory::HasDOMUIScheme(const GURL& url) {
return url.SchemeIs(chrome::kChromeInternalScheme) ||
- url.SchemeIs(chrome::kChromeUIScheme);
+ url.SchemeIs(chrome::kChromeUIScheme) ||
+ url.SchemeIs(chrome::kExtensionScheme);
}
// static