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