Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / browser / renderer_host / native_web_keyboard_event_mac.mm
blobbeed79ae54f8d8cffb5bf62f7c262f5b27dc32b0
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"
7 #import <AppKit/AppKit.h>
9 #include "content/browser/renderer_host/input/web_input_event_builders_mac.h"
10 #include "ui/events/event.h"
12 namespace content {
14 NativeWebKeyboardEvent::NativeWebKeyboardEvent()
15     : os_event(NULL),
16       skip_in_browser(false) {
19 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
20     : WebKeyboardEvent(WebKeyboardEventBuilder::Build(native_event)),
21       os_event([native_event retain]),
22       skip_in_browser(false) {}
24 NativeWebKeyboardEvent::NativeWebKeyboardEvent(const ui::KeyEvent& key_event)
25     : NativeWebKeyboardEvent(key_event.native_event()) {
28 NativeWebKeyboardEvent::NativeWebKeyboardEvent(
29     const NativeWebKeyboardEvent& other)
30     : WebKeyboardEvent(other),
31       os_event([other.os_event retain]),
32       skip_in_browser(other.skip_in_browser) {
35 NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
36     const NativeWebKeyboardEvent& other) {
37   WebKeyboardEvent::operator=(other);
39   NSObject* previous = os_event;
40   os_event = [other.os_event retain];
41   [previous release];
43   skip_in_browser = other.skip_in_browser;
45   return *this;
48 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
49   [os_event release];
52 }  // namespace content