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 "webkit/plugins/ppapi/plugin_module.h" | 5 #include "webkit/plugins/ppapi/plugin_module.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 #include "ppapi/c/trusted/ppb_buffer_trusted.h" | 79 #include "ppapi/c/trusted/ppb_buffer_trusted.h" |
80 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" | 80 #include "ppapi/c/trusted/ppb_file_chooser_trusted.h" |
81 #include "ppapi/c/trusted/ppb_file_io_trusted.h" | 81 #include "ppapi/c/trusted/ppb_file_io_trusted.h" |
82 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h" | 82 #include "ppapi/c/trusted/ppb_graphics_3d_trusted.h" |
83 #include "ppapi/c/trusted/ppb_image_data_trusted.h" | 83 #include "ppapi/c/trusted/ppb_image_data_trusted.h" |
84 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" | 84 #include "ppapi/c/trusted/ppb_url_loader_trusted.h" |
85 #include "ppapi/shared_impl/input_event_impl.h" | 85 #include "ppapi/shared_impl/input_event_impl.h" |
86 #include "ppapi/shared_impl/time_conversion.h" | 86 #include "ppapi/shared_impl/time_conversion.h" |
87 #include "ppapi/thunk/enter.h" | 87 #include "ppapi/thunk/enter.h" |
88 #include "ppapi/thunk/thunk.h" | 88 #include "ppapi/thunk/thunk.h" |
89 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | |
90 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | |
91 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | |
92 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | |
93 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | |
94 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" | |
95 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | |
bbudge
2011/11/08 00:05:05
Most of these aren't needed anymore.
| |
89 #include "webkit/plugins/plugin_switches.h" | 96 #include "webkit/plugins/plugin_switches.h" |
90 #include "webkit/plugins/ppapi/callbacks.h" | 97 #include "webkit/plugins/ppapi/callbacks.h" |
91 #include "webkit/plugins/ppapi/common.h" | 98 #include "webkit/plugins/ppapi/common.h" |
99 #include "webkit/plugins/ppapi/event_conversion.h" | |
92 #include "webkit/plugins/ppapi/host_globals.h" | 100 #include "webkit/plugins/ppapi/host_globals.h" |
93 #include "webkit/plugins/ppapi/host_resource_tracker.h" | 101 #include "webkit/plugins/ppapi/host_resource_tracker.h" |
94 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" | 102 #include "webkit/plugins/ppapi/ppapi_interface_factory.h" |
95 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 103 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
96 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" | 104 #include "webkit/plugins/ppapi/ppb_directory_reader_impl.h" |
97 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" | 105 #include "webkit/plugins/ppapi/ppb_flash_clipboard_impl.h" |
98 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h" | 106 #include "webkit/plugins/ppapi/ppb_flash_file_impl.h" |
99 #include "webkit/plugins/ppapi/ppb_flash_impl.h" | 107 #include "webkit/plugins/ppapi/ppb_flash_impl.h" |
100 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" | 108 #include "webkit/plugins/ppapi/ppb_flash_menu_impl.h" |
101 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" | 109 #include "webkit/plugins/ppapi/ppb_flash_net_connector_impl.h" |
102 #include "webkit/plugins/ppapi/ppb_font_impl.h" | 110 #include "webkit/plugins/ppapi/ppb_font_impl.h" |
103 #include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h" | 111 #include "webkit/plugins/ppapi/ppb_gpu_blacklist_private_impl.h" |
104 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 112 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
105 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 113 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
106 #include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h" | 114 #include "webkit/plugins/ppapi/ppb_layer_compositor_impl.h" |
107 #include "webkit/plugins/ppapi/ppb_opengles_impl.h" | 115 #include "webkit/plugins/ppapi/ppb_opengles_impl.h" |
108 #include "webkit/plugins/ppapi/ppb_proxy_impl.h" | 116 #include "webkit/plugins/ppapi/ppb_proxy_impl.h" |
109 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" | 117 #include "webkit/plugins/ppapi/ppb_scrollbar_impl.h" |
110 #include "webkit/plugins/ppapi/ppb_uma_private_impl.h" | 118 #include "webkit/plugins/ppapi/ppb_uma_private_impl.h" |
111 #include "webkit/plugins/ppapi/ppb_var_impl.h" | 119 #include "webkit/plugins/ppapi/ppb_var_impl.h" |
112 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" | 120 #include "webkit/plugins/ppapi/ppb_video_capture_impl.h" |
113 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" | 121 #include "webkit/plugins/ppapi/ppb_video_decoder_impl.h" |
114 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" | 122 #include "webkit/plugins/ppapi/ppb_video_layer_impl.h" |
115 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" | 123 #include "webkit/plugins/ppapi/webkit_forwarding_impl.h" |
116 | 124 |
125 using ppapi::InputEventData; | |
117 using ppapi::PpapiGlobals; | 126 using ppapi::PpapiGlobals; |
118 using ppapi::TimeTicksToPPTimeTicks; | 127 using ppapi::TimeTicksToPPTimeTicks; |
119 using ppapi::TimeToPPTime; | 128 using ppapi::TimeToPPTime; |
120 using ppapi::thunk::EnterResource; | 129 using ppapi::thunk::EnterResource; |
130 using ppapi::thunk::EnterResourceNoLock; | |
121 using ppapi::thunk::PPB_Graphics2D_API; | 131 using ppapi::thunk::PPB_Graphics2D_API; |
132 using ppapi::thunk::PPB_InputEvent_API; | |
133 | |
134 using WebKit::WebCursorInfo; | |
135 using WebKit::WebInputEvent; | |
122 | 136 |
123 namespace webkit { | 137 namespace webkit { |
124 namespace ppapi { | 138 namespace ppapi { |
125 | 139 |
126 namespace { | 140 namespace { |
127 | 141 |
128 // Global tracking info for PPAPI plugins. This is lazily created before the | 142 // Global tracking info for PPAPI plugins. This is lazily created before the |
129 // first plugin is allocated, and leaked on shutdown. | 143 // first plugin is allocated, and leaked on shutdown. |
130 // | 144 // |
131 // Note that we don't want a Singleton here since destroying this object will | 145 // Note that we don't want a Singleton here since destroying this object will |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 | 229 |
216 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { | 230 uint32_t GetLiveObjectsForInstance(PP_Instance instance_id) { |
217 return HostGlobals::Get()->host_resource_tracker()->GetLiveObjectsForInstance( | 231 return HostGlobals::Get()->host_resource_tracker()->GetLiveObjectsForInstance( |
218 instance_id); | 232 instance_id); |
219 } | 233 } |
220 | 234 |
221 PP_Bool IsOutOfProcess() { | 235 PP_Bool IsOutOfProcess() { |
222 return PP_FALSE; | 236 return PP_FALSE; |
223 } | 237 } |
224 | 238 |
239 void SimulateInputEvent(PP_Instance instance, PP_Resource input_event) { | |
240 PluginInstance* plugin_instance = host_globals->GetInstance(instance); | |
241 if (!plugin_instance) { | |
242 NOTREACHED(); | |
243 return; | |
244 } | |
245 EnterResourceNoLock<PPB_InputEvent_API> enter(input_event, false); | |
dmichael (off chromium)
2011/11/07 17:12:58
We should probably be consistent and use EnterReso
bbudge
2011/11/08 00:05:05
Done.
| |
246 if (enter.failed()) { | |
247 NOTREACHED(); | |
248 return; | |
249 } | |
250 const InputEventData& data = enter.object()->GetInputEventData(); | |
251 scoped_ptr<WebInputEvent> web_input_event( | |
252 CreateWebInputEvent(data)); | |
253 | |
254 // Route the event back through the plugin, rather than through the entire | |
255 // renderer, to avoid the complex event logic there. | |
256 // TODO(bbudge) For "user gesture" events, create a user gesture indicator | |
257 // here so we can write automated tests for functionality that requires one. | |
258 WebCursorInfo cursor_info; | |
259 plugin_instance->HandleInputEvent(*web_input_event.get(), &cursor_info); | |
260 } | |
261 | |
225 const PPB_Testing_Dev testing_interface = { | 262 const PPB_Testing_Dev testing_interface = { |
226 &ReadImageData, | 263 &ReadImageData, |
227 &RunMessageLoop, | 264 &RunMessageLoop, |
228 &QuitMessageLoop, | 265 &QuitMessageLoop, |
229 &GetLiveObjectsForInstance, | 266 &GetLiveObjectsForInstance, |
230 &IsOutOfProcess | 267 &IsOutOfProcess, |
268 &SimulateInputEvent | |
231 }; | 269 }; |
232 | 270 |
233 // GetInterface ---------------------------------------------------------------- | 271 // GetInterface ---------------------------------------------------------------- |
234 | 272 |
235 const void* GetInterface(const char* name) { | 273 const void* GetInterface(const char* name) { |
236 // All interfaces should be used on the main thread. | 274 // All interfaces should be used on the main thread. |
237 CHECK(IsMainThread()); | 275 CHECK(IsMainThread()); |
238 | 276 |
239 // Allow custom interface factories first stab at the GetInterface call. | 277 // Allow custom interface factories first stab at the GetInterface call. |
240 const void* custom_interface = | 278 const void* custom_interface = |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
556 int retval = entry_points.initialize_module(pp_module(), &GetInterface); | 594 int retval = entry_points.initialize_module(pp_module(), &GetInterface); |
557 if (retval != 0) { | 595 if (retval != 0) { |
558 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; | 596 LOG(WARNING) << "PPP_InitializeModule returned failure " << retval; |
559 return false; | 597 return false; |
560 } | 598 } |
561 return true; | 599 return true; |
562 } | 600 } |
563 | 601 |
564 } // namespace ppapi | 602 } // namespace ppapi |
565 } // namespace webkit | 603 } // namespace webkit |
OLD | NEW |