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 "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h" | 5 #include "native_client/src/shared/ppapi_proxy/browser_ppp_input_event.h" |
6 | 6 |
7 #include "native_client/src/include/nacl_scoped_ptr.h" | 7 #include "native_client/src/include/nacl_scoped_ptr.h" |
8 #include "native_client/src/include/portability.h" | 8 #include "native_client/src/include/portability.h" |
9 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" | 9 #include "native_client/src/shared/ppapi_proxy/browser_globals.h" |
10 #include "native_client/src/shared/ppapi_proxy/input_event_data.h" | 10 #include "native_client/src/shared/ppapi_proxy/input_event_data.h" |
11 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" | 11 #include "native_client/src/shared/ppapi_proxy/object_serialize.h" |
12 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" | 12 #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" |
13 #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" | 13 #include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" |
14 #include "native_client/src/shared/ppapi_proxy/utility.h" | 14 #include "native_client/src/shared/ppapi_proxy/utility.h" |
15 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
16 #include "ppapi/c/ppp_input_event.h" | 16 #include "ppapi/c/ppp_input_event.h" |
17 | 17 |
18 namespace ppapi_proxy { | 18 namespace ppapi_proxy { |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) { | 22 PP_Bool HandleInputEvent(PP_Instance instance, PP_Resource input_event) { |
23 DebugPrintf("PPP_InputEvent::HandleInputEvent: instance=%"NACL_PRIu32", " | 23 DebugPrintf("PPP_InputEvent::HandleInputEvent: instance=%"NACL_PRId32", " |
24 "input_event = %"NACL_PRIu32"\n", | 24 "input_event = %"NACL_PRId32"\n", |
25 instance, input_event); | 25 instance, input_event); |
26 | 26 |
27 PP_Var character_text = PP_MakeUndefined(); | 27 PP_Var character_text = PP_MakeUndefined(); |
28 InputEventData data; | 28 InputEventData data; |
29 data.event_type = PPBInputEventInterface()->GetType(input_event); | 29 data.event_type = PPBInputEventInterface()->GetType(input_event); |
30 data.event_time_stamp = PPBInputEventInterface()->GetTimeStamp(input_event); | 30 data.event_time_stamp = PPBInputEventInterface()->GetTimeStamp(input_event); |
31 data.event_modifiers = PPBInputEventInterface()->GetModifiers(input_event); | 31 data.event_modifiers = PPBInputEventInterface()->GetModifiers(input_event); |
32 | 32 |
33 switch (data.event_type) { | 33 switch (data.event_type) { |
34 // These events all use the PPB_MouseInputEvent interface. | 34 // These events all use the PPB_MouseInputEvent interface. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 &handled); | 102 &handled); |
103 DebugPrintf("PPP_Instance::HandleInputEvent: %s\n", | 103 DebugPrintf("PPP_Instance::HandleInputEvent: %s\n", |
104 NaClSrpcErrorString(srpc_result)); | 104 NaClSrpcErrorString(srpc_result)); |
105 if (srpc_result != NACL_SRPC_RESULT_OK) { | 105 if (srpc_result != NACL_SRPC_RESULT_OK) { |
106 return PP_FALSE; | 106 return PP_FALSE; |
107 } | 107 } |
108 // The 'handled' int should only ever have a value matching one of PP_FALSE | 108 // The 'handled' int should only ever have a value matching one of PP_FALSE |
109 // or PP_TRUE. Otherwise, there's an error in the proxy. | 109 // or PP_TRUE. Otherwise, there's an error in the proxy. |
110 DCHECK((handled == static_cast<int32_t>(PP_FALSE) || | 110 DCHECK((handled == static_cast<int32_t>(PP_FALSE) || |
111 (handled == static_cast<int32_t>(PP_TRUE)))); | 111 (handled == static_cast<int32_t>(PP_TRUE)))); |
112 PP_Bool handled_bool = static_cast<PP_Bool>(handled); | 112 PP_Bool handled_bool = PP_FromBool(handled); |
113 return handled_bool; | 113 return handled_bool; |
114 } | 114 } |
115 | 115 |
116 } // namespace | 116 } // namespace |
117 | 117 |
118 const PPP_InputEvent* BrowserInputEvent::GetInterface() { | 118 const PPP_InputEvent* BrowserInputEvent::GetInterface() { |
119 static const PPP_InputEvent input_event_interface = { | 119 static const PPP_InputEvent input_event_interface = { |
120 HandleInputEvent | 120 HandleInputEvent |
121 }; | 121 }; |
122 return &input_event_interface; | 122 return &input_event_interface; |
123 } | 123 } |
124 | 124 |
125 } // namespace ppapi_proxy | 125 } // namespace ppapi_proxy |
OLD | NEW |