OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dispatcher.h" | 5 #include "ppapi/proxy/dispatcher.h" |
6 | 6 |
7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "ipc/ipc_message.h" | 13 #include "ipc/ipc_message.h" |
14 #include "ipc/ipc_sync_channel.h" | 14 #include "ipc/ipc_sync_channel.h" |
15 #include "ppapi/proxy/interface_proxy.h" | 15 #include "ppapi/proxy/interface_proxy.h" |
16 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
17 #include "ppapi/c/dev/ppb_buffer_dev.h" | |
17 #include "ppapi/c/dev/ppb_testing_dev.h" | 18 #include "ppapi/c/dev/ppb_testing_dev.h" |
18 #include "ppapi/c/dev/ppb_var_deprecated.h" | 19 #include "ppapi/c/dev/ppb_var_deprecated.h" |
19 #include "ppapi/c/pp_errors.h" | 20 #include "ppapi/c/pp_errors.h" |
20 #include "ppapi/c/ppb_core.h" | 21 #include "ppapi/c/ppb_core.h" |
21 #include "ppapi/c/ppb_graphics_2d.h" | 22 #include "ppapi/c/ppb_graphics_2d.h" |
22 #include "ppapi/c/ppb_image_data.h" | 23 #include "ppapi/c/ppb_image_data.h" |
23 #include "ppapi/c/ppb_instance.h" | 24 #include "ppapi/c/ppb_instance.h" |
24 #include "ppapi/c/ppp_instance.h" | 25 #include "ppapi/c/ppp_instance.h" |
25 #include "ppapi/c/ppb_url_loader.h" | 26 #include "ppapi/c/ppb_url_loader.h" |
26 #include "ppapi/c/ppb_url_request_info.h" | 27 #include "ppapi/c/ppb_url_request_info.h" |
27 #include "ppapi/c/ppb_url_response_info.h" | 28 #include "ppapi/c/ppb_url_response_info.h" |
29 #include "ppapi/proxy/ppb_buffer_proxy.h" | |
28 #include "ppapi/proxy/ppb_core_proxy.h" | 30 #include "ppapi/proxy/ppb_core_proxy.h" |
29 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" | 31 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" |
30 #include "ppapi/proxy/ppb_image_data_proxy.h" | 32 #include "ppapi/proxy/ppb_image_data_proxy.h" |
31 #include "ppapi/proxy/ppb_instance_proxy.h" | 33 #include "ppapi/proxy/ppb_instance_proxy.h" |
34 #include "ppapi/proxy/ppb_pdf_proxy.h" | |
32 #include "ppapi/proxy/ppb_testing_proxy.h" | 35 #include "ppapi/proxy/ppb_testing_proxy.h" |
33 #include "ppapi/proxy/ppb_url_loader_proxy.h" | 36 #include "ppapi/proxy/ppb_url_loader_proxy.h" |
34 #include "ppapi/proxy/ppb_url_request_info_proxy.h" | 37 #include "ppapi/proxy/ppb_url_request_info_proxy.h" |
35 #include "ppapi/proxy/ppb_url_response_info_proxy.h" | 38 #include "ppapi/proxy/ppb_url_response_info_proxy.h" |
36 #include "ppapi/proxy/ppb_var_deprecated_proxy.h" | 39 #include "ppapi/proxy/ppb_var_deprecated_proxy.h" |
37 #include "ppapi/proxy/ppp_class_proxy.h" | 40 #include "ppapi/proxy/ppp_class_proxy.h" |
38 #include "ppapi/proxy/ppp_instance_proxy.h" | 41 #include "ppapi/proxy/ppp_instance_proxy.h" |
39 #include "ppapi/proxy/var_serialization_rules.h" | 42 #include "ppapi/proxy/var_serialization_rules.h" |
43 #include "webkit/glue/plugins/ppb_private.h" | |
40 | 44 |
41 namespace pp { | 45 namespace pp { |
42 namespace proxy { | 46 namespace proxy { |
43 | 47 |
44 Dispatcher::Dispatcher(GetInterfaceFunc local_get_interface) | 48 Dispatcher::Dispatcher(GetInterfaceFunc local_get_interface) |
45 : pp_module_(0), | 49 : pp_module_(0), |
46 disallow_trusted_interfaces_(true), | 50 disallow_trusted_interfaces_(true), |
47 local_get_interface_(local_get_interface), | 51 local_get_interface_(local_get_interface), |
48 declared_supported_remote_interfaces_(false), | 52 declared_supported_remote_interfaces_(false), |
49 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 53 callback_tracker_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 continue; | 200 continue; |
197 } | 201 } |
198 proxies_[interfaces[i]] = proxy; | 202 proxies_[interfaces[i]] = proxy; |
199 id_to_proxy_[proxy->GetInterfaceId()] = proxy.get(); | 203 id_to_proxy_[proxy->GetInterfaceId()] = proxy.get(); |
200 } | 204 } |
201 } | 205 } |
202 | 206 |
203 InterfaceProxy* Dispatcher::CreateProxyForInterface( | 207 InterfaceProxy* Dispatcher::CreateProxyForInterface( |
204 const std::string& interface_name, | 208 const std::string& interface_name, |
205 const void* interface_functions) { | 209 const void* interface_functions) { |
210 if (interface_name == PPB_BUFFER_DEV_INTERFACE) | |
211 return new PPB_Buffer_Proxy(this, interface_functions); | |
206 if (interface_name == PPB_CORE_INTERFACE) | 212 if (interface_name == PPB_CORE_INTERFACE) |
207 return new PPB_Core_Proxy(this, interface_functions); | 213 return new PPB_Core_Proxy(this, interface_functions); |
208 if (interface_name == PPB_GRAPHICS_2D_INTERFACE) | 214 if (interface_name == PPB_GRAPHICS_2D_INTERFACE) |
209 return new PPB_Graphics2D_Proxy(this, interface_functions); | 215 return new PPB_Graphics2D_Proxy(this, interface_functions); |
210 if (interface_name == PPB_IMAGEDATA_INTERFACE) | 216 if (interface_name == PPB_IMAGEDATA_INTERFACE) |
211 return new PPB_ImageData_Proxy(this, interface_functions); | 217 return new PPB_ImageData_Proxy(this, interface_functions); |
212 if (interface_name == PPB_INSTANCE_INTERFACE) | 218 if (interface_name == PPB_INSTANCE_INTERFACE) |
213 return new PPB_Instance_Proxy(this, interface_functions); | 219 return new PPB_Instance_Proxy(this, interface_functions); |
220 if (interface_name == PPB_PRIVATE_INTERFACE) | |
viettrungluu
2010/11/11 19:27:03
I assume this will eventually be changed to PPB_PD
brettw
2010/11/11 20:12:09
Yes, I want to rename them, but I don't want to co
| |
221 return new PPB_Pdf_Proxy(this, interface_functions); | |
214 if (interface_name == PPB_TESTING_DEV_INTERFACE) | 222 if (interface_name == PPB_TESTING_DEV_INTERFACE) |
215 return new PPB_Testing_Proxy(this, interface_functions); | 223 return new PPB_Testing_Proxy(this, interface_functions); |
216 if (interface_name == PPB_URLLOADER_INTERFACE) | 224 if (interface_name == PPB_URLLOADER_INTERFACE) |
217 return new PPB_URLLoader_Proxy(this, interface_functions); | 225 return new PPB_URLLoader_Proxy(this, interface_functions); |
218 if (interface_name == PPB_URLREQUESTINFO_INTERFACE) | 226 if (interface_name == PPB_URLREQUESTINFO_INTERFACE) |
219 return new PPB_URLRequestInfo_Proxy(this, interface_functions); | 227 return new PPB_URLRequestInfo_Proxy(this, interface_functions); |
220 if (interface_name == PPB_URLRESPONSEINFO_INTERFACE) | 228 if (interface_name == PPB_URLRESPONSEINFO_INTERFACE) |
221 return new PPB_URLResponseInfo_Proxy(this, interface_functions); | 229 return new PPB_URLResponseInfo_Proxy(this, interface_functions); |
222 if (interface_name == PPB_VAR_DEPRECATED_INTERFACE) | 230 if (interface_name == PPB_VAR_DEPRECATED_INTERFACE) |
223 return new PPB_Var_Deprecated_Proxy(this, interface_functions); | 231 return new PPB_Var_Deprecated_Proxy(this, interface_functions); |
224 if (interface_name == PPP_INSTANCE_INTERFACE) | 232 if (interface_name == PPP_INSTANCE_INTERFACE) |
225 return new PPP_Instance_Proxy(this, interface_functions); | 233 return new PPP_Instance_Proxy(this, interface_functions); |
226 | 234 |
227 return NULL; | 235 return NULL; |
228 } | 236 } |
229 | 237 |
230 } // namespace proxy | 238 } // namespace proxy |
231 } // namespace pp | 239 } // namespace pp |
232 | 240 |
OLD | NEW |