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

Unified Diff: ui/events/keycodes/keyboard_lookup_win.h

Issue 1585193002: Build key map DomCodeToKey() for Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned API, added unittest Created 4 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
Index: ui/events/keycodes/keyboard_lookup_win.h
diff --git a/ui/events/keycodes/keyboard_lookup_win.h b/ui/events/keycodes/keyboard_lookup_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..d22361e01c7fcd1dca3e87660c6f197884f101aa
--- /dev/null
+++ b/ui/events/keycodes/keyboard_lookup_win.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
dtapuska 2016/01/21 01:59:36 2016
chongz 2016/01/21 15:47:40 Acknowledged.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_EVENTS_KEYCODES_KEYBOARD_LOOKUP_WIN_H_
+#define UI_EVENTS_KEYCODES_KEYBOARD_LOOKUP_WIN_H_
+
+#include <windows.h>
+
+#include "ui/events/event_constants.h"
+#include "ui/events/events_base_export.h"
+#include "ui/events/keycodes/dom/dom_key.h"
+#include "ui/events/keycodes/keyboard_codes_win.h"
+
+namespace ui {
+
+class EVENTS_BASE_EXPORT WindowsKeyboardLookup {
+ public:
+ static WindowsKeyboardLookup* Create(HKL alayout);
dtapuska 2016/01/21 01:59:36 You likely want to hold return this as a scoped_pt
chongz 2016/01/21 15:47:40 Will just expose constructor
+
+ static DomKey VirtualKeyToCurrentLayoutDomKey(KeyboardCode vkcode,
+ int event_flags);
+ DomKey VirtualKeyToDomKey(KeyboardCode vkcode, int event_flags) const;
+
+ private:
+ WindowsKeyboardLookup(): keyboard_layout_(nullptr) {}
+
+ void CheckOrLoadLayout(HKL alayout);
+ void SetModifierState(BYTE *keyboard_state, int event_flags) const;
+
+ size_t GetEventFlagsIndex(int event_flags) const;
dtapuska 2016/01/21 01:59:36 I think these three things can just be in anonymou
chongz 2016/01/21 15:47:40 Acknowledged.
+ int EventFlagsFromIndex(size_t index) const;
+ static const EventFlags event_flags_index[];
+
+ static const size_t kMaxVirtualKeyCode = 256;
+ static const size_t kMaxKeyboardModifier = 1 << 8;
+
+ HKL keyboard_layout_;
+ DomKey lookup_table_[kMaxVirtualKeyCode][kMaxKeyboardModifier];
+
+ static WindowsKeyboardLookup* GetInstance();
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_KEYCODES_KEYBOARD_LOOKUP_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698