OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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_ID_REGISTRY_H_ | |
6 #define UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/stl_util.h" | |
11 #include "ui/accessibility/ax_export.h" | |
12 | |
13 template <typename T> | |
14 struct DefaultSingletonTraits; | |
15 | |
16 namespace ui { | |
17 | |
18 // A class which generates a unique id given a process id and routing id. | |
19 // Currently, placeholder implementation pending finalization of out of process | |
20 // iframes. | |
21 class AX_EXPORT AXTreeIDRegistry { | |
dmazzoni
2014/10/31 22:20:26
This class looks great, but it can't go in ui/acce
David Tseng
2014/11/03 15:45:08
Technically, no deps violations, but yeah, it shou
| |
22 public: | |
23 typedef int AXTreeID; | |
24 typedef std::pair<int, int> FrameID; | |
25 | |
26 // Get the single instance of this class. | |
27 static AXTreeIDRegistry* GetInstance(); | |
28 | |
29 // Obtains a unique id given a |process_id| and |routing_id|. Placeholder | |
30 // for full implementation once out of process iframe accessibility finalizes. | |
31 int GetOrCreateAXTreeID(int process_id, int routing_id); | |
32 FrameID GetFrameID(int ax_tree_id); | |
33 void RemoveAXTreeID(int ax_tree_id);0 | |
34 | |
35 private: | |
36 friend struct DefaultSingletonTraits<AXTreeIDRegistry>; | |
37 | |
38 AXTreeIDRegistry(); | |
39 virtual ~AXTreeIDRegistry(); | |
40 | |
41 // Tracks the current unique ax frame id. | |
42 int ax_tree_id_counter_; | |
43 | |
44 // Maps an accessibility tree to its frame via ids. | |
45 std::map<AXTreeID, FrameID> ax_tree_to_frame_id_map_; | |
46 | |
47 // Maps frames to an accessibility tree via ids. | |
48 std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); | |
51 }; | |
52 | |
53 } // namespace ui | |
54 | |
55 #endif // UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ | |
OLD | NEW |