Index: ui/events/ozone/layout/keyboard_layout_engine.h |
diff --git a/ui/events/ozone/layout/keyboard_layout_engine.h b/ui/events/ozone/layout/keyboard_layout_engine.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..afd8416b88ee087d7542df91223f9af9139c5b62 |
--- /dev/null |
+++ b/ui/events/ozone/layout/keyboard_layout_engine.h |
@@ -0,0 +1,66 @@ |
+// 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. |
+ |
+#ifndef UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ |
+#define UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ |
+ |
+#include <string> |
+ |
+#include "base/strings/string16.h" |
+#include "ui/events/keycodes/keyboard_codes.h" |
+#include "ui/events/ozone/layout/events_ozone_layout_export.h" |
+ |
+namespace ui { |
+ |
+enum class DomCode; |
+enum class DomKey; |
+ |
+// XXX TODO(kpschoedel): document me |
+class EVENTS_OZONE_LAYOUT_EXPORT KeyboardLayoutEngine { |
+ public: |
+ KeyboardLayoutEngine() {} |
+ virtual ~KeyboardLayoutEngine() {} |
+ |
+ // Returns true if it is possible to change the current layout. |
+ virtual bool CanSetCurrentLayout() const = 0; |
+ |
+ // Sets the current layout; returns true on success. |
+ virtual bool SetCurrentLayoutByName(const std::string& layout_name) = 0; |
+ |
+ // Returns true if the current layout makes use of the ISO Level 5 Shift key. |
+ virtual bool UsesISOLevel5Shift() const = 0; |
+ |
+ // Returns true if the current layout makes use of the AltGr |
+ // (ISO Level 3 Shift) key. |
+ virtual bool UsesAltGr() const = 0; |
+ |
+ // Provides the interpretation of a physical key. |
+ // |
+ // The caller must supply valid addresses for all the output parameters; |
+ // the function must not use their initial values. |
+ // |
+ // If the function can determine an interpretation of the (dom_code, flags) |
+ // values, it must set *dom_key and must set *character, may optionally |
+ // set *key_code, and returns true. A layout function that does not directly |
+ // know the correct KeyboardCode should not touch *key_code. |
+ // |
+ // If the function can determine that the (dom_code, flags) values have NO |
+ // interpretation in the current layout (e.g. the key is unbound), it must |
+ // set *dom_key to UNIDENTIFIED and *character to 0, should set *key_code |
+ // to VKEY_UNKNOWN if and only if it would normally set *key_code, and |
+ // returns true. |
+ // |
+ // Otherwise -- if it cannot determine the interpretation, and cannot |
+ // determine that there is none -- it must not set any of the output |
+ // parameters, and returns false. |
+ virtual bool Lookup(DomCode dom_code, |
+ int flags, |
+ DomKey* dom_key, |
+ base::char16* character, |
+ KeyboardCode* key_code) const = 0; |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_ |