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