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
3 // found in the LICENSE file.
5 #include "content/public/browser/native_web_keyboard_event.h"
9 #include "content/browser/renderer_host/input/web_input_event_builders_gtk.h"
13 void CopyEventTo(gfx::NativeEvent in
, gfx::NativeEvent
* out
) {
14 *out
= in
? gdk_event_copy(in
) : NULL
;
17 void FreeEvent(gfx::NativeEvent event
) {
19 gdk_event_free(event
);
26 NativeWebKeyboardEvent::NativeWebKeyboardEvent()
28 skip_in_browser(false),
29 match_edit_command(false) {
32 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event
)
33 : WebKeyboardEvent(WebKeyboardEventBuilder::Build(&native_event
->key
)),
34 skip_in_browser(false),
35 match_edit_command(false) {
36 CopyEventTo(native_event
, &os_event
);
39 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character
,
41 double time_stamp_seconds
)
42 : WebKeyboardEvent(WebKeyboardEventBuilder::Build(character
,
46 skip_in_browser(false),
47 match_edit_command(false) {
50 NativeWebKeyboardEvent::NativeWebKeyboardEvent(
51 const NativeWebKeyboardEvent
& other
)
52 : WebKeyboardEvent(other
),
53 skip_in_browser(other
.skip_in_browser
),
54 match_edit_command(other
.match_edit_command
) {
55 CopyEventTo(other
.os_event
, &os_event
);
58 NativeWebKeyboardEvent
& NativeWebKeyboardEvent::operator=(
59 const NativeWebKeyboardEvent
& other
) {
60 WebKeyboardEvent::operator=(other
);
63 CopyEventTo(other
.os_event
, &os_event
);
65 skip_in_browser
= other
.skip_in_browser
;
66 match_edit_command
= other
.match_edit_command
;
71 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
75 } // namespace content