Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
ax_tree_manager_map.h
Go to the documentation of this file.
1// Copyright 2019 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 UI_ACCESSIBILITY_AX_TREE_MANAGER_MAP_H_
6#define UI_ACCESSIBILITY_AX_TREE_MANAGER_MAP_H_
7
8#include <unordered_map>
9
10#include "ax_tree_id.h"
11#include "ax_tree_manager.h"
12#include "base/no_destructor.h"
13
14namespace ui {
15
16// This class manages AXTreeManager instances. It is a singleton wrapper
17// around a std::unordered_map. AXTreeID's are used as the key for the map.
18// Since AXTreeID's might refer to AXTreeIDUnknown, callers should not expect
19// AXTreeIDUnknown to map to a particular AXTreeManager.
21 public:
24
25 static AXTreeManagerMap& GetInstance();
26 void AddTreeManager(AXTreeID tree_id, AXTreeManager* manager);
27 void RemoveTreeManager(AXTreeID tree_id);
28 AXTreeManager* GetManager(AXTreeID tree_id);
29
30 // If the child of the provided parent node exists in a separate child tree,
31 // return the tree manager for that child tree. Otherwise, return nullptr.
32 AXTreeManager* GetManagerForChildTree(const AXNode& parent_node);
33
34 private:
35 std::unordered_map<AXTreeID, AXTreeManager*, AXTreeIDHash> map_;
36};
37
38} // namespace ui
39
40#endif // UI_ACCESSIBILITY_AX_TREE_MANAGER_MAP_H_
#define AX_EXPORT
Definition ax_export.h:29