ax_tree_update_mojom_traits.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. #ifndef UI_ACCESSIBILITY_MOJOM_AX_TREE_UPDATE_MOJOM_TRAITS_H_
  5. #define UI_ACCESSIBILITY_MOJOM_AX_TREE_UPDATE_MOJOM_TRAITS_H_
  6. #include "ui/accessibility/ax_event_intent.h"
  7. #include "ui/accessibility/ax_tree_update.h"
  8. #include "ui/accessibility/mojom/ax_event_intent.mojom.h"
  9. #include "ui/accessibility/mojom/ax_event_intent_mojom_traits.h"
  10. #include "ui/accessibility/mojom/ax_node_data_mojom_traits.h"
  11. #include "ui/accessibility/mojom/ax_tree_data_mojom_traits.h"
  12. #include "ui/accessibility/mojom/ax_tree_update.mojom-shared.h"
  13. namespace mojo {
  14. template <>
  15. struct StructTraits<ax::mojom::AXTreeUpdateDataView, ui::AXTreeUpdate> {
  16. static bool has_tree_data(const ui::AXTreeUpdate& p) {
  17. return p.has_tree_data;
  18. }
  19. static const ui::AXTreeData& tree_data(const ui::AXTreeUpdate& p) {
  20. return p.tree_data;
  21. }
  22. static int32_t node_id_to_clear(const ui::AXTreeUpdate& p) {
  23. return p.node_id_to_clear;
  24. }
  25. static int32_t root_id(const ui::AXTreeUpdate& p) { return p.root_id; }
  26. static const std::vector<ui::AXNodeData>& nodes(const ui::AXTreeUpdate& p) {
  27. return p.nodes;
  28. }
  29. static ax::mojom::EventFrom event_from(const ui::AXTreeUpdate& p) {
  30. return p.event_from;
  31. }
  32. static ax::mojom::Action event_from_action(const ui::AXTreeUpdate& p) {
  33. return p.event_from_action;
  34. }
  35. static const std::vector<ui::AXEventIntent>& event_intents(
  36. const ui::AXTreeUpdate& p) {
  37. return p.event_intents;
  38. }
  39. static bool Read(ax::mojom::AXTreeUpdateDataView data, ui::AXTreeUpdate* out);
  40. };
  41. } // namespace mojo
  42. #endif // UI_ACCESSIBILITY_MOJOM_AX_TREE_UPDATE_MOJOM_TRAITS_H_