1. Token CRCs are not handled correctly. This adds the corrected Whispernet binary...
[chromium-blink-merge.git] / chrome / browser / accessibility / ax_tree_id_registry.h
blobbdcf72c3e29732357c569f55bef2ecdd8ce096de
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.
5 #ifndef CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_
6 #define CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_
8 #include <map>
10 #include "base/stl_util.h"
12 template <typename T>
13 struct DefaultSingletonTraits;
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;
23 // Get the single instance of this class.
24 static AXTreeIDRegistry* GetInstance();
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);
32 private:
33 friend struct DefaultSingletonTraits<AXTreeIDRegistry>;
35 AXTreeIDRegistry();
36 virtual ~AXTreeIDRegistry();
38 // Tracks the current unique ax frame id.
39 int ax_tree_id_counter_;
41 // Maps an accessibility tree to its frame via ids.
42 std::map<AXTreeID, FrameID> ax_tree_to_frame_id_map_;
44 // Maps frames to an accessibility tree via ids.
45 std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_;
47 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry);
50 #endif // CHROME_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_