| 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..d983ecd72bfc954f30ba9c3cd220d92a0c238b28 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 |AXHostDelegate| object
|
| +//
|
| +// 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,17 +39,22 @@ 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();
|
| + // Retrieve an |AXHostDelegate|.
|
| + AXHostDelegate* GetHostDelegate(AXTreeID ax_tree_id);
|
| +
|
| + void RemoveAXTreeID(AXTreeID ax_tree_id);
|
|
|
| private:
|
| friend struct base::DefaultSingletonTraits<AXTreeIDRegistry>;
|
| + friend AXHostDelegate;
|
| +
|
| + // Methods for AXHostDelegate ax tree id generation.
|
| + AXTreeID GetOrCreateAXTreeID(AXHostDelegate* delegate);
|
| + void SetDelegateForID(AXHostDelegate* delegate, AXTreeID id);
|
|
|
| AXTreeIDRegistry();
|
| virtual ~AXTreeIDRegistry();
|
| @@ -54,6 +68,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);
|
| };
|
|
|
|
|