blob: 35cfbcb51ab2dd2334f3cc188e8010798830ebd1 [file] [log] [blame]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/browser/renderer_host/input/web_input_event_builders_ios.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/event.h"
namespace content {
NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type type,
int modifiers,
base::TimeTicks timestamp)
: WebKeyboardEvent(type, modifiers, timestamp),
os_event(NULL),
skip_in_browser(false) {}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(
const blink::WebKeyboardEvent& web_event,
gfx::NativeView native_view)
: WebKeyboardEvent(web_event), os_event(nullptr), skip_in_browser(false) {}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
: WebKeyboardEvent(WebKeyboardEventBuilder::Build(native_event)),
os_event([native_event retain]),
skip_in_browser(false) {}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(const ui::KeyEvent& key_event)
: NativeWebKeyboardEvent(key_event.native_event()) {}
NativeWebKeyboardEvent::NativeWebKeyboardEvent(
const NativeWebKeyboardEvent& other)
: WebKeyboardEvent(other),
os_event([other.os_event retain]),
skip_in_browser(other.skip_in_browser) {}
NativeWebKeyboardEvent& NativeWebKeyboardEvent::operator=(
const NativeWebKeyboardEvent& other) {
WebKeyboardEvent::operator=(other);
UIEvent* previous = os_event;
os_event = [other.os_event retain];
[previous release];
skip_in_browser = other.skip_in_browser;
return *this;
}
NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
[os_event release];
}
} // namespace content