Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: ui/accessibility/ax_tree_id_registry.h

Issue 2700103004: Initial support for accessibility actions on ARC. (Closed)
Patch Set: Use desktop tree id. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/accessibility/ax_host_delegate.cc ('k') | ui/accessibility/ax_tree_id_registry.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « ui/accessibility/ax_host_delegate.cc ('k') | ui/accessibility/ax_tree_id_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698