Forward accessibility events to the automation extension process.
[chromium-blink-merge.git] / components / html_viewer / ax_provider_impl.h
blob45582f2f1bd37c316c43cb98535d94bc6f15f443
1 // Copyright 2014 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.
5 #ifndef COMPONENTS_HTML_VIEWER_AX_PROVIDER_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_AX_PROVIDER_IMPL_H_
8 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
9 #include "third_party/mojo_services/src/accessibility/public/interfaces/accessibility.mojom.h"
11 namespace blink {
12 class WebAXObject;
13 class WebView;
14 } // namespace blink
16 namespace html_viewer {
18 // Caller must ensure that |web_view| outlives AxProviderImpl.
19 class AxProviderImpl : public mojo::AxProvider {
20 public:
21 AxProviderImpl(blink::WebView* web_view,
22 mojo::InterfaceRequest<mojo::AxProvider> request);
23 ~AxProviderImpl() override;
24 void GetTree(const mojo::Callback<void(mojo::Array<mojo::AxNodePtr> nodes)>&
25 callback) override;
27 private:
28 int Populate(const blink::WebAXObject& ax_object,
29 int parent_id,
30 int next_sibling_id,
31 mojo::Array<mojo::AxNodePtr>* result);
32 mojo::AxNodePtr ConvertAxNode(const blink::WebAXObject& ax_object,
33 int parent_id,
34 int next_sibling_id);
36 blink::WebView* web_view_;
37 mojo::Binding<mojo::AxProvider> binding_;
40 } // namespace html_viewer
42 #endif // COMPONENTS_HTML_VIEWER_AX_PROVIDER_IMPL_H_