keyboard_util.h 834 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2015 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_COMMON_KEYBOARD_UTIL_H_
  5. #define SHELL_COMMON_KEYBOARD_UTIL_H_
  6. #include <string>
  7. #include "base/optional.h"
  8. #include "ui/events/keycodes/keyboard_codes.h"
  9. namespace electron {
  10. // Return key code of the char, and also determine whether the SHIFT key is
  11. // pressed.
  12. ui::KeyboardCode KeyboardCodeFromCharCode(char16_t c, bool* shifted);
  13. // Return key code of the |str|, if the original key is a shifted character,
  14. // for example + and /, set it in |shifted_char|.
  15. // pressed.
  16. ui::KeyboardCode KeyboardCodeFromStr(const std::string& str,
  17. base::Optional<char16_t>* shifted_char);
  18. } // namespace electron
  19. #endif // SHELL_COMMON_KEYBOARD_UTIL_H_