1 // Copyright 2018 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 ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_ 6 #define ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_ 7 8 #include <vector> 9 10 #include "ash/shortcut_viewer/ksv_export.h" 11 #include "base/containers/span.h" 12 #include "base/optional.h" 13 #include "base/strings/string16.h" 14 #include "ui/events/keycodes/keyboard_codes.h" 15 16 namespace gfx { 17 struct VectorIcon; 18 } // namespace gfx 19 20 namespace keyboard_shortcut_viewer { 21 22 struct KeyboardShortcutItem; 23 enum class ShortcutCategory; 24 25 // Returns a list of Ash and Chrome keyboard shortcuts metadata. 26 KSV_EXPORT const std::vector<KeyboardShortcutItem>& 27 GetKeyboardShortcutItemList(); 28 29 base::string16 GetStringForCategory(ShortcutCategory category); 30 31 // Returns the string of a DomKey for a given VKEY. VKEY needs to be mapped to 32 // a physical key |dom_code| and then the |dom_code| needs to be mapped to a 33 // meaning or character of |dom_key| based on the corresponding keyboard layout. 34 // Returns empty string if the |dom_key| IsDeadKey or has no mapped meaning or 35 // character. 36 base::string16 GetStringForKeyboardCode(ui::KeyboardCode key_code); 37 38 // Certain punctuation is not verbalized by ChromeVox, i.e. ".". So, whenever 39 // one of these is used in a keyboard shortcut, need to set the accessible name 40 // to explicitly specified text, such as "period". 41 // Returns empty string if there is no special accessible name for the 42 // |key_code|. 43 base::string16 GetAccessibleNameForKeyboardCode(ui::KeyboardCode key_code); 44 45 // Returns the VectorIcon if |key_code| need to be represented as an icon. 46 // Returns nullptr if |key_code| should not be represented as an icon. 47 const gfx::VectorIcon* GetVectorIconForKeyboardCode(ui::KeyboardCode key_code); 48 49 } // namespace keyboard_shortcut_viewer 50 51 #endif // ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_ 52