keyboard_shortcut_item.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #include "ash/public/cpp/keyboard_shortcut_item.h"
  5. #include <tuple>
  6. #include "base/check.h"
  7. namespace ash {
  8. bool AcceleratorId::operator<(const AcceleratorId& other) const {
  9. return std::tie(keycode, modifiers) <
  10. std::tie(other.keycode, other.modifiers);
  11. }
  12. KeyboardShortcutItem::KeyboardShortcutItem(
  13. const std::vector<ShortcutCategory>& categories,
  14. int description_message_id,
  15. absl::optional<int> shortcut_message_id,
  16. const std::vector<AcceleratorId>& accelerator_ids,
  17. const std::vector<ui::KeyboardCode>& shortcut_key_codes)
  18. : categories(categories),
  19. description_message_id(description_message_id),
  20. shortcut_message_id(shortcut_message_id),
  21. accelerator_ids(accelerator_ids),
  22. shortcut_key_codes(shortcut_key_codes) {
  23. DCHECK(!categories.empty());
  24. }
  25. KeyboardShortcutItem::KeyboardShortcutItem(const KeyboardShortcutItem& other) =
  26. default;
  27. KeyboardShortcutItem::~KeyboardShortcutItem() = default;
  28. } // namespace ash