| 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 "ppapi/proxy/interface_list.h" | 5 #include "ppapi/proxy/interface_list.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" | 8 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| 9 #include "ppapi/c/dev/ppb_buffer_dev.h" | 9 #include "ppapi/c/dev/ppb_buffer_dev.h" |
| 10 #include "ppapi/c/dev/ppb_char_set_dev.h" | 10 #include "ppapi/c/dev/ppb_char_set_dev.h" |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 158 |
| 159 #undef PROXIED_API | 159 #undef PROXIED_API |
| 160 #undef PROXIED_IFACE | 160 #undef PROXIED_IFACE |
| 161 | 161 |
| 162 // Manually add some special proxies. Some of these don't have interfaces | 162 // Manually add some special proxies. Some of these don't have interfaces |
| 163 // that they support, so aren't covered by the macros above, but have proxies | 163 // that they support, so aren't covered by the macros above, but have proxies |
| 164 // for message routing. Others have different implementations between the | 164 // for message routing. Others have different implementations between the |
| 165 // proxy and the impl and there's no obvious message routing. | 165 // proxy and the impl and there's no obvious message routing. |
| 166 AddProxy(API_ID_RESOURCE_CREATION, &ResourceCreationProxy::Create); | 166 AddProxy(API_ID_RESOURCE_CREATION, &ResourceCreationProxy::Create); |
| 167 AddProxy(API_ID_PPP_CLASS, &PPP_Class_Proxy::Create); | 167 AddProxy(API_ID_PPP_CLASS, &PPP_Class_Proxy::Create); |
| 168 AddPPB(PPB_CORE_INTERFACE, API_ID_PPB_CORE, | 168 AddPPB(PPB_CORE_INTERFACE_1_0, API_ID_PPB_CORE, |
| 169 PPB_Core_Proxy::GetPPB_Core_Interface()); | 169 PPB_Core_Proxy::GetPPB_Core_Interface()); |
| 170 AddPPB(PPB_OPENGLES2_INTERFACE, API_ID_NONE, | 170 AddPPB(PPB_OPENGLES2_INTERFACE_1_0, API_ID_NONE, |
| 171 PPB_OpenGLES2_Shared::GetInterface()); | 171 PPB_OpenGLES2_Shared::GetInterface()); |
| 172 AddPPB(PPB_VAR_INTERFACE, API_ID_NONE, | 172 AddPPB(PPB_VAR_INTERFACE_1_1, API_ID_NONE, |
| 173 PPB_Var_Shared::GetVarInterface()); | 173 PPB_Var_Shared::GetVarInterface1_1()); |
| 174 AddPPB(PPB_VAR_INTERFACE_1_0, API_ID_NONE, | 174 AddPPB(PPB_VAR_INTERFACE_1_0, API_ID_NONE, |
| 175 PPB_Var_Shared::GetVarInterface1_0()); | 175 PPB_Var_Shared::GetVarInterface1_0()); |
| 176 | 176 |
| 177 AddFlashInterfaces(); | 177 AddFlashInterfaces(); |
| 178 | 178 |
| 179 // PPB (browser) interfaces. | 179 // PPB (browser) interfaces. |
| 180 // Do not add more stuff here, they should be added to interface_list*.h | 180 // Do not add more stuff here, they should be added to interface_list*.h |
| 181 // TODO(brettw) remove these. | 181 // TODO(brettw) remove these. |
| 182 AddPPB(PPB_FileChooser_Proxy::GetTrustedInfo()); | 182 AddPPB(PPB_FileChooser_Proxy::GetTrustedInfo()); |
| 183 AddPPB(PPB_Instance_Proxy::GetInfoPrivate()); | 183 AddPPB(PPB_Instance_Proxy::GetInfoPrivate()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 if (found == name_to_plugin_info_.end()) | 250 if (found == name_to_plugin_info_.end()) |
| 251 return NULL; | 251 return NULL; |
| 252 return found->second.iface; | 252 return found->second.iface; |
| 253 } | 253 } |
| 254 | 254 |
| 255 void InterfaceList::AddFlashInterfaces() { | 255 void InterfaceList::AddFlashInterfaces() { |
| 256 AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); | 256 AddProxy(API_ID_PPB_FLASH, &ProxyFactory<PPB_Flash_Proxy>); |
| 257 AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH, | 257 AddPPB(PPB_FLASH_INTERFACE_11_0, API_ID_PPB_FLASH, |
| 258 PPB_Flash_Proxy::GetInterface11()); | 258 PPB_Flash_Proxy::GetInterface11()); |
| 259 AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH, | 259 AddPPB(PPB_FLASH_INTERFACE_12_0, API_ID_PPB_FLASH, |
| 260 PPB_Flash_Proxy::GetInterface12()); | 260 PPB_Flash_Proxy::GetInterface12_0()); |
| 261 | 261 |
| 262 AddProxy(API_ID_PPB_FLASH_CLIPBOARD, | 262 AddProxy(API_ID_PPB_FLASH_CLIPBOARD, |
| 263 &ProxyFactory<PPB_Flash_Clipboard_Proxy>); | 263 &ProxyFactory<PPB_Flash_Clipboard_Proxy>); |
| 264 AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE, API_ID_PPB_FLASH_CLIPBOARD, | 264 AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE_3_0, API_ID_PPB_FLASH_CLIPBOARD, |
| 265 thunk::GetPPB_Flash_Clipboard_Thunk()); | 265 thunk::GetPPB_Flash_Clipboard_3_0_Thunk()); |
| 266 AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY, API_ID_PPB_FLASH_CLIPBOARD, | 266 AddPPB(PPB_FLASH_CLIPBOARD_INTERFACE_3_LEGACY, API_ID_PPB_FLASH_CLIPBOARD, |
| 267 thunk::GetPPB_Flash_Clipboard_Thunk()); | 267 thunk::GetPPB_Flash_Clipboard_3_0_Thunk()); |
| 268 | 268 |
| 269 AddProxy(API_ID_PPB_FLASH_FILE_FILEREF, | 269 AddProxy(API_ID_PPB_FLASH_FILE_FILEREF, |
| 270 &ProxyFactory<PPB_Flash_File_FileRef_Proxy>); | 270 &ProxyFactory<PPB_Flash_File_FileRef_Proxy>); |
| 271 AddPPB(PPB_FLASH_FILE_FILEREF_INTERFACE, API_ID_PPB_FLASH_FILE_FILEREF, | 271 AddPPB(PPB_FLASH_FILE_FILEREF_INTERFACE, API_ID_PPB_FLASH_FILE_FILEREF, |
| 272 PPB_Flash_File_FileRef_Proxy::GetInterface()); | 272 PPB_Flash_File_FileRef_Proxy::GetInterface()); |
| 273 | 273 |
| 274 AddProxy(API_ID_PPB_FLASH_FILE_MODULELOCAL, | 274 AddProxy(API_ID_PPB_FLASH_FILE_MODULELOCAL, |
| 275 &ProxyFactory<PPB_Flash_File_ModuleLocal_Proxy>); | 275 &ProxyFactory<PPB_Flash_File_ModuleLocal_Proxy>); |
| 276 AddPPB(PPB_FLASH_FILE_MODULELOCAL_INTERFACE, | 276 AddPPB(PPB_FLASH_FILE_MODULELOCAL_INTERFACE, |
| 277 API_ID_PPB_FLASH_FILE_MODULELOCAL, | 277 API_ID_PPB_FLASH_FILE_MODULELOCAL, |
| 278 PPB_Flash_File_ModuleLocal_Proxy::GetInterface()); | 278 PPB_Flash_File_ModuleLocal_Proxy::GetInterface()); |
| 279 | 279 |
| 280 AddProxy(API_ID_PPB_FLASH_MENU, &ProxyFactory<PPB_Flash_Menu_Proxy>); | 280 AddProxy(API_ID_PPB_FLASH_MENU, &ProxyFactory<PPB_Flash_Menu_Proxy>); |
| 281 AddPPB(PPB_FLASH_MENU_INTERFACE, API_ID_PPB_FLASH_MENU, | 281 AddPPB(PPB_FLASH_MENU_INTERFACE_0_2, API_ID_PPB_FLASH_MENU, |
| 282 thunk::GetPPB_Flash_Menu_Thunk()); | 282 thunk::GetPPB_Flash_Menu_0_2_Thunk()); |
| 283 | 283 |
| 284 // Only add PPB because proxy for the this API ID was already added. | 284 // Only add the interface; PPB_TCPSocket_Private provides the API ID's proxy. |
| 285 AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE, API_ID_PPB_TCPSOCKET_PRIVATE, | 285 AddPPB(PPB_FLASH_TCPSOCKET_INTERFACE_0_2, API_ID_PPB_TCPSOCKET_PRIVATE, |
| 286 thunk::GetPPB_TCPSocket_Private_Thunk()); | 286 thunk::GetPPB_TCPSocket_Private_0_3_Thunk()); |
| 287 | 287 |
| 288 #ifdef ENABLE_FLAPPER_HACKS | 288 #ifdef ENABLE_FLAPPER_HACKS |
| 289 AddProxy(API_ID_PPB_FLASH_NETCONNECTOR, | 289 AddProxy(API_ID_PPB_FLASH_NETCONNECTOR, |
| 290 &ProxyFactory<PPB_Flash_NetConnector_Proxy>); | 290 &ProxyFactory<PPB_Flash_NetConnector_Proxy>); |
| 291 AddPPB(PPB_FLASH_NETCONNECTOR_INTERFACE, API_ID_PPB_FLASH_NETCONNECTOR, | 291 AddPPB(PPB_FLASH_NETCONNECTOR_INTERFACE_0_2, API_ID_PPB_FLASH_NETCONNECTOR, |
| 292 thunk::GetPPB_Flash_NetConnector_Thunk()); | 292 thunk::GetPPB_Flash_NetConnector_0_2_Thunk()); |
| 293 #endif | 293 #endif |
| 294 } | 294 } |
| 295 | 295 |
| 296 void InterfaceList::AddProxy(ApiID id, | 296 void InterfaceList::AddProxy(ApiID id, |
| 297 InterfaceProxy::Factory factory) { | 297 InterfaceProxy::Factory factory) { |
| 298 // For interfaces with no corresponding _Proxy objects, the macros will | 298 // For interfaces with no corresponding _Proxy objects, the macros will |
| 299 // generate calls to this function with API_ID_NONE. This means we | 299 // generate calls to this function with API_ID_NONE. This means we |
| 300 // should just skip adding a factory for these functions. | 300 // should just skip adding a factory for these functions. |
| 301 if (id == API_ID_NONE) | 301 if (id == API_ID_NONE) |
| 302 return; | 302 return; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 328 AddPPB(info->name, info->id, info->interface_ptr); | 328 AddPPB(info->name, info->id, info->interface_ptr); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { | 331 void InterfaceList::AddPPP(const InterfaceProxy::Info* info) { |
| 332 AddProxy(info->id, info->create_proxy); | 332 AddProxy(info->id, info->create_proxy); |
| 333 AddPPP(info->name, info->id, info->interface_ptr); | 333 AddPPP(info->name, info->id, info->interface_ptr); |
| 334 } | 334 } |
| 335 | 335 |
| 336 } // namespace proxy | 336 } // namespace proxy |
| 337 } // namespace ppapi | 337 } // namespace ppapi |
| OLD | NEW |