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 "webkit/glue/plugins/pepper_plugin_module.h" | 5 #include "webkit/glue/plugins/pepper_plugin_module.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "third_party/ppapi/c/ppb_buffer.h" | 15 #include "third_party/ppapi/c/ppb_buffer.h" |
16 #include "third_party/ppapi/c/ppb_core.h" | 16 #include "third_party/ppapi/c/ppb_core.h" |
17 #include "third_party/ppapi/c/ppb_device_context_2d.h" | 17 #include "third_party/ppapi/c/ppb_device_context_2d.h" |
18 #include "third_party/ppapi/c/ppb_image_data.h" | 18 #include "third_party/ppapi/c/ppb_image_data.h" |
19 #include "third_party/ppapi/c/ppb_instance.h" | 19 #include "third_party/ppapi/c/ppb_instance.h" |
20 #include "third_party/ppapi/c/ppb_testing.h" | 20 #include "third_party/ppapi/c/ppb_testing.h" |
| 21 #include "third_party/ppapi/c/ppb_url_loader.h" |
| 22 #include "third_party/ppapi/c/ppb_url_request_info.h" |
| 23 #include "third_party/ppapi/c/ppb_url_response_info.h" |
21 #include "third_party/ppapi/c/ppb_var.h" | 24 #include "third_party/ppapi/c/ppb_var.h" |
22 #include "third_party/ppapi/c/ppp.h" | 25 #include "third_party/ppapi/c/ppp.h" |
23 #include "third_party/ppapi/c/ppp_instance.h" | 26 #include "third_party/ppapi/c/ppp_instance.h" |
24 #include "third_party/ppapi/c/pp_module.h" | 27 #include "third_party/ppapi/c/pp_module.h" |
25 #include "third_party/ppapi/c/pp_resource.h" | 28 #include "third_party/ppapi/c/pp_resource.h" |
26 #include "third_party/ppapi/c/pp_var.h" | 29 #include "third_party/ppapi/c/pp_var.h" |
27 #include "webkit/glue/plugins/pepper_buffer.h" | 30 #include "webkit/glue/plugins/pepper_buffer.h" |
28 #include "webkit/glue/plugins/pepper_device_context_2d.h" | 31 #include "webkit/glue/plugins/pepper_device_context_2d.h" |
29 #include "webkit/glue/plugins/pepper_image_data.h" | 32 #include "webkit/glue/plugins/pepper_image_data.h" |
30 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 33 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
31 #include "webkit/glue/plugins/pepper_resource_tracker.h" | 34 #include "webkit/glue/plugins/pepper_resource_tracker.h" |
| 35 #include "webkit/glue/plugins/pepper_url_loader.h" |
| 36 #include "webkit/glue/plugins/pepper_url_request_info.h" |
| 37 #include "webkit/glue/plugins/pepper_url_response_info.h" |
32 #include "webkit/glue/plugins/pepper_var.h" | 38 #include "webkit/glue/plugins/pepper_var.h" |
33 | 39 |
34 typedef bool (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface); | 40 typedef bool (*PPP_InitializeModuleFunc)(PP_Module, PPB_GetInterface); |
35 typedef void (*PPP_ShutdownModuleFunc)(); | 41 typedef void (*PPP_ShutdownModuleFunc)(); |
36 | 42 |
37 namespace pepper { | 43 namespace pepper { |
38 | 44 |
39 namespace { | 45 namespace { |
40 | 46 |
41 // Maintains all currently loaded plugin libs for validating PP_Module | 47 // Maintains all currently loaded plugin libs for validating PP_Module |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 if (strcmp(name, PPB_CORE_INTERFACE) == 0) | 142 if (strcmp(name, PPB_CORE_INTERFACE) == 0) |
137 return &core_interface; | 143 return &core_interface; |
138 if (strcmp(name, PPB_VAR_INTERFACE) == 0) | 144 if (strcmp(name, PPB_VAR_INTERFACE) == 0) |
139 return GetVarInterface(); | 145 return GetVarInterface(); |
140 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0) | 146 if (strcmp(name, PPB_INSTANCE_INTERFACE) == 0) |
141 return PluginInstance::GetInterface(); | 147 return PluginInstance::GetInterface(); |
142 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) | 148 if (strcmp(name, PPB_IMAGEDATA_INTERFACE) == 0) |
143 return ImageData::GetInterface(); | 149 return ImageData::GetInterface(); |
144 if (strcmp(name, PPB_DEVICECONTEXT2D_INTERFACE) == 0) | 150 if (strcmp(name, PPB_DEVICECONTEXT2D_INTERFACE) == 0) |
145 return DeviceContext2D::GetInterface(); | 151 return DeviceContext2D::GetInterface(); |
| 152 if (strcmp(name, PPB_URLLOADER_INTERFACE) == 0) |
| 153 return URLLoader::GetInterface(); |
| 154 if (strcmp(name, PPB_URLREQUESTINFO_INTERFACE) == 0) |
| 155 return URLRequestInfo::GetInterface(); |
| 156 if (strcmp(name, PPB_URLRESPONSEINFO_INTERFACE) == 0) |
| 157 return URLResponseInfo::GetInterface(); |
146 if (strcmp(name, PPB_BUFFER_INTERFACE) == 0) | 158 if (strcmp(name, PPB_BUFFER_INTERFACE) == 0) |
147 return Buffer::GetInterface(); | 159 return Buffer::GetInterface(); |
148 | 160 |
149 // Only support the testing interface when the command line switch is | 161 // Only support the testing interface when the command line switch is |
150 // specified. This allows us to prevent people from (ab)using this interface | 162 // specified. This allows us to prevent people from (ab)using this interface |
151 // in production code. | 163 // in production code. |
152 if (strcmp(name, PPB_TESTING_INTERFACE) == 0) { | 164 if (strcmp(name, PPB_TESTING_INTERFACE) == 0) { |
153 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) | 165 if (CommandLine::ForCurrentProcess()->HasSwitch("enable-pepper-testing")) |
154 return &testing_interface; | 166 return &testing_interface; |
155 } | 167 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 283 |
272 void PluginModule::InstanceCreated(PluginInstance* instance) { | 284 void PluginModule::InstanceCreated(PluginInstance* instance) { |
273 instances_.insert(instance); | 285 instances_.insert(instance); |
274 } | 286 } |
275 | 287 |
276 void PluginModule::InstanceDeleted(PluginInstance* instance) { | 288 void PluginModule::InstanceDeleted(PluginInstance* instance) { |
277 instances_.erase(instance); | 289 instances_.erase(instance); |
278 } | 290 } |
279 | 291 |
280 } // namespace pepper | 292 } // namespace pepper |
OLD | NEW |