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

Side by Side Diff: src/shared/ppapi_proxy/browser_ppp_input_event.h

Issue 7395005: Proxy PPB_Input_Event, PPP_Input_Event, and associated IFs. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Another gyp fix, windows build fix Created 9 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 2010 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can
3 // be found in the LICENSE file.
4
5 #ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
6 #define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
7
8 #include <map>
9
10 #include "native_client/src/include/nacl_macros.h"
11 // Needed because ppp_instance.h does not include everything it needs.
12 #include "native_client/src/third_party/ppapi/c/pp_resource.h"
13 #include "native_client/src/third_party/ppapi/c/pp_instance.h"
14 #include "native_client/src/third_party/ppapi/c/ppb_input_event.h"
15
16 struct PPP_InputEvent;
17
18 namespace ppapi_proxy {
19
20 // Implements the trusted side of the PPP_InputEvent interface.
21 class BrowserInputEvent {
22 public:
23 static const PPP_InputEvent* GetInterface();
24
25 // PPP_InputEvent is dispatching an event, it needs to know whether it should
26 // ignore the 'handled' PP_Bool return value for events the NaCl instance is
27 // not filtering. These functions allow the PPB_InputEvent proxy code to
28 // BrowserInputEvent what event types are requested (filtering & not) and when
29 // requests for event types are cleared. See ppb_input_event_rpc_server.cc for
30 // where these functions are used.
31 static void InputEventsRequested(PP_Instance instance, uint32_t event_classes,
32 bool filtering);
33 static void InputEventsCleared(PP_Instance, uint32_t event_classes);
34 static bool InputEventTypeIsRegistered(PP_Instance instance,
35 PP_InputEvent_Type type);
36 static bool InputEventTypeIsFiltered(PP_Instance instance,
37 PP_InputEvent_Type type);
38
39 // Allows BrowserInstance to remove and instance from our map on deletion of
sehr (please use chromium) 2011/07/20 00:33:41 s/and/an/
dmichael (off chromium) 2011/07/20 03:50:22 Done.
40 // an instance. (TODO(NaCl team): It would probably make sense to use
41 // observer pattern for instance creation/deletion if we have much of this
42 // kind of stuff).
43 static void InstanceDestroyed(PP_Instance instance);
44
45 private:
46 // A struct to hold 'registered_nonfiltering' and 'registered_filtering'
47 // bitfields. This is used in the map below.
48 struct RegisteredTypes {
49 RegisteredTypes() : filtering(0), nonfiltering(0) {
50 }
51 uint32_t filtering;
52 uint32_t nonfiltering;
53 };
54
55 // This map is used so that when PPB_InputEvent is used to request input
56 // events, it can store the filtering flags here. Then, when PPP_InputEvent is
57 // dispatching an event, it can ignore the 'handled' PP_Bool return value for
58 // events the NaCl instance is not filtering. See
59 // ppb_input_event_rpc_server.cc for where filtering bitfields are added to
60 // this map.
61 typedef std::map<PP_Instance, RegisteredTypes> InstanceRegisteredTypesMap;
62 static InstanceRegisteredTypesMap& instance_registered_map() {
63 static InstanceRegisteredTypesMap map;
sehr (please use chromium) 2011/07/20 00:33:41 The same thread safety issue we were talking about
dmichael (off chromium) 2011/07/20 03:50:22 Input events always come in on the main thread. Th
64 return map;
65 }
66
67 private:
68 NACL_DISALLOW_COPY_AND_ASSIGN(BrowserInputEvent);
69 };
70
71 } // namespace ppapi_proxy
72
73 #endif // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_BROWSER_INPUT_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698