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

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

Issue 812613004: ozone: Fix events_unittests build with use_xkbcommon==1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0f99b2cea2d8c9d56c10b0b7d6d2d2fc4e0c47a8..ffbfb3e6ade6878001745c228dcfd7d35feed569 100644
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.cc
@@ -625,32 +625,13 @@ const PrintableSimpleEntry kSimpleMap[] = {
{0x0259, VKEY_OEM_3}, // schwa
};
-void ParseLayoutName(const std::string& layout_name,
- std::string* layout_id,
- std::string* layout_variant) {
- size_t dash_index = layout_name.find('-');
- size_t parentheses_index = layout_name.find('(');
- *layout_id = layout_name;
- *layout_variant = "";
- if (parentheses_index != std::string::npos) {
- *layout_id = layout_name.substr(0, parentheses_index);
- size_t close_index = layout_name.find(')', parentheses_index);
- if (close_index == std::string::npos)
- close_index = layout_name.size();
- *layout_variant = layout_name.substr(parentheses_index + 1,
- close_index - parentheses_index - 1);
- } else if (dash_index != std::string::npos) {
- *layout_id = layout_name.substr(0, dash_index);
- *layout_variant = layout_name.substr(dash_index + 1);
- }
-}
-
void LoadKeymap(const std::string& layout_name,
scoped_refptr<base::SingleThreadTaskRunner> reply_runner,
const LoadKeymapCallback& reply_callback) {
std::string layout_id;
std::string layout_variant;
- ParseLayoutName(layout_name, &layout_id, &layout_variant);
+ XkbKeyboardLayoutEngine::ParseLayoutName(layout_name, &layout_id,
+ &layout_variant);
xkb_rule_names names = {.rules = NULL,
.model = "pc101",
.layout = layout_id.c_str(),
@@ -951,4 +932,23 @@ base::char16 XkbKeyboardLayoutEngine::XkbSubCharacter(
return character;
}
+void XkbKeyboardLayoutEngine::ParseLayoutName(const std::string& layout_name,
+ std::string* layout_id,
+ std::string* layout_variant) {
+ size_t dash_index = layout_name.find('-');
+ size_t parentheses_index = layout_name.find('(');
+ *layout_id = layout_name;
+ *layout_variant = "";
+ if (parentheses_index != std::string::npos) {
+ *layout_id = layout_name.substr(0, parentheses_index);
+ size_t close_index = layout_name.find(')', parentheses_index);
+ if (close_index == std::string::npos)
+ close_index = layout_name.size();
+ *layout_variant = layout_name.substr(parentheses_index + 1,
+ close_index - parentheses_index - 1);
+ } else if (dash_index != std::string::npos) {
+ *layout_id = layout_name.substr(0, dash_index);
+ *layout_variant = layout_name.substr(dash_index + 1);
+ }
+}
} // namespace ui
« no previous file with comments | « ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698