This source file includes following definitions.
- HandleKeyboardEvent
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
#include "base/logging.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "ui/events/event.h"
#include "ui/views/focus/focus_manager.h"
using content::NativeWebKeyboardEvent;
namespace views {
UnhandledKeyboardEventHandler::UnhandledKeyboardEventHandler()
: ignore_next_char_event_(false) {
}
void UnhandledKeyboardEventHandler::HandleKeyboardEvent(
const NativeWebKeyboardEvent& event,
FocusManager* focus_manager) {
if (!focus_manager) {
NOTREACHED();
return;
}
if (event.type == blink::WebInputEvent::Char && ignore_next_char_event_) {
ignore_next_char_event_ = false;
return;
}
ignore_next_char_event_ = false;
if (event.type == blink::WebInputEvent::RawKeyDown) {
ui::Accelerator accelerator(
static_cast<ui::KeyboardCode>(event.windowsKeyCode),
content::GetModifiersFromNativeWebKeyboardEvent(event));
ignore_next_char_event_ = true;
if (focus_manager->ProcessAccelerator(accelerator)) {
return;
}
ignore_next_char_event_ = false;
}
if (event.os_event && !event.skip_in_browser)
focus_manager->OnKeyEvent(*static_cast<ui::KeyEvent*>(event.os_event));
}
}