OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_RENDERER_JAVA_BRIDGE_DISPATCHER_H_ | |
6 #define CONTENT_RENDERER_JAVA_BRIDGE_DISPATCHER_H_ | |
7 | |
8 #include "content/common/webkit_param_traits.h" // For NPVariant_Param | |
9 #include "content/public/renderer/render_view_observer.h" | |
10 #include "content/renderer/java_bridge_channel.h" | |
jam
2011/10/19 23:46:19
forward declare?
Steve Block
2011/10/20 09:43:08
Done.
| |
11 #include "ipc/ipc_channel_handle.h" | |
12 | |
13 // This class handles injecting Java objects into the main frame of a | |
14 // RenderView. The 'add' and 'remove' messages received from the browser | |
15 // process modify the entries in a map of 'pending' objects. These objects are | |
16 // bound to the window object of the main frame when that window object is next | |
17 // cleared. These objects remain bound until the window object is cleared | |
18 // again. | |
19 class JavaBridgeDispatcher : public content::RenderViewObserver | |
20 { | |
jam
2011/10/19 23:46:19
nit: this should be on previous line
Steve Block
2011/10/20 09:43:08
Done.
| |
21 public: | |
22 JavaBridgeDispatcher(content::RenderView* render_view, | |
23 const IPC::ChannelHandle& channel_handle); | |
24 virtual ~JavaBridgeDispatcher(); | |
25 | |
26 private: | |
27 // RenderViewObserver override: | |
28 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
29 virtual void DidClearWindowObject(WebKit::WebFrame* frame) OVERRIDE; | |
30 | |
31 // Message handlers | |
32 void OnAddNamedObject(const string16& name, const NPVariant_Param&); | |
jam
2011/10/19 23:46:19
nit: chrome style is to put the parameter names in
Steve Block
2011/10/20 09:43:08
Done.
| |
33 void OnRemoveNamedObject(const string16& name); | |
34 | |
35 // Objects that will be bound to the window when the window object is next | |
36 // cleared. We hold a ref to these. | |
37 typedef std::map<string16, NPVariant> ObjectMap; | |
38 ObjectMap objects_; | |
39 scoped_ptr<JavaBridgeChannel> channel_; | |
40 }; | |
41 | |
42 #endif // CONTENT_RENDERER_JAVA_BRIDGE_DISPATCHER_H_ | |
OLD | NEW |