summaryrefslogtreecommitdiff
path: root/chromium/content/renderer/accessibility/aom_content_ax_tree.h
blob: 48c1ea8c39d966f92d971de66642fdfae6b4ecd3 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright (c) 2018 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 CONTENT_RENDERER_ACCESSIBILITY_AOM_CONTENT_AX_TREE_H_
#define CONTENT_RENDERER_ACCESSIBILITY_AOM_CONTENT_AX_TREE_H_

#include <stdint.h>

#include "third_party/WebKit/public/platform/WebComputedAXTree.h"

#include "base/macros.h"
#include "content/renderer/render_frame_impl.h"
#include "third_party/WebKit/public/platform/WebString.h"
#include "ui/accessibility/ax_tree.h"

namespace content {

class AomContentAxTree : public blink::WebComputedAXTree {
 public:
  explicit AomContentAxTree(RenderFrameImpl* render_frame);

  // blink::WebComputedAXTree implementation.
  bool ComputeAccessibilityTree() override;

  bool GetBoolAttributeForAXNode(int32_t ax_id,
                                 blink::WebAOMBoolAttribute,
                                 bool* out_param) override;
  bool GetIntAttributeForAXNode(int32_t ax_id,
                                blink::WebAOMIntAttribute,
                                int32_t* out_param) override;
  bool GetStringAttributeForAXNode(int32_t ax_id,
                                   blink::WebAOMStringAttribute,
                                   blink::WebString* out_param) override;
  bool GetFloatAttributeForAXNode(int32_t ax_id,
                                  blink::WebAOMFloatAttribute,
                                  float* out_param) override;
  bool GetRoleForAXNode(int32_t ax_id, blink::WebString* out_param) override;
  bool GetCheckedStateForAXNode(int32_t ax_id,
                                blink::WebString* out_param) override;
  bool GetParentIdForAXNode(int32_t ax_id, int32_t* out_param) override;
  bool GetFirstChildIdForAXNode(int32_t ax_id, int32_t* out_param) override;
  bool GetLastChildIdForAXNode(int32_t ax_id, int32_t* out_param) override;
  bool GetPreviousSiblingIdForAXNode(int32_t ax_id,
                                     int32_t* out_param) override;
  bool GetNextSiblingIdForAXNode(int32_t ax_id, int32_t* out_param) override;

 private:
  bool GetRestrictionAttributeForAXNode(int32_t,
                                        blink::WebAOMBoolAttribute,
                                        bool* out_param);
  bool GetStateAttributeForAXNode(int32_t,
                                  blink::WebAOMBoolAttribute,
                                  bool* out_param);
  ui::AXTree tree_;
  RenderFrameImpl* render_frame_;
  DISALLOW_COPY_AND_ASSIGN(AomContentAxTree);
};

}  // namespace content

#endif  // CONTENT_RENDERER_ACCESSIBILITY_AOM_CONTENT_AX_TREE_H_