| 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 skip_in_browser(false) { |
| 15 } | 16 } |
| 16 | 17 |
| 17 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent* event) | 18 NativeWebKeyboardEvent::NativeWebKeyboardEvent(NSEvent* event) |
| 18 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(event)), | 19 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(event)), |
| 19 os_event([event retain]) { | 20 os_event([event retain]), |
| 21 skip_in_browser(false) { |
| 20 } | 22 } |
| 21 | 23 |
| 22 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, | 24 NativeWebKeyboardEvent::NativeWebKeyboardEvent(wchar_t character, |
| 23 int modifiers, | 25 int modifiers, |
| 24 double time_stamp_seconds) | 26 double time_stamp_seconds) |
| 25 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character, | 27 : WebKeyboardEvent(WebInputEventFactory::keyboardEvent(character, |
| 26 modifiers, | 28 modifiers, |
| 27 time_stamp_seconds)), | 29 time_stamp_seconds)), |
| 28 os_event(NULL) { | 30 os_event(NULL), |
| 31 skip_in_browser(false) { |
| 29 } | 32 } |
| 30 | 33 |
| 31 NativeWebKeyboardEvent::NativeWebKeyboardEvent( | 34 NativeWebKeyboardEvent::NativeWebKeyboardEvent( |
| 32 const NativeWebKeyboardEvent& other) | 35 const NativeWebKeyboardEvent& other) |
| 33 : WebKeyboardEvent(other), | 36 : WebKeyboardEvent(other), |
| 34 os_event([other.os_event retain]) { | 37 os_event([other.os_event retain]), |
| 38 skip_in_browser(other.skip_in_browser) { |
| 35 } | 39 } |
| 36 | 40 |
| 37 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( | 41 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=( |
| 38 const NativeWebKeyboardEvent& other) { | 42 const NativeWebKeyboardEvent& other) { |
| 39 WebKeyboardEvent::operator=(other); | 43 WebKeyboardEvent::operator=(other); |
| 40 | 44 |
| 41 NSObject* previous = os_event; | 45 NSObject* previous = os_event; |
| 42 os_event = [other.os_event retain]; | 46 os_event = [other.os_event retain]; |
| 43 [previous release]; | 47 [previous release]; |
| 44 | 48 |
| 49 skip_in_browser = other.skip_in_browser; |
| 50 |
| 45 return *this; | 51 return *this; |
| 46 } | 52 } |
| 47 | 53 |
| 48 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { | 54 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { |
| 49 [os_event release]; | 55 [os_event release]; |
| 50 } | 56 } |
| OLD | NEW |