accelerator_info.mojom 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. // Copyright 2022 The Chromium Authors.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module ash.mojom;
  5. import "ui/base/accelerators/mojom/accelerator.mojom";
  6. // AcceleratorInfo is a representation of an Accelerator with more information
  7. // regarding the accelerator. This is used only by Ash clients, hence why this
  8. // is not in ui/*.
  9. // Contains all sources of shortcuts, new sources must added to this enum.
  10. enum AcceleratorSource {
  11. // Accelerators that are owned by ash and handled in
  12. // accelerator_controller_impl.cc.
  13. kAsh,
  14. // Event rewriters that are owned by ash and handled in
  15. // event_rewriter_chromeos.cc.
  16. kEventRewriter,
  17. // Accelerators that are owned by the browser and sources from
  18. // accelerator_table.cc.
  19. kBrowser,
  20. // Ambient accelerators such as Ctrl-C are not owned by any specific source.
  21. kAmbient,
  22. // Arc++ specific accelerators owned by Android apps.
  23. kAndroid,
  24. };
  25. // Enum of all possible types of accelerators.
  26. // Must be kept in sync with ash/public/cpp/accelerator_configuration.h.
  27. enum AcceleratorType {
  28. // System default accelerator.
  29. kDefault,
  30. // User defined accelerator, this is a custom accelerator.
  31. kUser,
  32. // Deprecated accelerator.
  33. kDeprecated,
  34. // Developer-specific accelerators.
  35. kDeveloper,
  36. // Accelerator used for debugging.
  37. kDebug,
  38. };
  39. // Represents the states of an accelerator.
  40. // Must be kept in sync with ash/public/cpp/accelerator_configuration.h.
  41. enum AcceleratorState {
  42. // Accelerator is available to be used.
  43. kEnabled,
  44. // Accelerator disabled due to a conflict with another accelerator.
  45. kDisabledByConflict,
  46. // Accelerator disabled due to user manually disabling it.
  47. kDisabledByUser,
  48. };
  49. // Represents an accelerator in its entirety. Includes the keys, state, type,
  50. // and whether the accelerator is locked.
  51. struct AcceleratorInfo {
  52. // Underlying accelerator struct, contains keycode and modifier.
  53. ui.mojom.Accelerator accelerator;
  54. AcceleratorType type;
  55. AcceleratorState state;
  56. // True if the accelerator can not be customized by the user.
  57. // False if the accelerator can be customized by the user.
  58. bool locked;
  59. };