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_view.h" |
9 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" | 10 #include "content/renderer/pepper/renderer_ppapi_host_impl.h" |
10 #include "ipc/ipc_message.h" | 11 #include "ipc/ipc_message.h" |
11 #include "ipc/ipc_sender.h" | 12 #include "ipc/ipc_sender.h" |
12 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
13 #include "ppapi/shared_impl/ppapi_globals.h" | 14 #include "ppapi/shared_impl/ppapi_globals.h" |
14 #include "ppapi/shared_impl/resource_tracker.h" | 15 #include "ppapi/shared_impl/resource_tracker.h" |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 | 18 |
18 class PepperInProcessRouter::Channel : public IPC::Sender { | 19 class PepperInProcessRouter::Channel : public IPC::Sender { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 52 } |
52 | 53 |
53 IPC::Sender* PepperInProcessRouter::GetPluginToRendererSender() { | 54 IPC::Sender* PepperInProcessRouter::GetPluginToRendererSender() { |
54 return plugin_to_host_router_.get(); | 55 return plugin_to_host_router_.get(); |
55 } | 56 } |
56 | 57 |
57 IPC::Sender* PepperInProcessRouter::GetRendererToPluginSender() { | 58 IPC::Sender* PepperInProcessRouter::GetRendererToPluginSender() { |
58 return host_to_plugin_router_.get(); | 59 return host_to_plugin_router_.get(); |
59 } | 60 } |
60 | 61 |
61 ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection() { | 62 ppapi::proxy::Connection PepperInProcessRouter::GetPluginConnection( |
| 63 PP_Instance instance) { |
| 64 int routing_id = 0; |
| 65 RenderView* view = host_impl_->GetRenderViewForInstance(instance); |
| 66 if (view) |
| 67 routing_id = view->GetRoutingID(); |
62 return ppapi::proxy::Connection(dummy_browser_channel_.get(), | 68 return ppapi::proxy::Connection(dummy_browser_channel_.get(), |
63 plugin_to_host_router_.get()); | 69 plugin_to_host_router_.get(), |
| 70 routing_id); |
64 } | 71 } |
65 | 72 |
66 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) { | 73 bool PepperInProcessRouter::SendToHost(IPC::Message* msg) { |
67 scoped_ptr<IPC::Message> message(msg); | 74 scoped_ptr<IPC::Message> message(msg); |
68 | 75 |
69 if (!message->is_sync()) { | 76 if (!message->is_sync()) { |
70 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); | 77 bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message); |
71 DCHECK(result) << "The message was not handled by the host."; | 78 DCHECK(result) << "The message was not handled by the host."; |
72 return true; | 79 return true; |
73 } | 80 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 reply_params.pp_resource()); | 134 reply_params.pp_resource()); |
128 if (!resource) { | 135 if (!resource) { |
129 // The resource could have been destroyed while the async processing was | 136 // The resource could have been destroyed while the async processing was |
130 // pending. Just drop the message. | 137 // pending. Just drop the message. |
131 return; | 138 return; |
132 } | 139 } |
133 resource->OnReplyReceived(reply_params, nested_msg); | 140 resource->OnReplyReceived(reply_params, nested_msg); |
134 } | 141 } |
135 | 142 |
136 } // namespace content | 143 } // namespace content |
OLD | NEW |