keyboard_util.h 849 B

1234567891011121314151617181920212223242526272829
  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 "base/strings/string16.h"
  9. #include "ui/events/keycodes/keyboard_codes.h"
  10. namespace electron {
  11. // Return key code of the char, and also determine whether the SHIFT key is
  12. // pressed.
  13. ui::KeyboardCode KeyboardCodeFromCharCode(base::char16 c, bool* shifted);
  14. // Return key code of the |str|, if the original key is a shifted character,
  15. // for example + and /, set it in |shifted_char|.
  16. // pressed.
  17. ui::KeyboardCode KeyboardCodeFromStr(
  18. const std::string& str,
  19. base::Optional<base::char16>* shifted_char);
  20. } // namespace electron
  21. #endif // SHELL_COMMON_KEYBOARD_UTIL_H_