Index: ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h |
diff --git a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h |
index d7a98545d3a435c884854f069798f9b72bcc1b4d..8281b68af27c4fbdf6d1d471b00c64edc595d12a 100644 |
--- a/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h |
+++ b/ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h |
@@ -6,10 +6,14 @@ |
#define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ |
#include <xkbcommon/xkbcommon.h> |
+#include <vector> |
#include "base/containers/hash_tables.h" |
+#include "base/memory/ref_counted.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/memory/weak_ptr.h" |
#include "base/strings/string16.h" |
+#include "base/task_runner.h" |
#include "ui/events/ozone/layout/events_ozone_layout_export.h" |
#include "ui/events/ozone/layout/keyboard_layout_engine.h" |
#include "ui/events/ozone/layout/xkb/scoped_xkb.h" |
@@ -37,6 +41,10 @@ class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine |
KeyboardCode* key_code, |
uint32* platform_keycode) const override; |
+ // Gets the names of the RMLO rule for libxkbcommon. |
+ // Makes it protected for testing. |
+ scoped_ptr<xkb_rule_names> GetXkbRuleNames(const std::string& layout_name); |
+ |
protected: |
// Table for EventFlagsToXkbFlags(). |
struct XkbFlagMapEntry { |
@@ -60,6 +68,11 @@ class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine |
const XkbKeyCodeConverter& key_code_converter_; |
private: |
+ struct XkbKeymapEntry { |
+ std::string layout_name; |
+ xkb_keymap* keymap; |
+ }; |
+ std::vector<XkbKeymapEntry> xkb_keymaps_; |
// Sets a new XKB keymap. This updates xkb_state_ (which takes ownership |
// of the keymap), and updates xkb_flag_map_ for the new keymap. |
void SetKeymap(xkb_keymap* keymap); |
@@ -82,10 +95,19 @@ class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine |
base::char16 base_character, |
int ui_flags) const; |
+ // Callback when keymap file is loaded complete. |
+ void OnKeymapLoaded(const std::string& layout_name, |
+ scoped_ptr<xkb_keymap, XkbKeymapDeleter> keymap); |
+ |
// libxkbcommon uses explicit reference counting for its structures, |
// so we need to trigger its cleanup. |
scoped_ptr<xkb_context, XkbContextDeleter> xkb_context_; |
scoped_ptr<xkb_state, XkbStateDeleter> xkb_state_; |
+ |
+ std::string current_layout_name_; |
+ |
+ // Support weak pointers for attach & detach callbacks. |
+ base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; |
}; |
} // namespace ui |