OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ | 5 #ifndef UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ |
6 #define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ | 6 #define UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ |
7 | 7 |
8 #include <xkbcommon/xkbcommon.h> | 8 #include <xkbcommon/xkbcommon.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "ui/events/ozone/layout/events_ozone_layout_export.h" | 17 #include "ui/events/ozone/layout/events_ozone_layout_export.h" |
18 #include "ui/events/ozone/layout/keyboard_layout_engine.h" | 18 #include "ui/events/ozone/layout/keyboard_layout_engine.h" |
19 #include "ui/events/ozone/layout/xkb/scoped_xkb.h" | 19 #include "ui/events/ozone/layout/xkb/scoped_xkb.h" |
20 #include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h" | 20 #include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h" |
21 | 21 |
22 namespace ui { | 22 namespace ui { |
23 | 23 |
24 class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine | 24 class EVENTS_OZONE_LAYOUT_EXPORT XkbKeyboardLayoutEngine |
25 : public KeyboardLayoutEngine { | 25 : public KeyboardLayoutEngine { |
26 public: | 26 public: |
27 XkbKeyboardLayoutEngine(const XkbKeyCodeConverter& converter); | 27 XkbKeyboardLayoutEngine(const XkbKeyCodeConverter& converter); |
28 virtual ~XkbKeyboardLayoutEngine(); | 28 ~XkbKeyboardLayoutEngine() override; |
29 | 29 |
30 // KeyboardLayoutEngine: | 30 // KeyboardLayoutEngine: |
31 virtual bool CanSetCurrentLayout() const override; | 31 bool CanSetCurrentLayout() const override; |
32 virtual bool SetCurrentLayoutByName(const std::string& layout_name) override; | 32 bool SetCurrentLayoutByName(const std::string& layout_name) override; |
33 | 33 |
34 virtual bool UsesISOLevel5Shift() const override; | 34 bool UsesISOLevel5Shift() const override; |
35 virtual bool UsesAltGr() const override; | 35 bool UsesAltGr() const override; |
36 | 36 |
37 virtual bool Lookup(DomCode dom_code, | 37 bool Lookup(DomCode dom_code, |
38 int flags, | 38 int flags, |
39 DomKey* dom_key, | 39 DomKey* dom_key, |
40 base::char16* character, | 40 base::char16* character, |
41 KeyboardCode* key_code, | 41 KeyboardCode* key_code, |
42 uint32* platform_keycode) const override; | 42 uint32* platform_keycode) const override; |
43 | 43 |
44 // Gets the names of the RMLO rule for libxkbcommon. | 44 // Gets the names of the RMLO rule for libxkbcommon. |
45 // Makes it protected for testing. | 45 // Makes it protected for testing. |
46 scoped_ptr<xkb_rule_names> GetXkbRuleNames(const std::string& layout_name); | 46 scoped_ptr<xkb_rule_names> GetXkbRuleNames(const std::string& layout_name); |
47 | 47 |
48 protected: | 48 protected: |
49 // Table for EventFlagsToXkbFlags(). | 49 // Table for EventFlagsToXkbFlags(). |
50 struct XkbFlagMapEntry { | 50 struct XkbFlagMapEntry { |
51 int ui_flag; | 51 int ui_flag; |
52 xkb_mod_mask_t xkb_flag; | 52 xkb_mod_mask_t xkb_flag; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 std::string current_layout_name_; | 107 std::string current_layout_name_; |
108 | 108 |
109 // Support weak pointers for attach & detach callbacks. | 109 // Support weak pointers for attach & detach callbacks. |
110 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; | 110 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; |
111 }; | 111 }; |
112 | 112 |
113 } // namespace ui | 113 } // namespace ui |
114 | 114 |
115 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ | 115 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ |
OLD | NEW |