| 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" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 AXPlatformNode::~AXPlatformNode() { | 28 AXPlatformNode::~AXPlatformNode() { |
| 29 if (unique_id_) | 29 if (unique_id_) |
| 30 g_unique_id_map.Get().erase(unique_id_); | 30 g_unique_id_map.Get().erase(unique_id_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void AXPlatformNode::Destroy() { | 33 void AXPlatformNode::Destroy() { |
| 34 g_unique_id_map.Get().erase(unique_id_); | 34 g_unique_id_map.Get().erase(unique_id_); |
| 35 unique_id_ = 0; | 35 unique_id_ = 0; |
| 36 } | 36 } |
| 37 | 37 |
| 38 // static |
| 38 AXPlatformNode* AXPlatformNode::GetFromUniqueId(int32_t unique_id) { | 39 AXPlatformNode* AXPlatformNode::GetFromUniqueId(int32_t unique_id) { |
| 39 UniqueIdMap* unique_ids = g_unique_id_map.Pointer(); | 40 UniqueIdMap* unique_ids = g_unique_id_map.Pointer(); |
| 40 auto iter = unique_ids->find(unique_id); | 41 auto iter = unique_ids->find(unique_id); |
| 41 if (iter != unique_ids->end()) | 42 if (iter != unique_ids->end()) |
| 42 return iter->second; | 43 return iter->second; |
| 43 | 44 |
| 44 return nullptr; | 45 return nullptr; |
| 45 } | 46 } |
| 46 | 47 |
| 48 int32_t AXPlatformNode::unique_id() const { |
| 49 return unique_id_; |
| 50 } |
| 51 |
| 47 } // namespace ui | 52 } // namespace ui |
| OLD | NEW |