| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "native_client/src/include/nacl_scoped_ptr.h" | 9 #include "native_client/src/include/nacl_scoped_ptr.h" |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return NULL; | 157 return NULL; |
| 158 int32_t exports_interface_name; | 158 int32_t exports_interface_name; |
| 159 NaClSrpcError srpc_result = | 159 NaClSrpcError srpc_result = |
| 160 PppRpcClient::PPP_GetInterface(main_channel_, | 160 PppRpcClient::PPP_GetInterface(main_channel_, |
| 161 const_cast<char*>(interface_name), | 161 const_cast<char*>(interface_name), |
| 162 &exports_interface_name); | 162 &exports_interface_name); |
| 163 DebugPrintf("PPP_GetInterface('%s'): %s\n", | 163 DebugPrintf("PPP_GetInterface('%s'): %s\n", |
| 164 interface_name, NaClSrpcErrorString(srpc_result)); | 164 interface_name, NaClSrpcErrorString(srpc_result)); |
| 165 is_nexe_alive_ = (srpc_result != NACL_SRPC_RESULT_INTERNAL); | 165 is_nexe_alive_ = (srpc_result != NACL_SRPC_RESULT_INTERNAL); |
| 166 | 166 |
| 167 // Special case PPP_Instance versioning. The plugin side of the proxy |
| 168 // converts Instance 1.1 to Instance 1.0 as needed, so we want to say here |
| 169 // in the browser side that any time either 1.0 or 1.1 is supported, that |
| 170 // we'll support 1.1. |
| 171 if (srpc_result == NACL_SRPC_RESULT_OK && !exports_interface_name && |
| 172 strcmp(interface_name, PPP_INSTANCE_INTERFACE_1_1) == 0) { |
| 173 srpc_result = |
| 174 PppRpcClient::PPP_GetInterface(main_channel_, |
| 175 PPP_INSTANCE_INTERFACE_1_0, |
| 176 &exports_interface_name); |
| 177 } |
| 178 |
| 167 const void* ppp_interface = NULL; | 179 const void* ppp_interface = NULL; |
| 168 if (srpc_result != NACL_SRPC_RESULT_OK || !exports_interface_name) { | 180 if (srpc_result != NACL_SRPC_RESULT_OK || !exports_interface_name) { |
| 169 ppp_interface = NULL; | 181 ppp_interface = NULL; |
| 170 } else if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) { | 182 } else if (strcmp(interface_name, PPP_INSTANCE_INTERFACE) == 0) { |
| 171 ppp_interface = | 183 ppp_interface = |
| 172 reinterpret_cast<const void*>(BrowserInstance::GetInterface()); | 184 reinterpret_cast<const void*>(BrowserInstance::GetInterface()); |
| 173 } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) { | 185 } else if (strcmp(interface_name, PPP_MESSAGING_INTERFACE) == 0) { |
| 174 ppp_interface = | 186 ppp_interface = |
| 175 reinterpret_cast<const void*>(BrowserMessaging::GetInterface()); | 187 reinterpret_cast<const void*>(BrowserMessaging::GetInterface()); |
| 176 } else if (strcmp(interface_name, PPP_MOUSELOCK_INTERFACE) == 0) { | 188 } else if (strcmp(interface_name, PPP_MOUSELOCK_INTERFACE) == 0) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 205 | 217 |
| 206 const void* BrowserPpp::GetPluginInterfaceSafe(const char* interface_name) { | 218 const void* BrowserPpp::GetPluginInterfaceSafe(const char* interface_name) { |
| 207 const void* ppp_interface = GetPluginInterface(interface_name); | 219 const void* ppp_interface = GetPluginInterface(interface_name); |
| 208 if (ppp_interface == NULL) | 220 if (ppp_interface == NULL) |
| 209 DebugPrintf("PPB_GetInterface: %s not found\n", interface_name); | 221 DebugPrintf("PPB_GetInterface: %s not found\n", interface_name); |
| 210 CHECK(ppp_interface != NULL); | 222 CHECK(ppp_interface != NULL); |
| 211 return ppp_interface; | 223 return ppp_interface; |
| 212 } | 224 } |
| 213 | 225 |
| 214 } // namespace ppapi_proxy | 226 } // namespace ppapi_proxy |
| OLD | NEW |