Chromium Code Reviews| 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 #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/ppb_input_event.h" | 11 #include "ppapi/c/ppb_input_event.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 13 | 13 |
| 14 struct PP_InputEvent; | 14 struct PP_InputEvent; |
| 15 | 15 |
| 16 namespace ppapi { | 16 namespace ppapi { |
| 17 struct InputEventData; | 17 struct InputEventData; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace WebKit { | 20 namespace WebKit { |
| 21 class WebInputEvent; | 21 class WebInputEvent; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace webkit { | 24 namespace webkit { |
| 25 namespace ppapi { | 25 namespace ppapi { |
| 26 | 26 |
| 27 // Converts the given WebKit event to one or possibly multiple PP_InputEvents. | 27 // 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 | 28 // The generated events will be filled into the given vector. On failure, no |
| 29 // events will ge generated and the vector will be empty. | 29 // events will ge generated and the vector will be empty. |
| 30 void CreatePPEvent(const WebKit::WebInputEvent& event, | 30 // Setting the |lowlevel_keyboard_events| flag causes low-level USB scancode |
| 31 std::vector<PP_InputEvent>* pp_events); | 31 // to be returned for key events (instead of Windows virtual keycodes). |
|
Wez
2012/02/07 23:48:13
We should see if we can find a better way to do th
garykac
2012/02/09 14:26:04
Done.
| |
| 32 | |
| 33 void CreateInputEventData(const WebKit::WebInputEvent& event, | 32 void CreateInputEventData(const WebKit::WebInputEvent& event, |
| 33 bool lowlevel_keyboard_events, | |
| 34 std::vector< ::ppapi::InputEventData >* pp_events); | 34 std::vector< ::ppapi::InputEventData >* pp_events); |
| 35 | 35 |
| 36 // Creates a WebInputEvent from the given PP_InputEvent. If it fails, returns | 36 // Creates a WebInputEvent from the given PP_InputEvent. If it fails, returns |
| 37 // NULL. The caller owns the created object on success. | 37 // NULL. The caller owns the created object on success. |
| 38 WebKit::WebInputEvent* CreateWebInputEvent( | 38 WebKit::WebInputEvent* CreateWebInputEvent( |
| 39 const ::ppapi::InputEventData& event); | 39 const ::ppapi::InputEventData& event); |
| 40 | 40 |
| 41 // Creates an array of WebInputEvents to make the given event look like a user | 41 // Creates an array of WebInputEvents to make the given event look like a user |
| 42 // input event on all platforms. |plugin_x| and |plugin_y| should be the | 42 // input event on all platforms. |plugin_x| and |plugin_y| should be the |
| 43 // coordinates of a point within the plugin's area on the page. | 43 // coordinates of a point within the plugin's area on the page. |
| 44 std::vector<linked_ptr<WebKit::WebInputEvent> > CreateSimulatedWebInputEvents( | 44 std::vector<linked_ptr<WebKit::WebInputEvent> > CreateSimulatedWebInputEvents( |
| 45 const ::ppapi::InputEventData& event, | 45 const ::ppapi::InputEventData& event, |
| 46 int plugin_x, | 46 int plugin_x, |
| 47 int plugin_y); | 47 int plugin_y); |
| 48 | 48 |
| 49 // Returns the PPAPI event class for the given WebKit event type. The given | 49 // Returns the PPAPI event class for the given WebKit event type. The given |
| 50 // type should not be "Undefined" since there's no corresponding PPAPI class. | 50 // type should not be "Undefined" since there's no corresponding PPAPI class. |
| 51 PP_InputEvent_Class ClassifyInputEvent(WebKit::WebInputEvent::Type type); | 51 PP_InputEvent_Class ClassifyInputEvent(WebKit::WebInputEvent::Type type); |
| 52 | 52 |
| 53 } // namespace ppapi | 53 } // namespace ppapi |
| 54 } // namespace webkit | 54 } // namespace webkit |
| 55 | 55 |
| 56 #endif // WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ | 56 #endif // WEBKIT_PLUGINS_PPAPI_EVENT_CONVERSION_H_ |
| OLD | NEW |