OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/common/input/web_input_event_traits.h" | 5 #include "content/common/input/web_input_event_traits.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 | 9 |
10 using base::StringAppendF; | 10 using base::StringAppendF; |
11 using base::SStringPrintf; | 11 using base::SStringPrintf; |
12 using blink::WebGestureEvent; | 12 using blink::WebGestureEvent; |
13 using blink::WebInputEvent; | 13 using blink::WebInputEvent; |
14 using blink::WebKeyboardEvent; | 14 using blink::WebKeyboardEvent; |
15 using blink::WebMouseEvent; | 15 using blink::WebMouseEvent; |
16 using blink::WebMouseWheelEvent; | 16 using blink::WebMouseWheelEvent; |
17 using blink::WebTouchEvent; | 17 using blink::WebTouchEvent; |
18 using blink::WebTouchPoint; | 18 using blink::WebTouchPoint; |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 namespace { | 21 namespace { |
22 | 22 |
23 void ApppendEventDetails(const WebKeyboardEvent& event, std::string* result) { | 23 void ApppendEventDetails(const WebKeyboardEvent& event, std::string* result) { |
24 StringAppendF(result, | 24 StringAppendF(result, |
25 "{\n WinCode: %d\n NativeCode: %d\n IsSystem: %d\n" | 25 "{\n WinCode: %d\n NativeCode: %d\n IsSystem: %d\n" |
26 " Text: %s\n UnmodifiedText: %s\n KeyIdentifier: %s\n}", | 26 " Text: %s\n UnmodifiedText: %s\n}", |
27 event.windowsKeyCode, | 27 event.windowsKeyCode, |
28 event.nativeKeyCode, | 28 event.nativeKeyCode, |
29 event.isSystemKey, | 29 event.isSystemKey, |
30 reinterpret_cast<const char*>(event.text), | 30 reinterpret_cast<const char*>(event.text), |
31 reinterpret_cast<const char*>(event.unmodifiedText), | 31 reinterpret_cast<const char*>(event.unmodifiedText)); |
32 reinterpret_cast<const char*>(event.keyIdentifier)); | |
33 } | 32 } |
34 | 33 |
35 void ApppendEventDetails(const WebMouseEvent& event, std::string* result) { | 34 void ApppendEventDetails(const WebMouseEvent& event, std::string* result) { |
36 StringAppendF(result, | 35 StringAppendF(result, |
37 "{\n Button: %d\n Pos: (%d, %d)\n WindowPos: (%d, %d)\n" | 36 "{\n Button: %d\n Pos: (%d, %d)\n WindowPos: (%d, %d)\n" |
38 " GlobalPos: (%d, %d)\n Movement: (%d, %d)\n Clicks: %d\n}", | 37 " GlobalPos: (%d, %d)\n Movement: (%d, %d)\n Clicks: %d\n}", |
39 event.button, | 38 event.button, |
40 event.x, | 39 event.x, |
41 event.y, | 40 event.y, |
42 event.windowX, | 41 event.windowX, |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 296 |
298 uint32_t WebInputEventTraits::GetUniqueTouchEventId( | 297 uint32_t WebInputEventTraits::GetUniqueTouchEventId( |
299 const WebInputEvent& event) { | 298 const WebInputEvent& event) { |
300 if (WebInputEvent::isTouchEventType(event.type)) { | 299 if (WebInputEvent::isTouchEventType(event.type)) { |
301 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; | 300 return static_cast<const WebTouchEvent&>(event).uniqueTouchEventId; |
302 } | 301 } |
303 return 0U; | 302 return 0U; |
304 } | 303 } |
305 | 304 |
306 } // namespace content | 305 } // namespace content |
OLD | NEW |