OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/renderer/java/java_bridge_dispatcher.h" | 5 #include "content/renderer/java/java_bridge_dispatcher.h" |
6 | 6 |
7 #include "content/child/child_process.h" | 7 #include "content/child/child_process.h" |
8 #include "content/child/npobject_util.h" // For CreateNPVariant() | 8 #include "content/child/npobject_util.h" // For CreateNPVariant() |
9 #include "content/common/java_bridge_messages.h" | 9 #include "content/common/java_bridge_messages.h" |
10 #include "content/public/renderer/render_thread.h" | 10 #include "content/public/renderer/render_thread.h" |
11 #include "content/public/renderer/render_view.h" | 11 #include "content/public/renderer/render_view.h" |
12 #include "content/renderer/java/java_bridge_channel.h" | 12 #include "content/renderer/java/java_bridge_channel.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 JavaBridgeDispatcher::JavaBridgeDispatcher(RenderView* render_view) | 20 JavaBridgeDispatcher::JavaBridgeDispatcher(RenderView* render_view) |
21 : RenderViewObserver(render_view) { | 21 : RenderViewObserver(render_view) { |
22 } | 22 } |
23 | 23 |
24 bool JavaBridgeDispatcher::EnsureChannelIsSetUp() { | 24 bool JavaBridgeDispatcher::EnsureChannelIsSetUp() { |
25 if (channel_) { | 25 if (channel_.get()) { |
26 return true; | 26 return true; |
27 } | 27 } |
28 | 28 |
29 IPC::ChannelHandle channel_handle; | 29 IPC::ChannelHandle channel_handle; |
30 Send(new JavaBridgeHostMsg_GetChannelHandle(routing_id(), &channel_handle)); | 30 Send(new JavaBridgeHostMsg_GetChannelHandle(routing_id(), &channel_handle)); |
31 | 31 |
32 channel_ = JavaBridgeChannel::GetJavaBridgeChannel( | 32 channel_ = JavaBridgeChannel::GetJavaBridgeChannel( |
33 channel_handle, ChildProcess::current()->io_message_loop_proxy()); | 33 channel_handle, ChildProcess::current()->io_message_loop_proxy()); |
34 return channel_.get(); | 34 return channel_.get(); |
35 } | 35 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Removing an object does not unbind it from JavaScript until the window | 99 // Removing an object does not unbind it from JavaScript until the window |
100 // object is next cleared. Note that the browser checks that the named object | 100 // object is next cleared. Note that the browser checks that the named object |
101 // is present. | 101 // is present. |
102 ObjectMap::iterator iter = objects_.find(name); | 102 ObjectMap::iterator iter = objects_.find(name); |
103 DCHECK(iter != objects_.end()); | 103 DCHECK(iter != objects_.end()); |
104 WebKit::WebBindings::releaseObject(NPVARIANT_TO_OBJECT(iter->second)); | 104 WebKit::WebBindings::releaseObject(NPVARIANT_TO_OBJECT(iter->second)); |
105 objects_.erase(iter); | 105 objects_.erase(iter); |
106 } | 106 } |
107 | 107 |
108 } // namespace content | 108 } // namespace content |
OLD | NEW |