1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31

ash / webui / shortcut_customization_ui / mojom / shortcut_customization_mojom_traits.h [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_WEBUI_SHORTCUT_CUSTOMIZATION_UI_MOJOM_SHORTCUT_CUSTOMIZATION_MOJOM_TRAITS_H_
#define ASH_WEBUI_SHORTCUT_CUSTOMIZATION_UI_MOJOM_SHORTCUT_CUSTOMIZATION_MOJOM_TRAITS_H_

#include "ash/webui/shortcut_customization_ui/mojom/shortcut_customization.mojom-forward.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"

namespace mojo {

template <>
struct StructTraits<
    ash::shortcut_customization::mojom::SimpleAcceleratorDataView,
    ui::Accelerator> {
  static ui::KeyboardCode key_code(const ui::Accelerator& accelerator);
  static int modifiers(const ui::Accelerator& accelerator);
  static ui::Accelerator::KeyState key_state(
      const ui::Accelerator& accelerator);

  static bool Read(
      ash::shortcut_customization::mojom::SimpleAcceleratorDataView data,
      ui::Accelerator* out);
};

}  // namespace mojo

#endif  // ASH_WEBUI_SHORTCUT_CUSTOMIZATION_UI_MOJOM_SHORTCUT_CUSTOMIZATION_MOJOM_TRAITS_H_