summaryrefslogtreecommitdiffstats
path: root/content/renderer/java/java_bridge_dispatcher.h
diff options
context:
space:
mode:
authorsteveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 09:57:42 +0000
committersteveblock@chromium.org <steveblock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 09:57:42 +0000
commit0716190db9698fd838535c3e6d42b66d7d5581b8 (patch)
tree96b1f8066c3683d5e407e41a06f2db37f98a47a7 /content/renderer/java/java_bridge_dispatcher.h
parent9356b47bd6c96c45d7582bab5ee5f2e112c5dbc8 (diff)
downloadchromium_src-0716190db9698fd838535c3e6d42b66d7d5581b8.zip
chromium_src-0716190db9698fd838535c3e6d42b66d7d5581b8.tar.gz
chromium_src-0716190db9698fd838535c3e6d42b66d7d5581b8.tar.bz2
Move Java Bridge files to new java/ subdirectory
BUG=96703 Review URL: http://codereview.chromium.org/8525016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/java/java_bridge_dispatcher.h')
-rw-r--r--content/renderer/java/java_bridge_dispatcher.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/content/renderer/java/java_bridge_dispatcher.h b/content/renderer/java/java_bridge_dispatcher.h
new file mode 100644
index 0000000..7359951
--- /dev/null
+++ b/content/renderer/java/java_bridge_dispatcher.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_JAVA_JAVA_BRIDGE_DISPATCHER_H_
+#define CONTENT_RENDERER_JAVA_JAVA_BRIDGE_DISPATCHER_H_
+
+#include "content/public/common/webkit_param_traits.h"
+#include "content/public/renderer/render_view_observer.h"
+#include "ipc/ipc_channel_handle.h"
+
+class JavaBridgeChannel;
+
+// This class handles injecting Java objects into the main frame of a
+// RenderView. The 'add' and 'remove' messages received from the browser
+// process modify the entries in a map of 'pending' objects. These objects are
+// bound to the window object of the main frame when that window object is next
+// cleared. These objects remain bound until the window object is cleared
+// again.
+class JavaBridgeDispatcher : public content::RenderViewObserver {
+ public:
+ JavaBridgeDispatcher(content::RenderView* render_view,
+ const IPC::ChannelHandle& channel_handle);
+ virtual ~JavaBridgeDispatcher();
+
+ private:
+ // RenderViewObserver override:
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE;
+
+ // Message handlers
+ void OnAddNamedObject(const string16& name,
+ const NPVariant_Param& variant_param);
+ void OnRemoveNamedObject(const string16& name);
+
+ // Objects that will be bound to the window when the window object is next
+ // cleared. We hold a ref to these.
+ typedef std::map<string16, NPVariant> ObjectMap;
+ ObjectMap objects_;
+ scoped_ptr<JavaBridgeChannel> channel_;
+};
+
+#endif // CONTENT_RENDERER_JAVA_JAVA_BRIDGE_DISPATCHER_H_