summaryrefslogtreecommitdiffstats
path: root/mojo/services/html_viewer/ax_provider_impl.h
blob: fba6be402caaae13639f0843a755f2009b369e78 (plain)
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
32
33
34
35
36
37
38
39
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_SERVICES_HTML_VIEWER_AX_PROVIDER_IMPL_H_
#define MOJO_SERVICES_HTML_VIEWER_AX_PROVIDER_IMPL_H_

#include "mojo/services/accessibility/public/interfaces/accessibility.mojom.h"
#include "third_party/mojo/src/mojo/public/cpp/bindings/interface_impl.h"

namespace blink {
class WebAXObject;
class WebView;
}  // namespace blink

namespace html_viewer {

// Caller must ensure that |web_view| outlives AxProviderImpl.
class AxProviderImpl : public mojo::InterfaceImpl<mojo::AxProvider> {
 public:
  explicit AxProviderImpl(blink::WebView* web_view);
  void GetTree(const mojo::Callback<void(mojo::Array<mojo::AxNodePtr> nodes)>&
                   callback) override;

 private:
  int Populate(const blink::WebAXObject& ax_object,
               int parent_id,
               int next_sibling_id,
               mojo::Array<mojo::AxNodePtr>* result);
  mojo::AxNodePtr ConvertAxNode(const blink::WebAXObject& ax_object,
                                int parent_id,
                                int next_sibling_id);

  blink::WebView* web_view_;
};

}  // namespace html_viewer

#endif  // MOJO_SERVICES_HTML_VIEWER_AX_PROVIDER_IMPL_H_