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