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/pepper/pepper_in_process_router.h" | 5 #include "content/renderer/pepper/pepper_in_process_router.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "content/public/renderer/render_view.h" | |
11 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
| 11 #include "content/renderer/render_frame_impl.h" |
12 #include "ipc/ipc_message.h" | 12 #include "ipc/ipc_message.h" |
13 #include "ipc/ipc_sender.h" | 13 #include "ipc/ipc_sender.h" |
14 #include "ppapi/proxy/ppapi_messages.h" | 14 #include "ppapi/proxy/ppapi_messages.h" |
15 #include "ppapi/shared_impl/ppapi_globals.h" | 15 #include "ppapi/shared_impl/ppapi_globals.h" |
16 #include "ppapi/shared_impl/resource_tracker.h" | 16 #include "ppapi/shared_impl/resource_tracker.h" |
17 | 17 |
18 using ppapi::UnpackMessage; | 18 using ppapi::UnpackMessage; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return plugin_to_host_router_.get(); | 58 return plugin_to_host_router_.get(); |
59 } | 59 } |
60 | 60 |
61 IPC::Sender* PepperInProcessRouter::GetRendererToPluginSender() { | 61 IPC::Sender* PepperInProcessRouter::GetRendererToPluginSender() { |
62 return host_to_plugin_router_.get(); | 62 return host_to_plugin_router_.get(); |
63 } | 63 } |
64 | 64 |
65 ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection( | 65 ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection( |
66 PP_Instance instance) { | 66 PP_Instance instance) { |
67 int routing_id = 0; | 67 int routing_id = 0; |
68 RenderView* view = host_impl_->GetRenderViewForInstance(instance); | 68 RenderFrame* frame = host_impl_->GetRenderFrameForInstance(instance); |
69 if (view) | 69 if (frame) |
70 routing_id = view->GetRoutingID(); | 70 routing_id = (static_cast<RenderFrameImpl*>(frame))->routing_id(); |
71 return ppapi::proxy::Connection(browser_channel_.get(), | 71 return ppapi::proxy::Connection(browser_channel_.get(), |
72 plugin_to_host_router_.get(), | 72 plugin_to_host_router_.get(), |
73 routing_id); | 73 routing_id); |
74 } | 74 } |
75 | 75 |
76 // static | 76 // static |
77 bool PepperInProcessRouter::OnPluginMsgReceived(const IPC::Message& msg) { | 77 bool PepperInProcessRouter::OnPluginMsgReceived(const IPC::Message& msg) { |
78 // Emulate the proxy by dispatching the relevant message here. | 78 // Emulate the proxy by dispatching the relevant message here. |
79 ppapi::proxy::ResourceMessageReplyParams reply_params; | 79 ppapi::proxy::ResourceMessageReplyParams reply_params; |
80 IPC::Message nested_msg; | 80 IPC::Message nested_msg; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { | 169 void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) { |
170 bool handled = OnPluginMsgReceived(*msg); | 170 bool handled = OnPluginMsgReceived(*msg); |
171 DCHECK(handled); | 171 DCHECK(handled); |
172 } | 172 } |
173 | 173 |
174 bool PepperInProcessRouter::SendToBrowser(IPC::Message *msg) { | 174 bool PepperInProcessRouter::SendToBrowser(IPC::Message *msg) { |
175 return RenderThread::Get()->Send(msg); | 175 return RenderThread::Get()->Send(msg); |
176 } | 176 } |
177 | 177 |
178 } // namespace content | 178 } // namespace content |
OLD | NEW |