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