Commit 58ee63f4 authored by Yuichiro Hanada's avatar Yuichiro Hanada Committed by Chromium LUCI CQ

arc: Use the active keyboard layout to get KeyboardCode.

In order to interpret the DomCode sent from ARC++ correctly,
the serializer should use the active keyboard layout instead of assming
the US keyboard layout always.

Bug: b:174259561
Change-Id: Ibf40ec446afa8c732ea8e8d77fce798b54bd0dab
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596668Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Yuichiro Hanada <yhanada@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844058}
parent 1a7d992f
......@@ -391,6 +391,7 @@ if (is_chromeos_ash) {
":mojom",
"//ui/base/ime:text_input_types",
"//ui/events",
"//ui/events/ozone/layout",
]
}
......
......@@ -7,6 +7,8 @@
#include "ui/events/keycodes/dom/dom_code.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"
#include "ui/events/ozone/layout/keyboard_layout_engine.h"
#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
namespace mojo {
using KeyEventUniquePtr = std::unique_ptr<ui::KeyEvent>;
......@@ -38,8 +40,10 @@ bool StructTraits<arc::mojom::KeyEventDataDataView, KeyEventUniquePtr>::Read(
ui::KeyboardCode key_code;
ui::DomKey dom_key;
if (!DomCodeToUsLayoutDomKey(dom_code, flags, &dom_key, &key_code))
if (!ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()->Lookup(
dom_code, flags, &dom_key, &key_code)) {
return false;
}
*out = std::make_unique<ui::KeyEvent>(type, key_code, dom_code, flags,
dom_key, base::TimeTicks::Now());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment