OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
6 #include "ppapi/thunk/thunk.h" | 6 #include "ppapi/thunk/thunk.h" |
7 #include "ppapi/thunk/enter.h" | 7 #include "ppapi/thunk/enter.h" |
8 #include "ppapi/thunk/ppb_input_event_api.h" | 8 #include "ppapi/thunk/ppb_input_event_api.h" |
9 #include "ppapi/thunk/ppb_instance_api.h" | 9 #include "ppapi/thunk/ppb_instance_api.h" |
10 #include "ppapi/thunk/resource_creation_api.h" | 10 #include "ppapi/thunk/resource_creation_api.h" |
11 | 11 |
12 namespace ppapi { | 12 namespace ppapi { |
13 namespace thunk { | 13 namespace thunk { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 typedef EnterFunction<PPB_Instance_FunctionAPI> EnterInstance; | 17 typedef EnterFunction<PPB_Instance_FunctionAPI> EnterInstance; |
18 typedef EnterResource<PPB_InputEvent_API> EnterInputEvent; | 18 typedef EnterResource<PPB_InputEvent_API> EnterInputEvent; |
19 | 19 |
20 // InputEvent ------------------------------------------------------------------ | 20 // InputEvent ------------------------------------------------------------------ |
21 | 21 |
22 int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) { | 22 int32_t RequestInputEvents(PP_Instance instance, uint32_t event_classes) { |
23 EnterInstance enter(instance, true); | 23 EnterInstance enter(instance, true); |
24 if (enter.failed()) | 24 if (enter.failed()) |
25 return PP_ERROR_BADARGUMENT; | 25 return enter.retval(); |
26 return enter.functions()->RequestInputEvents(instance, event_classes); | 26 return enter.functions()->RequestInputEvents(instance, event_classes); |
27 } | 27 } |
28 | 28 |
29 int32_t RequestFilteringInputEvents(PP_Instance instance, | 29 int32_t RequestFilteringInputEvents(PP_Instance instance, |
30 uint32_t event_classes) { | 30 uint32_t event_classes) { |
31 EnterInstance enter(instance, true); | 31 EnterInstance enter(instance, true); |
32 if (enter.failed()) | 32 if (enter.failed()) |
33 return PP_ERROR_BADARGUMENT; | 33 return enter.retval(); |
34 return enter.functions()->RequestFilteringInputEvents(instance, | 34 return enter.functions()->RequestFilteringInputEvents(instance, |
35 event_classes); | 35 event_classes); |
36 } | 36 } |
37 | 37 |
38 void ClearInputEventRequest(PP_Instance instance, | 38 void ClearInputEventRequest(PP_Instance instance, |
39 uint32_t event_classes) { | 39 uint32_t event_classes) { |
40 EnterInstance enter(instance, true); | 40 EnterInstance enter(instance, true); |
41 if (enter.succeeded()) | 41 if (enter.succeeded()) |
42 enter.functions()->ClearInputEventRequest(instance, event_classes); | 42 enter.functions()->ClearInputEventRequest(instance, event_classes); |
43 } | 43 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { | 350 const PPB_WheelInputEvent_1_0* GetPPB_WheelInputEvent_1_0_Thunk() { |
351 return &g_ppb_wheel_input_event_thunk; | 351 return &g_ppb_wheel_input_event_thunk; |
352 } | 352 } |
353 | 353 |
354 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { | 354 const PPB_IMEInputEvent_Dev_0_1* GetPPB_IMEInputEvent_Dev_0_1_Thunk() { |
355 return &g_ppb_ime_input_event_thunk; | 355 return &g_ppb_ime_input_event_thunk; |
356 } | 356 } |
357 | 357 |
358 } // namespace thunk | 358 } // namespace thunk |
359 } // namespace ppapi | 359 } // namespace ppapi |
OLD | NEW |