| 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 <map> | 5 #include <map> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 // Need to include this before most other files because it defines | 9 // Need to include this before most other files because it defines |
| 10 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 10 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "native_client/src/untrusted/irt/irt_ppapi.h" | 21 #include "native_client/src/untrusted/irt/irt_ppapi.h" |
| 22 #include "ppapi/c/ppp.h" | 22 #include "ppapi/c/ppp.h" |
| 23 #include "ppapi/c/ppp_instance.h" | 23 #include "ppapi/c/ppp_instance.h" |
| 24 #include "ppapi/proxy/plugin_dispatcher.h" | 24 #include "ppapi/proxy/plugin_dispatcher.h" |
| 25 #include "ppapi/proxy/plugin_globals.h" | 25 #include "ppapi/proxy/plugin_globals.h" |
| 26 #include "ppapi/proxy/plugin_proxy_delegate.h" | 26 #include "ppapi/proxy/plugin_proxy_delegate.h" |
| 27 #include "ppapi/shared_impl/ppb_audio_shared.h" | 27 #include "ppapi/shared_impl/ppb_audio_shared.h" |
| 28 | 28 |
| 29 #if defined(IPC_MESSAGE_LOG_ENABLED) | 29 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 30 #define IPC_MESSAGE_MACROS_LOG_ENABLED | 30 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
| 31 #endif |
| 31 #include "ppapi/proxy/ppapi_messages.h" | 32 #include "ppapi/proxy/ppapi_messages.h" |
| 32 #endif | |
| 33 | 33 |
| 34 // This must match up with NACL_CHROME_INITIAL_IPC_DESC, | 34 // This must match up with NACL_CHROME_INITIAL_IPC_DESC, |
| 35 // defined in sel_main_chrome.h | 35 // defined in sel_main_chrome.h |
| 36 #define NACL_IPC_FD 6 | 36 #define NACL_IPC_FD 6 |
| 37 | 37 |
| 38 using ppapi::proxy::PluginDispatcher; | 38 using ppapi::proxy::PluginDispatcher; |
| 39 using ppapi::proxy::PluginGlobals; | 39 using ppapi::proxy::PluginGlobals; |
| 40 using ppapi::proxy::PluginProxyDelegate; | 40 using ppapi::proxy::PluginProxyDelegate; |
| 41 using ppapi::proxy::ProxyChannel; | 41 using ppapi::proxy::ProxyChannel; |
| 42 using ppapi::proxy::SerializedHandle; | 42 using ppapi::proxy::SerializedHandle; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 void PpapiDispatcher::PreCacheFont(const void* logfontw) { | 150 void PpapiDispatcher::PreCacheFont(const void* logfontw) { |
| 151 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void PpapiDispatcher::SetActiveURL(const std::string& url) { | 154 void PpapiDispatcher::SetActiveURL(const std::string& url) { |
| 155 NOTIMPLEMENTED(); | 155 NOTIMPLEMENTED(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { | 158 bool PpapiDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 159 IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg) | 159 IPC_BEGIN_MESSAGE_MAP(PpapiDispatcher, msg) |
| 160 IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, | 160 IPC_MESSAGE_HANDLER(PpapiMsg_CreateNaClChannel, OnMsgCreateNaClChannel) |
| 161 OnMsgCreateNaClChannel) | 161 |
| 162 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_ListenACK, |
| 163 OnPluginDispatcherMessageReceived(msg)) |
| 164 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPServerSocket_AcceptACK, |
| 165 OnPluginDispatcherMessageReceived(msg)) |
| 166 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ConnectACK, |
| 167 OnPluginDispatcherMessageReceived(msg)) |
| 168 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_SSLHandshakeACK, |
| 169 OnPluginDispatcherMessageReceived(msg)) |
| 170 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_ReadACK, |
| 171 OnPluginDispatcherMessageReceived(msg)) |
| 172 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBTCPSocket_WriteACK, |
| 173 OnPluginDispatcherMessageReceived(msg)) |
| 174 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_RecvFromACK, |
| 175 OnPluginDispatcherMessageReceived(msg)) |
| 176 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_SendToACK, |
| 177 OnPluginDispatcherMessageReceived(msg)) |
| 178 IPC_MESSAGE_HANDLER_GENERIC(PpapiMsg_PPBUDPSocket_BindACK, |
| 179 OnPluginDispatcherMessageReceived(msg)) |
| 162 IPC_END_MESSAGE_MAP() | 180 IPC_END_MESSAGE_MAP() |
| 163 return true; | 181 return true; |
| 164 } | 182 } |
| 165 | 183 |
| 166 void PpapiDispatcher::OnMsgCreateNaClChannel(int renderer_id, | 184 void PpapiDispatcher::OnMsgCreateNaClChannel(int renderer_id, |
| 167 bool incognito, | 185 bool incognito, |
| 168 SerializedHandle handle) { | 186 SerializedHandle handle) { |
| 169 PluginDispatcher* dispatcher = | 187 PluginDispatcher* dispatcher = |
| 170 new PluginDispatcher(::PPP_GetInterface, incognito); | 188 new PluginDispatcher(::PPP_GetInterface, incognito); |
| 171 // The channel handle's true name is not revealed here. | 189 // The channel handle's true name is not revealed here. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // TODO(dmichael): Handle other error conditions, like failure to connect? | 240 // TODO(dmichael): Handle other error conditions, like failure to connect? |
| 223 if (error) | 241 if (error) |
| 224 return error; | 242 return error; |
| 225 | 243 |
| 226 PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy()); | 244 PpapiDispatcher ppapi_dispatcher(io_thread.message_loop_proxy()); |
| 227 | 245 |
| 228 loop.Run(); | 246 loop.Run(); |
| 229 return 0; | 247 return 0; |
| 230 } | 248 } |
| 231 | 249 |
| OLD | NEW |