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

Unified Diff: ui/events/ozone/layout/layout_util.cc

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 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
« no previous file with comments | « ui/events/ozone/layout/layout_util.h ('k') | ui/events/ozone/layout/no/no_keyboard_layout_engine.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/ozone/layout/layout_util.cc
diff --git a/ui/events/ozone/layout/layout_util.cc b/ui/events/ozone/layout/layout_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6864d4a0008fb3ddc7684ed1ca9a9c790e8700a1
--- /dev/null
+++ b/ui/events/ozone/layout/layout_util.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/ozone/layout/layout_util.h"
+
+#include "ui/events/event_constants.h"
+#include "ui/events/keycodes/dom/dom_key.h"
+
+namespace ui {
+
+int ModifierDomKeyToEventFlag(DomKey key) {
+ switch (key) {
+ case DomKey::ALT:
+ return EF_ALT_DOWN;
+ case DomKey::ALT_GRAPH:
+ return EF_ALTGR_DOWN;
+ // ChromeOS uses F16 to represent CapsLock before the rewriting stage,
+ // based on the historical X11 implementation.
+ // TODO post-X11: Switch to use CapsLock uniformly.
+ case DomKey::F16:
+ case DomKey::CAPS_LOCK:
+ return EF_CAPS_LOCK_DOWN;
+ case DomKey::CONTROL:
+ return EF_CONTROL_DOWN;
+ case DomKey::META:
+ return EF_ALT_DOWN;
+ case DomKey::OS:
+ return EF_COMMAND_DOWN;
+ case DomKey::SHIFT:
+ return EF_SHIFT_DOWN;
+ case DomKey::SHIFT_LEVEL5:
+ return EF_MOD3_DOWN;
+ default:
+ return EF_NONE;
+ }
+ // Not represented:
+ // DomKey::ACCEL
+ // DomKey::FN
+ // DomKey::FN_LOCK
+ // DomKey::HYPER
+ // DomKey::NUM_LOCK
+ // DomKey::SCROLL_LOCK
+ // DomKey::SUPER
+ // DomKey::SYMBOL_LOCK
+}
+
+} // namespace ui
« no previous file with comments | « ui/events/ozone/layout/layout_util.h ('k') | ui/events/ozone/layout/no/no_keyboard_layout_engine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698