| 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: |
| 29 AXTreeSourceArc(); |
| 30 ~AXTreeSourceArc() override; |
| 31 |
| 32 // Notify automation of an accessibility event. |
| 33 void NotifyAccessibilityEvent(mojom::AccessibilityEventData* event_data); |
| 34 |
| 35 int32_t tree_id() const { return tree_id_; } |
| 36 |
| 37 private: |
| 38 // AXTreeSource overrides. |
| 39 bool GetTreeData(ui::AXTreeData* data) const override; |
| 40 mojom::AccessibilityNodeInfoData* GetRoot() const override; |
| 41 mojom::AccessibilityNodeInfoData* GetFromId(int32_t id) const override; |
| 42 int32_t GetId(mojom::AccessibilityNodeInfoData* node) const override; |
| 43 void GetChildren(mojom::AccessibilityNodeInfoData* node, |
| 44 std::vector<mojom::AccessibilityNodeInfoData*>* out_children) |
| 45 const override; |
| 46 mojom::AccessibilityNodeInfoData* GetParent( |
| 47 mojom::AccessibilityNodeInfoData* node) const override; |
| 48 bool IsValid(mojom::AccessibilityNodeInfoData* node) const override; |
| 49 bool IsEqual(mojom::AccessibilityNodeInfoData* node1, |
| 50 mojom::AccessibilityNodeInfoData* node2) const override; |
| 51 mojom::AccessibilityNodeInfoData* GetNull() const override; |
| 52 void SerializeNode(mojom::AccessibilityNodeInfoData* node, |
| 53 ui::AXNodeData* out_data) const override; |
| 54 |
| 55 // Resets tree state. |
| 56 void Reset(); |
| 57 |
| 58 // The id of this tree. |
| 59 int32_t tree_id_; |
| 60 |
| 61 // Maps an AccessibilityNodeInfo to its tree data. |
| 62 std::map<int32_t, mojom::AccessibilityNodeInfoData*> tree_map_; |
| 63 std::map<int32_t, int32_t> parent_map_; |
| 64 std::unique_ptr<AXTreeArcSerializer> current_tree_serializer_; |
| 65 int32_t root_id_; |
| 66 int32_t focused_node_id_; |
| 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(AXTreeSourceArc); |
| 69 }; |
| 70 |
| 71 } // namespace arc |
| 72 |
| 73 #endif // CHROME_BROWSER_CHROMEOS_ARC_ACCESSIBILITY_AX_TREE_SOURCE_ARC_H_ |
| OLD | NEW |