OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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. | |
4 | |
5 #include "chrome/common/native_web_keyboard_event.h" | |
6 | |
7 #import <AppKit/AppKit.h> | |
8 | |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/mac/WebInputEventFact
ory.h" | |
10 | |
11 using WebKit::WebInputEventFactory; | |
12 | |
13 NativeWebKeyboardEvent::NativeWebKeyboardEvent() | |
14 : os_event(NULL), | |
15 skip_in_browser(false) { | |
16 } | |
17 | |
18 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent* event) | |
19 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(event)), | |
20 os_event([event retain]), | |
21 skip_in_browser(false) { | |
22 } | |
23 | |
24 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, | |
25 int modifiers, | |
26 double time_stamp_seconds) | |
27 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character, | |
28 modifiers, | |
29 time_stamp_seconds)), | |
30 os_event(NULL), | |
31 skip_in_browser(false) { | |
32 } | |
33 | |
34 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | |
35 const NativeWebKeyboardEvent& other) | |
36 : WebKeyboardEvent(other), | |
37 os_event([other.os_event retain]), | |
38 skip_in_browser(other.skip_in_browser) { | |
39 } | |
40 | |
41 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( | |
42 const NativeWebKeyboardEvent& other) { | |
43 WebKeyboardEvent::operator=(other); | |
44 | |
45 NSObject* previous = os_event; | |
46 os_event = [other.os_event retain]; | |
47 [previous release]; | |
48 | |
49 skip_in_browser = other.skip_in_browser; | |
50 | |
51 return *this; | |
52 } | |
53 | |
54 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | |
55 [os_event release]; | |
56 } | |
OLD | NEW |