summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/dom_ui_bindings.h
diff options
context:
space:
mode:
authortimsteele@google.com <timsteele@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:46:34 +0000
committertimsteele@google.com <timsteele@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-15 18:46:34 +0000
commit3a453fa1f16dfa4168e52790e329148366abb05f (patch)
treea8bbab89ec883a838600e0b63d92fad4361e5dfb /chrome/renderer/dom_ui_bindings.h
parent173de1be12780200c62bae5c01965d51ac0eaa31 (diff)
downloadchromium_src-3a453fa1f16dfa4168e52790e329148366abb05f.zip
chromium_src-3a453fa1f16dfa4168e52790e329148366abb05f.tar.gz
chromium_src-3a453fa1f16dfa4168e52790e329148366abb05f.tar.bz2
Copy from http://chrome-reviews.prom.corp.google.com/1237 (new gcl changelist model).
Description was: Conditionally include personalization/ code by surrounding the hooks into this module with #ifdef CHROME_PERSONALIZATION in various .h/.cc files. Building with the module requires adding this macro as a preprocessor definition in build/internal/essential.vsprops, and adding it to the VCResourceCompiler tool's command line (using /d). We will try and make this easier in the future. TBR=darin git-svn-id: svn://svn.chromium.org/chrome/trunk/src@955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/dom_ui_bindings.h')
-rw-r--r--chrome/renderer/dom_ui_bindings.h49
1 files changed, 36 insertions, 13 deletions
diff --git a/chrome/renderer/dom_ui_bindings.h b/chrome/renderer/dom_ui_bindings.h
index a7736e3..b41cfbe 100644
--- a/chrome/renderer/dom_ui_bindings.h
+++ b/chrome/renderer/dom_ui_bindings.h
@@ -33,21 +33,18 @@
#include "chrome/common/ipc_message.h"
#include "webkit/glue/cpp_bound_class.h"
-// DOMUIBindings is the class backing the "chrome" object accessible
-// from Javascript from privileged pages.
-//
-// We expose one function, for sending a message to the browser:
-// send(String name, Object argument);
-// It's plumbed through to the OnDOMUIMessage callback on RenderViewHost
-// delegate.
-class DOMUIBindings : public CppBoundClass {
+// A DOMBoundBrowserObject is a backing for some object bound to the window
+// in JS that knows how to dispatch messages to an associated c++ object living
+// in the browser process.
+class DOMBoundBrowserObject : public CppBoundClass {
public:
- DOMUIBindings();
- ~DOMUIBindings();
-
- // The send() function provided to Javascript.
- void send(const CppArgumentList& args, CppVariant* result);
+ DOMBoundBrowserObject() : routing_id_(0) { }
+ virtual ~DOMBoundBrowserObject();
+ // Different for each subclass; associates the javascript object with any
+ // number of methods.
+ virtual void BindMethods() = 0;
+
// Set the message channel back to the browser.
void set_message_sender(IPC::Message::Sender* sender) {
sender_ = sender;
@@ -58,6 +55,9 @@ class DOMUIBindings : public CppBoundClass {
routing_id_ = routing_id;
}
+ IPC::Message::Sender* sender() { return sender_; }
+ int routing_id() { return routing_id_; }
+
// Sets a property with the given name and value.
void SetProperty(const std::string& name, const std::string& value);
@@ -71,6 +71,29 @@ class DOMUIBindings : public CppBoundClass {
// can free them on destruction.
typedef std::vector<CppVariant*> PropertyList;
PropertyList properties_;
+
+ DISALLOW_COPY_AND_ASSIGN(DOMBoundBrowserObject);
+};
+
+// DOMUIBindings is the class backing the "chrome" object accessible
+// from Javascript from privileged pages.
+//
+// We expose one function, for sending a message to the browser:
+// send(String name, Object argument);
+// It's plumbed through to the OnDOMUIMessage callback on RenderViewHost
+// delegate.
+class DOMUIBindings : public DOMBoundBrowserObject {
+ public:
+ DOMUIBindings() { BindMethods(); }
+ virtual ~DOMUIBindings() {}
+
+ // DOMBoundBrowserObject implementation.
+ virtual void BindMethods();
+
+ // The send() function provided to Javascript.
+ void send(const CppArgumentList& args, CppVariant* result);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DOMUIBindings);
};
#endif // CHROME_RENDERER_DOM_UI_BINDINGS_H__