| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| 11 #include "ppapi/c/dev/ppb_gamepad_dev.h" |
| 11 #include "ppapi/c/ppb_input_event.h" | 12 #include "ppapi/c/ppb_input_event.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 13 | 14 |
| 14 struct PP_InputEvent; | 15 struct PP_InputEvent; |
| 15 | 16 |
| 16 namespace ppapi { | 17 namespace ppapi { |
| 17 struct InputEventData; | 18 struct InputEventData; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace WebKit { | 21 namespace WebKit { |
| 22 class WebGamepads; |
| 21 class WebInputEvent; | 23 class WebInputEvent; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace webkit { | 26 namespace webkit { |
| 25 namespace ppapi { | 27 namespace ppapi { |
| 26 | 28 |
| 27 // Converts the given WebKit event to one or possibly multiple PP_InputEvents. | 29 // Converts the given WebKit event to one or possibly multiple PP_InputEvents. |
| 28 // The generated events will be filled into the given vector. On failure, no | 30 // The generated events will be filled into the given vector. On failure, no |
| 29 // events will ge generated and the vector will be empty. | 31 // events will ge generated and the vector will be empty. |
| 30 void CreateInputEventData(const WebKit::WebInputEvent& event, | 32 void CreateInputEventData(const WebKit::WebInputEvent& event, |
| 31 std::vector< ::ppapi::InputEventData >* pp_events); | 33 std::vector< ::ppapi::InputEventData >* pp_events); |
| 32 | 34 |
| 33 // Creates a WebInputEvent from the given PP_InputEvent. If it fails, returns | 35 // Creates a WebInputEvent from the given PP_InputEvent. If it fails, returns |
| 34 // NULL. The caller owns the created object on success. | 36 // NULL. The caller owns the created object on success. |
| 35 WebKit::WebInputEvent* CreateWebInputEvent( | 37 WebKit::WebInputEvent* CreateWebInputEvent( |
| 36 const ::ppapi::InputEventData& event); | 38 const ::ppapi::InputEventData& event); |
| 37 | 39 |
| 38 // Creates an array of WebInputEvents to make the given event look like a user | 40 // Creates an array of WebInputEvents to make the given event look like a user |
| 39 // input event on all platforms. |plugin_x| and |plugin_y| should be the | 41 // input event on all platforms. |plugin_x| and |plugin_y| should be the |
| 40 // coordinates of a point within the plugin's area on the page. | 42 // coordinates of a point within the plugin's area on the page. |
| 41 std::vector<linked_ptr<WebKit::WebInputEvent> > CreateSimulatedWebInputEvents( | 43 std::vector<linked_ptr<WebKit::WebInputEvent> > CreateSimulatedWebInputEvents( |
| 42 const ::ppapi::InputEventData& event, | 44 const ::ppapi::InputEventData& event, |
| 43 int plugin_x, | 45 int plugin_x, |
| 44 int plugin_y); | 46 int plugin_y); |
| 45 | 47 |
| 46 // Returns the PPAPI event class for the given WebKit event type. The given | 48 // Returns the PPAPI event class for the given WebKit event type. The given |
| 47 // type should not be "Undefined" since there's no corresponding PPAPI class. | 49 // type should not be "Undefined" since there's no corresponding PPAPI class. |
| 48 PP_InputEvent_Class ClassifyInputEvent(WebKit::WebInputEvent::Type type); | 50 PP_InputEvent_Class ClassifyInputEvent(WebKit::WebInputEvent::Type type); |
| 49 | 51 |
| 52 // Translate from WebGamepads to the Gamepad API format |
| 53 // PP_GamepadsSampleData_Dev. |
| 54 void ConvertWebKitGamepadData(WebKit::WebGamepads& webkit_data, |
| 55 PP_GamepadsSampleData_Dev* output_data); |
| 56 |
| 50 } // namespace ppapi | 57 } // namespace ppapi |
| 51 } // namespace webkit | 58 } // namespace webkit |
| 52 | 59 |
| 53 #endif // WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ | 60 #endif // WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ |
| OLD | NEW |