keyboard_shortcut_viewer_metadata.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_
  5. #define ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_
  6. #include <string>
  7. #include <vector>
  8. #include "ash/shortcut_viewer/ksv_export.h"
  9. #include "ui/events/keycodes/keyboard_codes.h"
  10. namespace gfx {
  11. struct VectorIcon;
  12. } // namespace gfx
  13. namespace ash {
  14. struct KeyboardShortcutItem;
  15. enum class ShortcutCategory;
  16. } // namespace ash
  17. namespace keyboard_shortcut_viewer {
  18. // Returns a list of Ash and Chrome keyboard shortcuts metadata.
  19. KSV_EXPORT const std::vector<ash::KeyboardShortcutItem>&
  20. GetKeyboardShortcutItemList();
  21. std::u16string GetStringForCategory(ash::ShortcutCategory category);
  22. // Returns the string of a DomKey for a given VKEY. VKEY needs to be mapped to
  23. // a physical key |dom_code| and then the |dom_code| needs to be mapped to a
  24. // meaning or character of |dom_key| based on the corresponding keyboard layout.
  25. //
  26. // For shortcuts based on keys that use positional mapping, eg. plus, minus,
  27. // left/right bracket, comma, period, or slash the VKEY is mapped to the
  28. // glyph on the key with the same physical position as the US layout. This
  29. // remapping can be disabled by passing false to |remap_positional_key|. This
  30. // is currently used for the 2 browser shortcuts that use these keys but are
  31. // not remapped (page zoom in/out).
  32. //
  33. // Returns empty string if the |dom_key| has no mapped meaning or character.
  34. std::u16string GetStringForKeyboardCode(ui::KeyboardCode key_code,
  35. bool remap_positional_key = true);
  36. // Certain punctuation is not verbalized by ChromeVox, i.e. ".". So, whenever
  37. // one of these is used in a keyboard shortcut, need to set the accessible name
  38. // to explicitly specified text, such as "period".
  39. // Returns empty string if there is no special accessible name for the
  40. // |key_code|.
  41. std::u16string GetAccessibleNameForKeyboardCode(ui::KeyboardCode key_code);
  42. // Returns the VectorIcon if |key_code| need to be represented as an icon.
  43. // Returns nullptr if |key_code| should not be represented as an icon.
  44. const gfx::VectorIcon* GetVectorIconForKeyboardCode(ui::KeyboardCode key_code);
  45. } // namespace keyboard_shortcut_viewer
  46. #endif // ASH_SHORTCUT_VIEWER_KEYBOARD_SHORTCUT_VIEWER_METADATA_H_