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

Side by Side Diff: ui/events/ozone/layout/keyboard_layout_engine.h

Issue 742103002: Ozone keyboard layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lite-code
Patch Set: reeeeebase Created 6 years 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_
6 #define UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_
7
8 #include <string>
9
10 #include "base/strings/string16.h"
11 #include "ui/events/keycodes/keyboard_codes.h"
12 #include "ui/events/ozone/layout/events_ozone_layout_export.h"
13
14 namespace ui {
15
16 enum class DomCode;
17 enum class DomKey;
18
19 // A KeyboardLayoutEngine provides a platform-independent interface to
20 // key mapping. Key mapping provides a meaning (DomKey and character,
21 // and optionally Windows key code) for a physical key press (DomCode
22 // and modifier flags).
23 //
24 // This interface does not expose individual layouts because it must support
25 // platforms that only provide for one active system layout, and/or platforms
26 // where layouts have no accessible representation.
27 class EVENTS_OZONE_LAYOUT_EXPORT KeyboardLayoutEngine {
28 public:
29 KeyboardLayoutEngine() {}
30 virtual ~KeyboardLayoutEngine() {}
31
32 // Returns true if it is possible to change the current layout.
33 virtual bool CanSetCurrentLayout() const = 0;
34
35 // Sets the current layout; returns true on success.
36 // Drop-in replacement for ImeKeyboard::SetCurrentKeyboardLayoutByName();
37 // the argument string is defined by that interface (crbug.com/362698).
38 virtual bool SetCurrentLayoutByName(const std::string& layout_name) = 0;
39
40 // Returns true if the current layout makes use of the ISO Level 5 Shift key.
41 // Drop-in replacement for ImeKeyboard::IsISOLevel5ShiftAvailable().
42 virtual bool UsesISOLevel5Shift() const = 0;
43
44 // Returns true if the current layout makes use of the AltGr
45 // (ISO Level 3 Shift) key.
46 // Drop-in replacement for ImeKeyboard::IsAltGrAvailable().
47 virtual bool UsesAltGr() const = 0;
48
49 // Provides the meaning of a physical key.
50 //
51 // The caller must supply valid addresses for all the output parameters;
52 // the function must not use their initial values.
53 //
54 // Returns true if it can determine the DOM meaning (i.e. ui::DomKey and
55 // character) and the corresponding legacy KeyboardCode from the given
56 // physical state (ui::DomCode and ui::EventFlags), OR if it can determine
57 // that there is no meaning in the current layout (e.g. the key is unbound).
58 // In the latter case, the function sets *dom_key to UNIDENTIFIED, *character
59 // to 0, and *key_code to VKEY_UNKNOWN.
60 //
61 // Returns false if it cannot determine the meaning (and cannot determine
62 // that there is none); in this case it does not set any of the output
63 // parameters.
64 virtual bool Lookup(DomCode dom_code,
65 int event_flags,
66 DomKey* dom_key,
67 base::char16* character,
68 KeyboardCode* key_code) const = 0;
69 };
70
71 } // namespace ui
72
73 #endif // UI_OZONE_PUBLIC_KEYBOARD_LAYOUT_ENGINE_H_
OLDNEW
« no previous file with comments | « ui/events/ozone/layout/events_ozone_layout_export.h ('k') | ui/events/ozone/layout/keyboard_layout_engine_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698