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

Side by Side Diff: ppapi/cpp/input_event.cc

Issue 9353013: Add GetUsbKeyCode dev interface for Pepper key events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Init new fields in InputEventData Created 8 years, 10 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
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"
11 #include "ppapi/cpp/var.h" 11 #include "ppapi/cpp/var.h"
12 12
13 namespace pp { 13 namespace pp {
14 14
15 namespace { 15 namespace {
16 16
17 template <> const char* interface_name<PPB_InputEvent>() { 17 template <> const char* interface_name<PPB_InputEvent>() {
18 return PPB_INPUT_EVENT_INTERFACE; 18 return PPB_INPUT_EVENT_INTERFACE;
19 } 19 }
20 20
21 template <> const char* interface_name<PPB_KeyboardInputEvent>() { 21 template <> const char* interface_name<PPB_KeyboardInputEvent>() {
22 return PPB_KEYBOARD_INPUT_EVENT_INTERFACE; 22 return PPB_KEYBOARD_INPUT_EVENT_INTERFACE;
23 } 23 }
24 24
25 template <> const char* interface_name<PPB_KeyboardInputEvent_Dev>() {
26 return PPB_KEYBOARD_INPUT_EVENT_DEV_INTERFACE;
27 }
28
25 template <> const char* interface_name<PPB_MouseInputEvent>() { 29 template <> const char* interface_name<PPB_MouseInputEvent>() {
26 return PPB_MOUSE_INPUT_EVENT_INTERFACE; 30 return PPB_MOUSE_INPUT_EVENT_INTERFACE;
27 } 31 }
28 32
29 template <> const char* interface_name<PPB_WheelInputEvent>() { 33 template <> const char* interface_name<PPB_WheelInputEvent>() {
30 return PPB_WHEEL_INPUT_EVENT_INTERFACE; 34 return PPB_WHEEL_INPUT_EVENT_INTERFACE;
31 } 35 }
32 36
33 } // namespace 37 } // namespace
34 38
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 } 215 }
212 216
213 Var KeyboardInputEvent::GetCharacterText() const { 217 Var KeyboardInputEvent::GetCharacterText() const {
214 if (!has_interface<PPB_KeyboardInputEvent>()) 218 if (!has_interface<PPB_KeyboardInputEvent>())
215 return Var(); 219 return Var();
216 return Var(Var::PassRef(), 220 return Var(Var::PassRef(),
217 get_interface<PPB_KeyboardInputEvent>()->GetCharacterText( 221 get_interface<PPB_KeyboardInputEvent>()->GetCharacterText(
218 pp_resource())); 222 pp_resource()));
219 } 223 }
220 224
225 // PPB_KeyboardInputEvent_Dev interface.
226
227 bool KeyboardInputEvent::SetUsbScanCode(uint32_t usb_scan_code) {
228 if (!has_interface<PPB_KeyboardInputEvent_Dev>())
229 return false;
230 return PP_ToBool(get_interface<PPB_KeyboardInputEvent_Dev>()->SetUsbScanCode(
231 pp_resource(), usb_scan_code));
232 }
233
234 uint32_t KeyboardInputEvent::GetUsbScanCode() const {
235 if (!has_interface<PPB_KeyboardInputEvent_Dev>())
236 return 0;
237 return get_interface<PPB_KeyboardInputEvent_Dev>()->GetUsbScanCode(
238 pp_resource());
239 }
240
221 } // namespace pp 241 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698