OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ | 5 #ifndef CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ |
6 #define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ | 6 #define CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/renderer/dom_ui_bindings.h" | 9 #include "chrome/renderer/dom_ui_bindings.h" |
10 #include "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
11 | 11 |
12 // ExternalHostBindings is the class backing the "externalHost" object | 12 // ExternalHostBindings is the class backing the "externalHost" object |
13 // accessible from Javascript | 13 // accessible from Javascript |
14 // | 14 // |
15 // We expose one function, for sending a message to the external host: | 15 // We expose one function, for sending a message to the external host: |
16 // postMessage(String message[, String target]); | 16 // postMessage(String message[, String target]); |
17 class ExternalHostBindings : public DOMBoundBrowserObject { | 17 class ExternalHostBindings : public DOMBoundBrowserObject { |
18 public: | 18 public: |
19 ExternalHostBindings(); | 19 ExternalHostBindings(); |
20 virtual ~ExternalHostBindings() { | 20 virtual ~ExternalHostBindings(); |
21 } | |
22 | 21 |
23 // The postMessage() function provided to Javascript. | 22 // The postMessage() function provided to Javascript. |
24 void postMessage(const CppArgumentList& args, CppVariant* result); | 23 void postMessage(const CppArgumentList& args, CppVariant* result); |
25 | 24 |
26 // Invokes the registered onmessage handler. | 25 // Invokes the registered onmessage handler. |
27 // Returns true on successful invocation. | 26 // Returns true on successful invocation. |
28 bool ForwardMessageFromExternalHost(const std::string& message, | 27 bool ForwardMessageFromExternalHost(const std::string& message, |
29 const std::string& origin, | 28 const std::string& origin, |
30 const std::string& target); | 29 const std::string& target); |
31 | 30 |
(...skipping 11 matching lines...) Expand all Loading... |
43 bool CreateMessageEvent(NPObject** message_event); | 42 bool CreateMessageEvent(NPObject** message_event); |
44 | 43 |
45 private: | 44 private: |
46 CppVariant on_message_handler_; | 45 CppVariant on_message_handler_; |
47 WebKit::WebFrame* frame_; | 46 WebKit::WebFrame* frame_; |
48 | 47 |
49 DISALLOW_COPY_AND_ASSIGN(ExternalHostBindings); | 48 DISALLOW_COPY_AND_ASSIGN(ExternalHostBindings); |
50 }; | 49 }; |
51 | 50 |
52 #endif // CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ | 51 #endif // CHROME_RENDERER_EXTERNAL_HOST_BINDINGS_H_ |
OLD | NEW |