Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: webkit/plugins/npapi/plugin_web_event_converter_mac.h

Issue 19761007: Move NPAPI implementation out of webkit/plugins/npapi and into content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_PLUGINS_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_
6 #define WEBKIT_PLUGINS_NPAPI_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 namespace webkit {
18 namespace npapi {
19
20 // Utility class to translating WebInputEvent structs to equivalent structures
21 // suitable for sending to Mac plugins (via NPP_HandleEvent).
22 class PluginWebEventConverter {
23 public:
24 PluginWebEventConverter();
25 virtual ~PluginWebEventConverter();
26
27 // Initializes a converter for the given web event. Returns false if the event
28 // could not be converted.
29 bool InitWithEvent(const WebKit::WebInputEvent& web_event);
30
31 // Returns a pointer to a plugin event--suitable for passing to
32 // NPP_HandleEvent--corresponding to the the web event this converter was
33 // created with. The pointer is valid only as long as this object is.
34 // Returns NULL iff InitWithEvent returned false.
35 NPCocoaEvent* plugin_event() { return &cocoa_event_; }
36
37 private:
38 // Stores a converted plugin representation of the given web event, suitable
39 // for returning from plugin_event.
40 // Returns true if the event was successfully converted.
41 bool ConvertKeyboardEvent(const WebKit::WebKeyboardEvent& web_event);
42 bool ConvertMouseEvent(const WebKit::WebMouseEvent& web_event);
43 bool ConvertMouseWheelEvent(const WebKit::WebMouseWheelEvent& web_event);
44
45 // Returns the Cocoa translation of web_event's modifiers.
46 static NSUInteger CocoaModifiers(const WebKit::WebInputEvent& web_event);
47
48 NPCocoaEvent cocoa_event_;
49
50 DISALLOW_COPY_AND_ASSIGN(PluginWebEventConverter);
51 };
52
53 } // namespace npapi
54 } // namespace webkit
55
56 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_WEB_EVENT_CONVERTER_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698