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 "content/public/browser/native_web_keyboard_event.h" | 5 #include "content/public/browser/native_web_keyboard_event.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 | 8 |
9 #include "third_party/WebKit/public/web/gtk/WebInputEventFactory.h" | 9 #include "content/browser/renderer_host/input/web_input_event_builders_gtk.h" |
10 | |
11 using WebKit::WebInputEventFactory; | |
12 | 10 |
13 namespace { | 11 namespace { |
14 | 12 |
15 void CopyEventTo(gfx::NativeEvent in, gfx::NativeEvent* out) { | 13 void CopyEventTo(gfx::NativeEvent in, gfx::NativeEvent* out) { |
16 *out = in ? gdk_event_copy(in) : NULL; | 14 *out = in ? gdk_event_copy(in) : NULL; |
17 } | 15 } |
18 | 16 |
19 void FreeEvent(gfx::NativeEvent event) { | 17 void FreeEvent(gfx::NativeEvent event) { |
20 if (event) | 18 if (event) |
21 gdk_event_free(event); | 19 gdk_event_free(event); |
22 } | 20 } |
23 | 21 |
24 } // namespace | 22 } // namespace |
25 | 23 |
26 namespace content { | 24 namespace content { |
27 | 25 |
28 NativeWebKeyboardEvent::NativeWebKeyboardEvent() | 26 NativeWebKeyboardEvent::NativeWebKeyboardEvent() |
29 : os_event(NULL), | 27 : os_event(NULL), |
30 skip_in_browser(false), | 28 skip_in_browser(false), |
31 match_edit_command(false) { | 29 match_edit_command(false) { |
32 } | 30 } |
33 | 31 |
34 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) | 32 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) |
35 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(&native_event->key)), | 33 : WebKeyboardEvent(WebKeyboardEventBuilder::Build(&native_event->key)), |
36 skip_in_browser(false), | 34 skip_in_browser(false), |
37 match_edit_command(false) { | 35 match_edit_command(false) { |
38 CopyEventTo(native_event, &os_event); | 36 CopyEventTo(native_event, &os_event); |
39 } | 37 } |
40 | 38 |
41 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, | 39 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, |
42 int state, | 40 int state, |
43 double time_stamp_seconds) | 41 double time_stamp_seconds) |
44 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character, | 42 : WebKeyboardEvent(WebKeyboardEventBuilder::Build(character, |
45 state, | 43 state, |
46 time_stamp_seconds)), | 44 time_stamp_seconds)), |
47 os_event(NULL), | 45 os_event(NULL), |
48 skip_in_browser(false), | 46 skip_in_browser(false), |
49 match_edit_command(false) { | 47 match_edit_command(false) { |
50 } | 48 } |
51 | 49 |
52 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | 50 NativeWebKeyboardEvent::NativeWebKeyboardEvent( |
53 const NativeWebKeyboardEvent& other) | 51 const NativeWebKeyboardEvent& other) |
54 : WebKeyboardEvent(other), | 52 : WebKeyboardEvent(other), |
55 skip_in_browser(other.skip_in_browser), | 53 skip_in_browser(other.skip_in_browser), |
56 match_edit_command(other.match_edit_command) { | 54 match_edit_command(other.match_edit_command) { |
(...skipping 11 matching lines...) Expand all Loading... |
68 match_edit_command = other.match_edit_command; | 66 match_edit_command = other.match_edit_command; |
69 | 67 |
70 return *this; | 68 return *this; |
71 } | 69 } |
72 | 70 |
73 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | 71 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { |
74 FreeEvent(os_event); | 72 FreeEvent(os_event); |
75 } | 73 } |
76 | 74 |
77 } // namespace content | 75 } // namespace content |
OLD | NEW |