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