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 CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
| 7 |
| 8 #include <map> |
| 9 |
| 10 #include "base/stl_util.h" |
| 11 |
| 12 template <typename T> |
| 13 struct DefaultSingletonTraits; |
| 14 |
| 15 // A class which generates a unique id given a process id and routing id. |
| 16 // Currently, placeholder implementation pending finalization of out of process |
| 17 // iframes. |
| 18 class AXTreeIDRegistry { |
| 19 public: |
| 20 typedef int AXTreeID; |
| 21 typedef std::pair<int, int> FrameID; |
| 22 |
| 23 // Get the single instance of this class. |
| 24 static AXTreeIDRegistry* GetInstance(); |
| 25 |
| 26 // Obtains a unique id given a |process_id| and |routing_id|. Placeholder |
| 27 // for full implementation once out of process iframe accessibility finalizes. |
| 28 int GetOrCreateAXTreeID(int process_id, int routing_id); |
| 29 FrameID GetFrameID(int ax_tree_id); |
| 30 void RemoveAXTreeID(int ax_tree_id); |
| 31 |
| 32 private: |
| 33 friend struct DefaultSingletonTraits<AXTreeIDRegistry>; |
| 34 |
| 35 AXTreeIDRegistry(); |
| 36 virtual ~AXTreeIDRegistry(); |
| 37 |
| 38 // Tracks the current unique ax frame id. |
| 39 int ax_tree_id_counter_; |
| 40 |
| 41 // Maps an accessibility tree to its frame via ids. |
| 42 std::map<AXTreeID, FrameID> ax_tree_to_frame_id_map_; |
| 43 |
| 44 // Maps frames to an accessibility tree via ids. |
| 45 std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); |
| 48 }; |
| 49 |
| 50 #endif // CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
OLD | NEW |