| Index: ui/ozone/platform/wayland/wayland_connection.cc | 
| diff --git a/ui/ozone/platform/wayland/wayland_connection.cc b/ui/ozone/platform/wayland/wayland_connection.cc | 
| index 520b21f9f08a62f6b17332484c7e0d6a58a115db..eac4c7601f23578c684a76287ad90f21dfa98436 100644 | 
| --- a/ui/ozone/platform/wayland/wayland_connection.cc | 
| +++ b/ui/ozone/platform/wayland/wayland_connection.cc | 
| @@ -12,9 +12,16 @@ | 
| #include "base/message_loop/message_loop.h" | 
| #include "base/strings/string_util.h" | 
| #include "base/threading/thread_task_runner_handle.h" | 
| +#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" | 
| #include "ui/ozone/platform/wayland/wayland_object.h" | 
| #include "ui/ozone/platform/wayland/wayland_window.h" | 
|  | 
| +#if defined(USE_XKBCOMMON) | 
| +#include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | 
| +#else | 
| +#include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" | 
| +#endif | 
| + | 
| static_assert(XDG_SHELL_VERSION_CURRENT == 5, "Unsupported xdg-shell version"); | 
|  | 
| namespace ui { | 
| @@ -25,7 +32,15 @@ const uint32_t kMaxShmVersion = 1; | 
| const uint32_t kMaxXdgShellVersion = 1; | 
| }  // namespace | 
|  | 
| -WaylandConnection::WaylandConnection() {} | 
| +WaylandConnection::WaylandConnection() { | 
| +#if defined(USE_XKBCOMMON) | 
| +  KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 
| +      base::MakeUnique<XkbKeyboardLayoutEngine>(codes_)); | 
| +#else | 
| +  KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 
| +      base::MakeUnique<StubKeyboardLayoutEngine>()); | 
| +#endif | 
| +} | 
|  | 
| WaylandConnection::~WaylandConnection() {} | 
|  | 
| @@ -227,6 +242,20 @@ void WaylandConnection::Capabilities(void* data, | 
| } else if (connection->pointer_) { | 
| connection->pointer_.reset(); | 
| } | 
| +  if (capabilities & WL_SEAT_CAPABILITY_KEYBOARD) { | 
| +    if (!connection->keyboard_) { | 
| +      wl_keyboard* keyboard = wl_seat_get_keyboard(connection->seat_.get()); | 
| +      if (!keyboard) { | 
| +        LOG(ERROR) << "Failed to get wl_keyboard from seat"; | 
| +        return; | 
| +      } | 
| +      connection->keyboard_ = base::MakeUnique<WaylandKeyboard>( | 
| +          keyboard, base::Bind(&WaylandConnection::DispatchUiEvent, | 
| +                               base::Unretained(connection))); | 
| +    } | 
| +  } else if (connection->keyboard_) { | 
| +    connection->keyboard_.reset(); | 
| +  } | 
| connection->ScheduleFlush(); | 
| } | 
|  | 
|  |