| // Copyright 2020 The Fuchsia Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "view_wrapper.h" |
| |
| #include <fuchsia/accessibility/semantics/cpp/fidl.h> |
| #include <lib/async/default.h> |
| #include <lib/syslog/cpp/macros.h> |
| |
| #include <stack> |
| |
| #include "src/ui/a11y/lib/semantics/util/semantic_transform.h" |
| |
| namespace a11y { |
| |
| ViewWrapper::ViewWrapper(fuchsia::ui::views::ViewRef view_ref, |
| std::unique_ptr<ViewSemantics> view_semantics) |
| : view_ref_(std::move(view_ref)), |
| view_semantics_(std::move(view_semantics)), |
| weak_factory_(this) {} |
| |
| ViewWrapper::~ViewWrapper() { weak_factory_.InvalidateWeakPtrs(); } |
| |
| fuchsia::ui::views::ViewRef ViewWrapper::ViewRefClone() const { return Clone(view_ref_); } |
| |
| std::shared_ptr<input::Injector> ViewWrapper::take_view_injector() { |
| auto tmp = view_injector_; |
| view_injector_.reset(); |
| return tmp; |
| } |
| |
| } // namespace a11y |