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/ppapi_plugin/ppapi_thread.h" | 5 #include "content/ppapi_plugin/ppapi_thread.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // this so this function just overrides that one. | 87 // this so this function just overrides that one. |
88 // | 88 // |
89 // Note that this function is called only for messages from the channel to the | 89 // Note that this function is called only for messages from the channel to the |
90 // browser process. Messages from the renderer process are sent via a different | 90 // browser process. Messages from the renderer process are sent via a different |
91 // channel that ends up at Dispatcher::OnMessageReceived. | 91 // channel that ends up at Dispatcher::OnMessageReceived. |
92 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { | 92 bool PpapiThread::OnMessageReceived(const IPC::Message& msg) { |
93 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) | 93 IPC_BEGIN_MESSAGE_MAP(PpapiThread, msg) |
94 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) | 94 IPC_MESSAGE_HANDLER(PpapiMsg_LoadPlugin, OnMsgLoadPlugin) |
95 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel) | 95 IPC_MESSAGE_HANDLER(PpapiMsg_CreateChannel, OnMsgCreateChannel) |
96 | 96 |
| 97 IPC_MESSAGE_HANDLER(PpapiPluginMsg_ResourceReply, OnMsgResourceReply) |
| 98 |
97 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_ListenACK, | 99 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_ListenACK, |
98 OnPluginDispatcherMessageReceived(msg)) | 100 OnPluginDispatcherMessageReceived(msg)) |
99 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_AcceptACK, | 101 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_AcceptACK, |
100 OnPluginDispatcherMessageReceived(msg)) | 102 OnPluginDispatcherMessageReceived(msg)) |
101 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ConnectACK, | 103 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ConnectACK, |
102 OnPluginDispatcherMessageReceived(msg)) | 104 OnPluginDispatcherMessageReceived(msg)) |
103 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, | 105 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
104 OnPluginDispatcherMessageReceived(msg)) | 106 OnPluginDispatcherMessageReceived(msg)) |
105 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ReadACK, | 107 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ReadACK, |
106 OnPluginDispatcherMessageReceived(msg)) | 108 OnPluginDispatcherMessageReceived(msg)) |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 IPC::ChannelHandle channel_handle; | 301 IPC::ChannelHandle channel_handle; |
300 if (!library_.is_valid() || // Plugin couldn't be loaded. | 302 if (!library_.is_valid() || // Plugin couldn't be loaded. |
301 !SetupRendererChannel(renderer_id, incognito, &channel_handle)) { | 303 !SetupRendererChannel(renderer_id, incognito, &channel_handle)) { |
302 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle())); | 304 Send(new PpapiHostMsg_ChannelCreated(IPC::ChannelHandle())); |
303 return; | 305 return; |
304 } | 306 } |
305 | 307 |
306 Send(new PpapiHostMsg_ChannelCreated(channel_handle)); | 308 Send(new PpapiHostMsg_ChannelCreated(channel_handle)); |
307 } | 309 } |
308 | 310 |
| 311 void PpapiThread::OnMsgResourceReply( |
| 312 const ppapi::proxy::ResourceMessageReplyParams& reply_params, |
| 313 const IPC::Message& nested_msg) { |
| 314 ppapi::proxy::PluginDispatcher::DispatchResourceReply(reply_params, |
| 315 nested_msg); |
| 316 } |
| 317 |
309 void PpapiThread::OnMsgSetNetworkState(bool online) { | 318 void PpapiThread::OnMsgSetNetworkState(bool online) { |
310 if (!get_plugin_interface_) | 319 if (!get_plugin_interface_) |
311 return; | 320 return; |
312 const PPP_NetworkState_Dev* ns = static_cast<const PPP_NetworkState_Dev*>( | 321 const PPP_NetworkState_Dev* ns = static_cast<const PPP_NetworkState_Dev*>( |
313 get_plugin_interface_(PPP_NETWORK_STATE_DEV_INTERFACE)); | 322 get_plugin_interface_(PPP_NETWORK_STATE_DEV_INTERFACE)); |
314 if (ns) | 323 if (ns) |
315 ns->SetOnLine(PP_FromBool(online)); | 324 ns->SetOnLine(PP_FromBool(online)); |
316 } | 325 } |
317 | 326 |
318 void PpapiThread::OnPluginDispatcherMessageReceived(const IPC::Message& msg) { | 327 void PpapiThread::OnPluginDispatcherMessageReceived(const IPC::Message& msg) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( | 389 ppapi::proxy::PluginGlobals::Get()->set_plugin_name( |
381 path.BaseName().AsUTF8Unsafe()); | 390 path.BaseName().AsUTF8Unsafe()); |
382 | 391 |
383 // plugin() is NULL when in-process. Which is fine, because this is | 392 // plugin() is NULL when in-process. Which is fine, because this is |
384 // just a hook for setting the process name. | 393 // just a hook for setting the process name. |
385 if (content::GetContentClient()->plugin()) { | 394 if (content::GetContentClient()->plugin()) { |
386 content::GetContentClient()->plugin()->PluginProcessStarted( | 395 content::GetContentClient()->plugin()->PluginProcessStarted( |
387 path.BaseName().RemoveExtension().LossyDisplayName()); | 396 path.BaseName().RemoveExtension().LossyDisplayName()); |
388 } | 397 } |
389 } | 398 } |
OLD | NEW |