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 <stdint.h> | 8 #include <stdint.h> |
9 #include <xkbcommon/xkbcommon.h> | 9 #include <xkbcommon/xkbcommon.h> |
10 | 10 |
| 11 #include <memory> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
14 #include "base/memory/free_deleter.h" | 15 #include "base/memory/free_deleter.h" |
15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
16 #include "base/memory/scoped_ptr.h" | |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/task_runner.h" | 19 #include "base/task_runner.h" |
20 #include "ui/events/keycodes/scoped_xkb.h" | 20 #include "ui/events/keycodes/scoped_xkb.h" |
21 #include "ui/events/ozone/layout/events_ozone_layout_export.h" | 21 #include "ui/events/ozone/layout/events_ozone_layout_export.h" |
22 #include "ui/events/ozone/layout/keyboard_layout_engine.h" | 22 #include "ui/events/ozone/layout/keyboard_layout_engine.h" |
23 #include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h" | 23 #include "ui/events/ozone/layout/xkb/xkb_key_code_converter.h" |
24 | 24 |
25 namespace ui { | 25 namespace ui { |
26 | 26 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Helper for difficult VKEY lookup. If |ui_flags| matches |base_flags|, | 96 // Helper for difficult VKEY lookup. If |ui_flags| matches |base_flags|, |
97 // returns |base_character|; otherwise returns the XKB character for | 97 // returns |base_character|; otherwise returns the XKB character for |
98 // the keycode and mapped |ui_flags|. | 98 // the keycode and mapped |ui_flags|. |
99 base::char16 XkbSubCharacter(xkb_keycode_t xkb_keycode, | 99 base::char16 XkbSubCharacter(xkb_keycode_t xkb_keycode, |
100 xkb_mod_mask_t base_flags, | 100 xkb_mod_mask_t base_flags, |
101 base::char16 base_character, | 101 base::char16 base_character, |
102 int ui_flags) const; | 102 int ui_flags) const; |
103 | 103 |
104 // Callback when keymap file is loaded complete. | 104 // Callback when keymap file is loaded complete. |
105 void OnKeymapLoaded(const std::string& layout_name, | 105 void OnKeymapLoaded(const std::string& layout_name, |
106 scoped_ptr<char, base::FreeDeleter> keymap_str); | 106 std::unique_ptr<char, base::FreeDeleter> keymap_str); |
107 | 107 |
108 // libxkbcommon uses explicit reference counting for its structures, | 108 // libxkbcommon uses explicit reference counting for its structures, |
109 // so we need to trigger its cleanup. | 109 // so we need to trigger its cleanup. |
110 scoped_ptr<xkb_context, XkbContextDeleter> xkb_context_; | 110 std::unique_ptr<xkb_context, XkbContextDeleter> xkb_context_; |
111 scoped_ptr<xkb_state, XkbStateDeleter> xkb_state_; | 111 std::unique_ptr<xkb_state, XkbStateDeleter> xkb_state_; |
112 | 112 |
113 std::string current_layout_name_; | 113 std::string current_layout_name_; |
114 | 114 |
115 // Support weak pointers for attach & detach callbacks. | 115 // Support weak pointers for attach & detach callbacks. |
116 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; | 116 base::WeakPtrFactory<XkbKeyboardLayoutEngine> weak_ptr_factory_; |
117 }; | 117 }; |
118 | 118 |
119 } // namespace ui | 119 } // namespace ui |
120 | 120 |
121 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ | 121 #endif // UI_EVENTS_OZONE_LAYOUT_XKB_XKB_KEYBOARD_LAYOUT_ENGINE_H_ |
OLD | NEW |