summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/external_host_bindings.h
diff options
context:
space:
mode:
authorjoshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:34:45 +0000
committerjoshia@google.com <joshia@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-21 20:34:45 +0000
commit18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0 (patch)
treedaa421607577ba79de24e9d9d8c62f60dff60a29 /chrome/renderer/external_host_bindings.h
parent8c026e7a5ab2077eb8381e7b79a78020624a5a64 (diff)
downloadchromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.zip
chromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.tar.gz
chromium_src-18cb257530f2a7b6a5d8ce74d3486c1784fcdbf0.tar.bz2
Code review changes. Incorporated all the suggestions from previous review.
One item not changed yet is to rename 'receiver' in ForwardMessageToExternalHost. The idea is to invoke receiver("message") at the other end. So for example if the args to ForwardMessageToExternalHost("hello", "world") then we will invoke a script hello("world") on the other side. 'receiver' doesn't really describe the first argument here so if there is a better suggestion, I would be happy to change it :) git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1176 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/external_host_bindings.h')
-rw-r--r--chrome/renderer/external_host_bindings.h46
1 files changed, 14 insertions, 32 deletions
diff --git a/chrome/renderer/external_host_bindings.h b/chrome/renderer/external_host_bindings.h
index dde86af..3c56ee1 100644
--- a/chrome/renderer/external_host_bindings.h
+++ b/chrome/renderer/external_host_bindings.h
@@ -27,48 +27,30 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H__
-#define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H__
+#ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_
+#define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_
#include "chrome/common/ipc_message.h"
-#include "webkit/glue/cpp_bound_class.h"
+#include "dom_ui_bindings.h"
// ExternalHostBindings is the class backing the "externalHost" object
// accessible from Javascript
//
// We expose one function, for sending a message to the external host:
-// postMessage(String receiver, String message);
-class ExternalHostBindings : public CppBoundClass {
+// ForwardMessageToExternalHost(String receiver, String message);
+class ExternalHostBindings : public DOMBoundBrowserObject {
public:
- ExternalHostBindings();
- ~ExternalHostBindings();
+ ExternalHostBindings() { BindMethods(); }
+ virtual ~ExternalHostBindings() {};
- // The postMessage() function provided to Javascript.
- void postMessage(const CppArgumentList& args, CppVariant* result);
-
- // Set the message channel back to the browser.
- void set_message_sender(IPC::Message::Sender* sender) {
- sender_ = sender;
- }
-
- // Set the routing id for messages back to the browser.
- void set_routing_id(int routing_id) {
- routing_id_ = routing_id;
- }
-
- // Sets a property with the given name and value.
- void SetProperty(const std::string& name, const std::string& value);
+ // DOMBoundBrowserObject implementation.
+ virtual void BindMethods();
+ // The ForwardMessageToExternalHost() function provided to Javascript.
+ void ForwardMessageToExternalHost(const CppArgumentList& args,
+ CppVariant* result);
private:
- // Our channel back to the browser is a message sender
- // and routing id.
- IPC::Message::Sender* sender_;
- int routing_id_;
-
- // The list of properties that have been set. We keep track of this so we
- // can free them on destruction.
- typedef std::vector<CppVariant*> PropertyList;
- PropertyList properties_;
+ DISALLOW_COPY_AND_ASSIGN(ExternalHostBindings);
};
-#endif // CHROME_RENDERER_DOM_UI_BINDINGS_H__
+#endif // CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_