| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/cpp/input_event.h" | 5 #include "ppapi/cpp/input_event.h" |
| 6 | 6 |
| 7 #include "ppapi/cpp/instance.h" | 7 #include "ppapi/cpp/instance.h" |
| 8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
| 9 #include "ppapi/cpp/module_impl.h" | 9 #include "ppapi/cpp/module_impl.h" |
| 10 #include "ppapi/cpp/point.h" | 10 #include "ppapi/cpp/point.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 Module::Get()->core()->AddRefResource(event.pp_resource()); | 188 Module::Get()->core()->AddRefResource(event.pp_resource()); |
| 189 PassRefFromConstructor(event.pp_resource()); | 189 PassRefFromConstructor(event.pp_resource()); |
| 190 } | 190 } |
| 191 } | 191 } |
| 192 | 192 |
| 193 KeyboardInputEvent::KeyboardInputEvent(Instance* instance, | 193 KeyboardInputEvent::KeyboardInputEvent(Instance* instance, |
| 194 PP_InputEvent_Type type, | 194 PP_InputEvent_Type type, |
| 195 PP_TimeTicks time_stamp, | 195 PP_TimeTicks time_stamp, |
| 196 uint32_t modifiers, | 196 uint32_t modifiers, |
| 197 uint32_t key_code, | 197 uint32_t key_code, |
| 198 uint32_t usb_scan_code, |
| 198 const Var& character_text) { | 199 const Var& character_text) { |
| 199 // Type check the input event before setting it. | 200 // Type check the input event before setting it. |
| 200 if (!has_interface<PPB_KeyboardInputEvent>()) | 201 if (!has_interface<PPB_KeyboardInputEvent>()) |
| 201 return; | 202 return; |
| 202 PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent>()->Create( | 203 PassRefFromConstructor(get_interface<PPB_KeyboardInputEvent>()->Create( |
| 203 instance->pp_instance(), type, time_stamp, modifiers, key_code, | 204 instance->pp_instance(), type, time_stamp, modifiers, key_code, |
| 204 character_text.pp_var())); | 205 usb_scan_code, character_text.pp_var())); |
| 205 } | 206 } |
| 206 | 207 |
| 207 uint32_t KeyboardInputEvent::GetKeyCode() const { | 208 uint32_t KeyboardInputEvent::GetKeyCode() const { |
| 208 if (!has_interface<PPB_KeyboardInputEvent>()) | 209 if (!has_interface<PPB_KeyboardInputEvent>()) |
| 209 return 0; | 210 return 0; |
| 210 return get_interface<PPB_KeyboardInputEvent>()->GetKeyCode(pp_resource()); | 211 return get_interface<PPB_KeyboardInputEvent>()->GetKeyCode(pp_resource()); |
| 211 } | 212 } |
| 212 | 213 |
| 214 uint32_t KeyboardInputEvent::GetUsbScanCode_Dev() const { |
| 215 if (!has_interface<PPB_KeyboardInputEvent>()) |
| 216 return 0; |
| 217 return get_interface<PPB_KeyboardInputEvent>()->GetUsbScanCode_Dev( |
| 218 pp_resource()); |
| 219 } |
| 220 |
| 213 Var KeyboardInputEvent::GetCharacterText() const { | 221 Var KeyboardInputEvent::GetCharacterText() const { |
| 214 if (!has_interface<PPB_KeyboardInputEvent>()) | 222 if (!has_interface<PPB_KeyboardInputEvent>()) |
| 215 return Var(); | 223 return Var(); |
| 216 return Var(Var::PassRef(), | 224 return Var(Var::PassRef(), |
| 217 get_interface<PPB_KeyboardInputEvent>()->GetCharacterText( | 225 get_interface<PPB_KeyboardInputEvent>()->GetCharacterText( |
| 218 pp_resource())); | 226 pp_resource())); |
| 219 } | 227 } |
| 220 | 228 |
| 221 } // namespace pp | 229 } // namespace pp |
| OLD | NEW |