| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
| 6 #define UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ | 6 #define UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // | 27 // |
| 28 // The first form allows underlying instances to change but refer to the same | 28 // The first form allows underlying instances to change but refer to the same |
| 29 // frame. | 29 // frame. |
| 30 // The second form allows this registry to track the object for later retrieval. | 30 // The second form allows this registry to track the object for later retrieval. |
| 31 class AX_EXPORT AXTreeIDRegistry { | 31 class AX_EXPORT AXTreeIDRegistry { |
| 32 public: | 32 public: |
| 33 using FrameID = std::pair<int, int>; | 33 using FrameID = std::pair<int, int>; |
| 34 | 34 |
| 35 using AXTreeID = int; | 35 using AXTreeID = int; |
| 36 | 36 |
| 37 static const AXTreeID kNoAXTreeID; | 37 static constexpr AXTreeID kNoAXTreeID = -1; |
| 38 | 38 |
| 39 // Get the single instance of this class. | 39 // Get the single instance of this class. |
| 40 static AXTreeIDRegistry* GetInstance(); | 40 static AXTreeIDRegistry* GetInstance(); |
| 41 | 41 |
| 42 // Methods for FrameID ax tree id generation, and retrieval. | 42 // Methods for FrameID ax tree id generation, and retrieval. |
| 43 AXTreeID GetOrCreateAXTreeID(int process_id, int routing_id); | 43 AXTreeID GetOrCreateAXTreeID(int process_id, int routing_id); |
| 44 FrameID GetFrameID(AXTreeID ax_tree_id); | 44 FrameID GetFrameID(AXTreeID ax_tree_id); |
| 45 | 45 |
| 46 // Retrieve an |AXHostDelegate|. | 46 // Retrieve an |AXHostDelegate|. |
| 47 AXHostDelegate* GetHostDelegate(AXTreeID ax_tree_id); | 47 AXHostDelegate* GetHostDelegate(AXTreeID ax_tree_id); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 // Maps an id to its host delegate. | 71 // Maps an id to its host delegate. |
| 72 std::map<AXTreeID, AXHostDelegate*> id_to_host_delegate_; | 72 std::map<AXTreeID, AXHostDelegate*> id_to_host_delegate_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); | 74 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace ui | 77 } // namespace ui |
| 78 | 78 |
| 79 #endif // UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ | 79 #endif // UI_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ |
| OLD | NEW |