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 #include "ui/accessibility/platform/ax_platform_node.h" | 5 #include "ui/accessibility/platform/ax_platform_node.h" |
6 | 6 |
7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
11 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 11 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 using UniqueIdMap = base::hash_map<int32_t, AXPlatformNode*>; | 17 using UniqueIdMap = base::hash_map<int32_t, AXPlatformNode*>; |
18 // Map from each AXPlatformNode's unique id to its instance. | 18 // Map from each AXPlatformNode's unique id to its instance. |
19 base::LazyInstance<UniqueIdMap> g_unique_id_map = | 19 base::LazyInstance<UniqueIdMap>::DestructorAtExit g_unique_id_map = |
20 LAZY_INSTANCE_INITIALIZER; | 20 LAZY_INSTANCE_INITIALIZER; |
21 | |
22 } | 21 } |
23 | 22 |
24 #if !defined(PLATFORM_HAS_AX_PLATFORM_NODE_IMPL) | 23 #if !defined(PLATFORM_HAS_AX_PLATFORM_NODE_IMPL) |
25 // static | 24 // static |
26 AXPlatformNode* AXPlatformNode::Create(AXPlatformNodeDelegate* delegate) { | 25 AXPlatformNode* AXPlatformNode::Create(AXPlatformNodeDelegate* delegate) { |
27 return nullptr; | 26 return nullptr; |
28 } | 27 } |
29 #endif // !defined(PLATFORM_HAS_AX_PLATFORM_NODE_IMPL) | 28 #endif // !defined(PLATFORM_HAS_AX_PLATFORM_NODE_IMPL) |
30 | 29 |
31 #if !defined(OS_WIN) | 30 #if !defined(OS_WIN) |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 AXPlatformNode* AXPlatformNode::GetFromUniqueId(int32_t unique_id) { | 67 AXPlatformNode* AXPlatformNode::GetFromUniqueId(int32_t unique_id) { |
69 UniqueIdMap* unique_ids = g_unique_id_map.Pointer(); | 68 UniqueIdMap* unique_ids = g_unique_id_map.Pointer(); |
70 auto iter = unique_ids->find(unique_id); | 69 auto iter = unique_ids->find(unique_id); |
71 if (iter != unique_ids->end()) | 70 if (iter != unique_ids->end()) |
72 return iter->second; | 71 return iter->second; |
73 | 72 |
74 return nullptr; | 73 return nullptr; |
75 } | 74 } |
76 | 75 |
77 } // namespace ui | 76 } // namespace ui |
OLD | NEW |