Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc

Issue 2645703005: Add a KeyboardLayoutEngine::SetCurrentLayoutFromBuffer implementation (Closed)
Patch Set: Add a KeyboardLayoutEngine::SetCurrentLayoutFromBuffer implementation Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
diff --git a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
index e22468a10f886eccc8c92530c65371d3ced0e970..0127b11ec3009b9adb5e813644c63763843c9324 100644
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
@@ -692,18 +692,10 @@ bool XkbKeyboardLayoutEngine::SetCurrentLayoutByName(
.MayBlock(),
base::Bind(&LoadKeymap, layout_name, base::ThreadTaskRunnerHandle::Get(),
reply_callback));
- return true;
#else
- // Required by ozone-wayland (at least) for non ChromeOS builds. See
- // http://xkbcommon.org/doc/current/md_doc_quick-guide.html for further info.
- xkb_keymap* keymap = xkb_keymap_new_from_string(
- xkb_context_.get(), layout_name.c_str(), XKB_KEYMAP_FORMAT_TEXT_V1,
- XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!keymap)
- return false;
- SetKeymap(keymap);
- return true;
+ NOTIMPLEMENTED();
#endif // defined(OS_CHROMEOS)
+ return true;
}
void XkbKeyboardLayoutEngine::OnKeymapLoaded(
@@ -802,13 +794,18 @@ bool XkbKeyboardLayoutEngine::Lookup(DomCode dom_code,
return true;
}
-void XkbKeyboardLayoutEngine::SetKeymapFromStringForTest(
- const char* keymap_string) {
- xkb_keymap* keymap = xkb_keymap_new_from_string(
- xkb_context_.get(), keymap_string, XKB_KEYMAP_FORMAT_TEXT_V1,
+bool XkbKeyboardLayoutEngine::SetCurrentLayoutFromBuffer(
+ const char* keymap_string,
+ uint32_t size) {
+ xkb_keymap* keymap = xkb_keymap_new_from_buffer(
+ xkb_context_.get(), keymap_string, size, XKB_KEYMAP_FORMAT_TEXT_V1,
XKB_KEYMAP_COMPILE_NO_FLAGS);
+ if (!keymap)
+ return false;
+
if (keymap)
Michael Forney 2017/01/20 19:31:43 This check is unnecessary. You already returned if
tonikitoo 2017/01/20 20:01:13 Done.
SetKeymap(keymap);
+ return true;
}
void XkbKeyboardLayoutEngine::SetKeymap(xkb_keymap* keymap) {

Powered by Google App Engine
This is Rietveld 408576698