OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ | 5 #ifndef UI_EVENTS_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ |
6 #define UI_EVENTS_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ | 6 #define UI_EVENTS_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <unordered_map> | 10 #include <unordered_map> |
11 | 11 |
12 #include "base/hash.h" | 12 #include "base/hash.h" |
13 #include "ui/events/events_base_export.h" | 13 #include "ui/events/events_base_export.h" |
14 #include "ui/events/keycodes/dom/dom_key.h" | 14 #include "ui/events/keycodes/dom/dom_key.h" |
15 #include "ui/events/keycodes/keyboard_codes_win.h" | 15 #include "ui/events/keycodes/keyboard_codes_win.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 | 18 |
19 enum class DomCode; | 19 enum class DomCode; |
20 | 20 |
21 class EVENTS_BASE_EXPORT PlatformKeyMap { | 21 class EVENTS_BASE_EXPORT PlatformKeyMap { |
22 public: | 22 public: |
23 // Create and load key map table with specified keyboard layout. | 23 // Create and load key map table with specified keyboard layout. |
24 explicit PlatformKeyMap(HKL layout); | 24 explicit PlatformKeyMap(HKL layout); |
| 25 ~PlatformKeyMap(); |
25 | 26 |
26 // Returns the DomKey 'meaning' of |code| in the context of specified | 27 // Returns the DomKey 'meaning' of |code| in the context of specified |
27 // |ui_event_flags| and stored keyboard layout. | 28 // |ui_event_flags| and stored keyboard layout. |
28 DomKey DomCodeAndFlagsToDomKey(DomCode code, | 29 DomKey DomCodeAndFlagsToDomKey(DomCode code, |
29 int ui_event_flags) const; | 30 int ui_event_flags) const; |
30 | 31 |
31 // Returns the DomKey 'meaning' of |code| in the context of specified | 32 // Returns the DomKey 'meaning' of |code| in the context of specified |
32 // |ui_event_flags| and the keyboard layout of current thread. | 33 // |ui_event_flags| and the keyboard layout of current thread. |
33 // Updates a per-thread key map cache whenever the layout changes. | 34 // Updates a per-thread key map cache whenever the layout changes. |
34 static DomKey DomCodeAndFlagsToDomKeyStatic( | 35 static DomKey DomCodeAndFlagsToDomKeyStatic( |
(...skipping 15 matching lines...) Expand all Loading... |
50 base::IntPairHash<std::pair<int, int>>> | 51 base::IntPairHash<std::pair<int, int>>> |
51 DomCodeToKeyMap; | 52 DomCodeToKeyMap; |
52 DomCodeToKeyMap code_to_key_; | 53 DomCodeToKeyMap code_to_key_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(PlatformKeyMap); | 55 DISALLOW_COPY_AND_ASSIGN(PlatformKeyMap); |
55 }; | 56 }; |
56 | 57 |
57 } // namespace ui | 58 } // namespace ui |
58 | 59 |
59 #endif // UI_EVENTS_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ | 60 #endif // UI_EVENTS_KEYCODES_PLATFORM_KEY_MAP_WIN_H_ |
OLD | NEW |