Chromium Code Reviews| Index: ui/accessibility/ax_tree_id_registry.h |
| diff --git a/ui/accessibility/ax_tree_id_registry.h b/ui/accessibility/ax_tree_id_registry.h |
| index 7c16405e6836825f1bc9767b950a64fc30e88658..c6994485b862d9320c151ab9b76d6af3d2de98b9 100644 |
| --- a/ui/accessibility/ax_tree_id_registry.h |
| +++ b/ui/accessibility/ax_tree_id_registry.h |
| @@ -18,7 +18,16 @@ struct DefaultSingletonTraits; |
| namespace ui { |
| -// A class which generates a unique id. |
| +class AXHostDelegate; |
| + |
| +// This class generates and saves a runtime id for an accessibility tree. |
| +// It provides a few distinct forms of generating an id: |
| +// - from a frame id (which consists of a process and routing id) |
| +// - from a backing object |
|
dmazzoni
2017/02/20 04:50:46
from a backing AXHostDelegate object
David Tseng
2017/02/21 19:09:05
Done.
|
| +// |
| +// The first form allows underlying instances to change but refer to the same |
| +// frame. |
| +// The second form allows this registry to track the object for later retrieval. |
| class AX_EXPORT AXTreeIDRegistry { |
| public: |
| using FrameID = std::pair<int, int>; |
| @@ -30,14 +39,16 @@ class AX_EXPORT AXTreeIDRegistry { |
| // Get the single instance of this class. |
| static AXTreeIDRegistry* GetInstance(); |
| - // Obtains a unique id given a |process_id| and |routing_id|. Placeholder |
| - // for full implementation once out of process iframe accessibility finalizes. |
| + // Methods for FrameID ax tree id generation, and retrieval. |
| AXTreeID GetOrCreateAXTreeID(int process_id, int routing_id); |
| FrameID GetFrameID(AXTreeID ax_tree_id); |
| - void RemoveAXTreeID(AXTreeID ax_tree_id); |
| - // Create an id not associated with any process. |
| - int CreateID(); |
| + // Methods for AXHostDelegate ax tree id generation, and retrieval. |
| + AXTreeID GetOrCreateAXTreeID(AXHostDelegate* delegate); |
| + AXHostDelegate* GetHostDelegate(AXTreeID ax_tree_id); |
| + void SetDesktopHostDelegate(AXHostDelegate* delegate); |
| + |
| + void RemoveAXTreeID(AXTreeID ax_tree_id); |
| private: |
| friend struct base::DefaultSingletonTraits<AXTreeIDRegistry>; |
| @@ -54,6 +65,9 @@ class AX_EXPORT AXTreeIDRegistry { |
| // Maps frames to an accessibility tree via ids. |
| std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_; |
| + // Maps an id to its host delegate. |
| + std::map<AXTreeID, AXHostDelegate*> id_to_host_delegate_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); |
| }; |