Remove aura enum from DesktopMediaID to fix desktop mirroring audio (CrOS).
[chromium-blink-merge.git] / content / renderer / accessibility / blink_ax_tree_source.h
blobae93ff4b115ee5e53d858fc79aad0b6bbb8927a8
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 CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_
6 #define CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_
8 #include "third_party/WebKit/public/web/WebAXObject.h"
9 #include "ui/accessibility/ax_node_data.h"
10 #include "ui/accessibility/ax_tree_source.h"
12 namespace content {
14 class RenderFrameImpl;
16 class BlinkAXTreeSource
17 : public ui::AXTreeSource<blink::WebAXObject> {
18 public:
19 BlinkAXTreeSource(RenderFrameImpl* render_frame);
20 ~BlinkAXTreeSource() override;
22 // It may be necessary to call SetRoot if you're using a WebScopedAXContext,
23 // because BlinkAXTreeSource can't get the root of the tree from the
24 // WebDocument if accessibility isn't enabled globally.
25 void SetRoot(blink::WebAXObject root);
27 // Call this to have BlinkAXTreeSource collect a mapping from
28 // node ids to the frame routing id for an out-of-process iframe during
29 // calls to SerializeNode.
30 void CollectChildFrameIdMapping(
31 std::map<int32, int>* node_to_frame_routing_id_map,
32 std::map<int32, int>* node_to_browser_plugin_instance_id_map);
34 // Walks up the ancestor chain to see if this is a descendant of the root.
35 bool IsInTree(blink::WebAXObject node) const;
37 // Set the id of the node with accessibility focus. The node with
38 // accessibility focus will force loading inline text box children,
39 // which aren't always loaded by default on all platforms.
40 int accessibility_focus_id() { return accessibility_focus_id_; }
41 void set_accessiblity_focus_id(int id) { accessibility_focus_id_ = id; }
43 // AXTreeSource implementation.
44 blink::WebAXObject GetRoot() const override;
45 blink::WebAXObject GetFromId(int32 id) const override;
46 int32 GetId(blink::WebAXObject node) const override;
47 void GetChildren(
48 blink::WebAXObject node,
49 std::vector<blink::WebAXObject>* out_children) const override;
50 blink::WebAXObject GetParent(blink::WebAXObject node) const override;
51 void SerializeNode(blink::WebAXObject node,
52 ui::AXNodeData* out_data) const override;
53 bool IsValid(blink::WebAXObject node) const override;
54 bool IsEqual(blink::WebAXObject node1,
55 blink::WebAXObject node2) const override;
56 blink::WebAXObject GetNull() const override;
58 blink::WebDocument GetMainDocument() const;
60 private:
61 RenderFrameImpl* render_frame_;
62 blink::WebAXObject root_;
63 std::map<int32, int>* node_to_frame_routing_id_map_;
64 std::map<int32, int>* node_to_browser_plugin_instance_id_map_;
65 int accessibility_focus_id_;
68 } // namespace content
70 #endif // CONTENT_RENDERER_ACCESSIBILITY_BLINK_AX_TREE_SOURCE_H_