OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_PLUGIN_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ | |
6 #define WEBKIT_GLUE_PLUGIN_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ | |
7 | |
8 #include "third_party/npapi/bindings/npapi.h" | |
9 | |
10 namespace WebKit { | |
11 class WebInputEvent; | |
12 class WebKeyboardEvent; | |
13 class WebMouseEvent; | |
14 class WebMouseWheelEvent; | |
15 } | |
16 | |
17 // Utility class to translating WebInputEvent structs to equivalent structures | |
18 // suitable for sending to Mac plugins (via NPP_HandleEvent). | |
19 class PluginWebEventConverter { | |
20 public: | |
21 PluginWebEventConverter() {} | |
22 virtual ~PluginWebEventConverter() {} | |
23 | |
24 // Initializes a converter for the given web event. Returns false if the event | |
25 // could not be converted. | |
26 virtual bool InitWithEvent(const WebKit::WebInputEvent& web_event); | |
27 | |
28 // Returns a pointer to a plugin event--suitable for passing to | |
29 // NPP_HandleEvent--corresponding to the the web event this converter was | |
30 // created with. The pointer is valid only as long as this object is. | |
31 // Returns NULL iff InitWithEvent returned false. | |
32 virtual void* plugin_event() = 0; | |
33 | |
34 protected: | |
35 // To be overridden by subclasses to store a converted plugin representation | |
36 // of the given web event, suitable for returning from plugin_event. | |
37 // Returns true if the event was successfully converted. | |
38 virtual bool ConvertKeyboardEvent( | |
39 const WebKit::WebKeyboardEvent& web_event) = 0; | |
40 virtual bool ConvertMouseEvent(const WebKit::WebMouseEvent& web_event) = 0; | |
41 virtual bool ConvertMouseWheelEvent( | |
42 const WebKit::WebMouseWheelEvent& web_event) = 0; | |
43 | |
44 private: | |
45 DISALLOW_COPY_AND_ASSIGN(PluginWebEventConverter); | |
46 }; | |
47 | |
48 // Factory for generating PluginWebEventConverter objects by event model. | |
49 class PluginWebEventConverterFactory { | |
50 public: | |
51 // Returns a new PluginWebEventConverter corresponding to the given plugin | |
52 // event model. | |
53 static PluginWebEventConverter* | |
54 CreateConverterForModel(NPEventModel event_model); | |
55 | |
56 private: | |
57 DISALLOW_COPY_AND_ASSIGN(PluginWebEventConverterFactory); | |
58 }; | |
59 | |
60 #endif // WEBKIT_GLUE_PLUGIN_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_ | |
OLD | NEW |