OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 CHROMEOS_KEYBOARD_H_ | 5 #ifndef CHROMEOS_KEYBOARD_H_ |
6 #define CHROMEOS_KEYBOARD_H_ | 6 #define CHROMEOS_KEYBOARD_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Creates a full XKB layout name like | 93 // Creates a full XKB layout name like |
94 // "gb(extd)+chromeos(leftcontrol_disabled_leftalt)+version(v1_7_r7),us" | 94 // "gb(extd)+chromeos(leftcontrol_disabled_leftalt)+version(v1_7_r7),us" |
95 // from modifier key mapping and |layout_name|, such as "us", "us(dvorak)", and | 95 // from modifier key mapping and |layout_name|, such as "us", "us(dvorak)", and |
96 // "gb(extd)". Returns an empty string on error. | 96 // "gb(extd)". Returns an empty string on error. |
97 // If |use_version| is false, the function does not add "+version(...)" to the | 97 // If |use_version| is false, the function does not add "+version(...)" to the |
98 // layout name. See http://crosbug.com/6261 for details. | 98 // layout name. See http://crosbug.com/6261 for details. |
99 std::string CreateFullXkbLayoutName(const std::string& layout_name, | 99 std::string CreateFullXkbLayoutName(const std::string& layout_name, |
100 const ModifierMap& modifire_map, | 100 const ModifierMap& modifire_map, |
101 bool use_version); | 101 bool use_version); |
102 | 102 |
103 // Returns a layout name which is used in libcros from a full XKB layout name. | |
104 // On error, it returns an empty string. | |
105 // Example: "gb(extd)+chromeos(leftcontrol_disabled_leftalt),us" -> "gb(extd)" | |
106 std::string ExtractLayoutNameFromFullXkbLayoutName( | |
107 const std::string& full_xkb_layout_name); | |
108 | |
109 // Initializes a std::map that holds mappings like: | |
110 // "leftcontrol_disabled_leftalt" -> | |
111 // {{ kSearchKey -> kLeftControlKey }, | |
112 // { kLeftControlKey -> kVoidKey }, | |
113 // { kLeftAltKey -> kLeftAltKey }} | |
114 void InitializeStringToModifierMap( | |
115 StringToModifierMap* out_string_to_modifier_map); | |
116 | |
117 // Returns a mapping of modifier keys from a full XKB layout name. Returns true | |
118 // on success. | |
119 // Example: "gb(extd)+chromeos(leftcontrol_disabled_leftalt),us" -> | |
120 // {{ kSearchKey -> kLeftControlKey }, | |
121 // { kLeftControlKey -> kVoidKey }, | |
122 // { kLeftAltKey -> kLeftAltKey }} | |
123 bool ExtractModifierMapFromFullXkbLayoutName( | |
124 const std::string& full_xkb_layout_name, | |
125 const StringToModifierMap& string_to_modifier_map, | |
126 ModifierMap* out_modifier_map); | |
127 | |
128 // Returns true if caps lock is enabled. | 103 // Returns true if caps lock is enabled. |
| 104 // ONLY FOR UNIT TEST. DO NOT USE THIS FUNCTION. |
129 bool CapsLockIsEnabled(); | 105 bool CapsLockIsEnabled(); |
130 | 106 |
131 // Sets the caps lock status to |enable_caps_lock|. | 107 // Sets the caps lock status to |enable_caps_lock|. |
132 void SetCapsLockEnabled(bool enabled); | 108 void SetCapsLockEnabled(bool enabled); |
133 | 109 |
134 // Returns true if |key| is in |modifier_map| as replacement. | 110 // Returns true if |key| is in |modifier_map| as replacement. |
135 bool ContainsModifierKeyAsReplacement( | 111 bool ContainsModifierKeyAsReplacement( |
136 const ModifierMap& modifier_map, ModifierKey key); | 112 const ModifierMap& modifier_map, ModifierKey key); |
137 | 113 |
138 } // namespace chromeos | 114 } // namespace chromeos |
139 | 115 |
140 #endif // CHROMEOS_KEYBOARD_H_ | 116 #endif // CHROMEOS_KEYBOARD_H_ |
OLD | NEW |