Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: content/browser/accessibility/ax_tree_id_registry.h

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ 6 #define CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 11 namespace base {
12 template <typename T> 12 template <typename T>
13 struct DefaultSingletonTraits; 13 struct DefaultSingletonTraits;
14 } // namespace base
14 15
15 namespace content { 16 namespace content {
16 17
17 // A class which generates a unique id given a process id and frame routing id. 18 // A class which generates a unique id given a process id and frame routing id.
18 class AXTreeIDRegistry { 19 class AXTreeIDRegistry {
19 public: 20 public:
20 typedef std::pair<int, int> FrameID; 21 typedef std::pair<int, int> FrameID;
21 22
22 typedef int AXTreeID; 23 typedef int AXTreeID;
23 24
24 static const AXTreeID kNoAXTreeID; 25 static const AXTreeID kNoAXTreeID;
25 26
26 // Get the single instance of this class. 27 // Get the single instance of this class.
27 static AXTreeIDRegistry* GetInstance(); 28 static AXTreeIDRegistry* GetInstance();
28 29
29 // Obtains a unique id given a |process_id| and |routing_id|. Placeholder 30 // Obtains a unique id given a |process_id| and |routing_id|. Placeholder
30 // for full implementation once out of process iframe accessibility finalizes. 31 // for full implementation once out of process iframe accessibility finalizes.
31 AXTreeID GetOrCreateAXTreeID(int process_id, int routing_id); 32 AXTreeID GetOrCreateAXTreeID(int process_id, int routing_id);
32 FrameID GetFrameID(AXTreeID ax_tree_id); 33 FrameID GetFrameID(AXTreeID ax_tree_id);
33 void RemoveAXTreeID(AXTreeID ax_tree_id); 34 void RemoveAXTreeID(AXTreeID ax_tree_id);
34 35
35 private: 36 private:
36 friend struct DefaultSingletonTraits<AXTreeIDRegistry>; 37 friend struct base::DefaultSingletonTraits<AXTreeIDRegistry>;
37 38
38 AXTreeIDRegistry(); 39 AXTreeIDRegistry();
39 virtual ~AXTreeIDRegistry(); 40 virtual ~AXTreeIDRegistry();
40 41
41 // Tracks the current unique ax frame id. 42 // Tracks the current unique ax frame id.
42 AXTreeID ax_tree_id_counter_; 43 AXTreeID ax_tree_id_counter_;
43 44
44 // Maps an accessibility tree to its frame via ids. 45 // Maps an accessibility tree to its frame via ids.
45 std::map<AXTreeID, FrameID> ax_tree_to_frame_id_map_; 46 std::map<AXTreeID, FrameID> ax_tree_to_frame_id_map_;
46 47
47 // Maps frames to an accessibility tree via ids. 48 // Maps frames to an accessibility tree via ids.
48 std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_; 49 std::map<FrameID, AXTreeID> frame_to_ax_tree_id_map_;
49 50
50 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry); 51 DISALLOW_COPY_AND_ASSIGN(AXTreeIDRegistry);
51 }; 52 };
52 53
53 } // namespace content 54 } // namespace content
54 55
55 #endif // CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_ 56 #endif // CONTENT_BROWSER_ACCESSIBILITY_AX_TREE_ID_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698