Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_AX_TREE_SOURCE_ARC_H_ | |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_AX_TREE_SOURCE_ARC_H_ | |
| 7 | |
| 8 #include "components/arc/common/accessibility_helper.mojom.h" | |
| 9 #include "ui/accessibility/ax_node.h" | |
| 10 #include "ui/accessibility/ax_node_data.h" | |
| 11 #include "ui/accessibility/ax_tree_data.h" | |
| 12 #include "ui/accessibility/ax_tree_serializer.h" | |
| 13 #include "ui/accessibility/ax_tree_source.h" | |
| 14 #include "ui/views/view.h" | |
| 15 | |
| 16 namespace arc { | |
| 17 | |
| 18 using AXTreeArcSerializer = | |
| 19 ui::AXTreeSerializer<mojom::AccessibilityNodeInfoData*, | |
| 20 ui::AXNodeData, | |
| 21 ui::AXTreeData>; | |
| 22 | |
| 23 // This class represents the accessibility tree from the focused ARC window. | |
| 24 class AXTreeSourceArc | |
| 25 : public ui::AXTreeSource<mojom::AccessibilityNodeInfoData*, | |
| 26 ui::AXNodeData, | |
| 27 ui::AXTreeData>, | |
| 28 public views::View { | |
|
dmazzoni
2017/02/09 01:18:09
Seems like a bit of a hack to make this a View and
David Tseng
2017/02/09 03:10:09
No, its clear because I did that in the first patc
| |
| 29 public: | |
| 30 AXTreeSourceArc(); | |
| 31 ~AXTreeSourceArc() override; | |
| 32 | |
| 33 // Notify automation of an accessibility event. | |
| 34 void NotifyAccessibilityEvent(mojom::AccessibilityEventData* event_data); | |
| 35 | |
| 36 private: | |
| 37 // AXTreeSource overrides. | |
| 38 bool GetTreeData(ui::AXTreeData* data) const override; | |
| 39 mojom::AccessibilityNodeInfoData* GetRoot() const override; | |
| 40 mojom::AccessibilityNodeInfoData* GetFromId(int32_t id) const override; | |
| 41 int32_t GetId(mojom::AccessibilityNodeInfoData* node) const override; | |
| 42 void GetChildren(mojom::AccessibilityNodeInfoData* node, | |
| 43 std::vector<mojom::AccessibilityNodeInfoData*>* out_children) | |
| 44 const override; | |
| 45 mojom::AccessibilityNodeInfoData* GetParent( | |
| 46 mojom::AccessibilityNodeInfoData* node) const override; | |
| 47 bool IsValid(mojom::AccessibilityNodeInfoData* node) const override; | |
| 48 bool IsEqual(mojom::AccessibilityNodeInfoData* node1, | |
| 49 mojom::AccessibilityNodeInfoData* node2) const override; | |
| 50 mojom::AccessibilityNodeInfoData* GetNull() const override; | |
| 51 void SerializeNode(mojom::AccessibilityNodeInfoData* node, | |
| 52 ui::AXNodeData* out_data) const override; | |
| 53 | |
| 54 // views::View overrides. | |
| 55 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; | |
| 56 | |
| 57 // Resets tree state. | |
| 58 void Reset(); | |
| 59 | |
| 60 // The id of this tree. | |
| 61 int32_t id_; | |
|
dmazzoni
2017/02/09 01:18:09
tree_id_?
| |
| 62 | |
| 63 // Maps an AccessibilityNodeInfo to its tree data. | |
| 64 std::map<int32_t, mojom::AccessibilityNodeInfoData*> tree_map_; | |
| 65 std::map<int32_t, int32_t> parent_map_; | |
| 66 std::unique_ptr<AXTreeArcSerializer> current_tree_serializer_; | |
| 67 int32_t root_id_; | |
| 68 int32_t focused_node_id_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(AXTreeSourceArc); | |
| 71 }; | |
| 72 | |
| 73 } // namespace arc | |
| 74 | |
| 75 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_AX_TREE_SOURCE_ARC_H_ | |
| OLD | NEW |