ax_tree_id_mojom_traits.cc 781 B

12345678910111213141516171819202122232425262728
  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 "ui/accessibility/mojom/ax_tree_id_mojom_traits.h"
  5. namespace mojo {
  6. // static
  7. bool UnionTraits<ax::mojom::AXTreeIDDataView, ui::AXTreeID>::Read(
  8. ax::mojom::AXTreeIDDataView data,
  9. ui::AXTreeID* out) {
  10. switch (data.tag()) {
  11. case ax::mojom::AXTreeIDDataView::Tag::kUnknown:
  12. out->type_ = ax::mojom::AXTreeIDType::kUnknown;
  13. return true;
  14. case ax::mojom::AXTreeIDDataView::Tag::kToken:
  15. out->type_ = ax::mojom::AXTreeIDType::kToken;
  16. if (!data.ReadToken(&out->token_))
  17. return false;
  18. return true;
  19. }
  20. NOTREACHED();
  21. return false;
  22. }
  23. } // namespace mojo