OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility.h" | 5 #include "content/browser/accessibility/browser_accessibility.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 } | 30 } |
31 | 31 |
32 #if !defined(PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL) | 32 #if !defined(PLATFORM_HAS_NATIVE_ACCESSIBILITY_IMPL) |
33 // static | 33 // static |
34 BrowserAccessibility* BrowserAccessibility::Create() { | 34 BrowserAccessibility* BrowserAccessibility::Create() { |
35 return new BrowserAccessibility(); | 35 return new BrowserAccessibility(); |
36 } | 36 } |
37 #endif | 37 #endif |
38 | 38 |
39 BrowserAccessibility::BrowserAccessibility() | 39 BrowserAccessibility::BrowserAccessibility() |
40 : manager_(NULL), | 40 : manager_(nullptr), |
41 node_(NULL), | 41 node_(nullptr), |
42 unique_id_(ui::GetNextAXPlatformNodeUniqueId()) { | 42 unique_id_(ui::GetNextAXPlatformNodeUniqueId()), |
| 43 platform_node_(nullptr) { |
43 g_unique_id_map.Get()[unique_id_] = this; | 44 g_unique_id_map.Get()[unique_id_] = this; |
44 } | 45 } |
45 | 46 |
46 BrowserAccessibility::~BrowserAccessibility() { | 47 BrowserAccessibility::~BrowserAccessibility() { |
47 if (unique_id_) | 48 if (unique_id_) |
48 g_unique_id_map.Get().erase(unique_id_); | 49 g_unique_id_map.Get().erase(unique_id_); |
| 50 if (platform_node_) |
| 51 platform_node_->Destroy(); |
49 } | 52 } |
50 | 53 |
51 // static | 54 // static |
52 BrowserAccessibility* BrowserAccessibility::GetFromUniqueID(int32_t unique_id) { | 55 BrowserAccessibility* BrowserAccessibility::GetFromUniqueID(int32_t unique_id) { |
53 auto iter = g_unique_id_map.Get().find(unique_id); | 56 auto iter = g_unique_id_map.Get().find(unique_id); |
54 if (iter == g_unique_id_map.Get().end()) | 57 if (iter == g_unique_id_map.Get().end()) |
55 return nullptr; | 58 return nullptr; |
56 | 59 |
57 return iter->second; | 60 return iter->second; |
58 } | 61 } |
59 | 62 |
60 void BrowserAccessibility::Init(BrowserAccessibilityManager* manager, | 63 void BrowserAccessibility::Init(BrowserAccessibilityManager* manager, |
61 ui::AXNode* node) { | 64 ui::AXNode* node) { |
62 manager_ = manager; | 65 manager_ = manager; |
63 node_ = node; | 66 node_ = node; |
| 67 |
| 68 // Here we create the AXPlatformNode which contains a platform-specific |
| 69 // implementation of requried accessibility APIS for this node. At this point, |
| 70 // we only are creating this object for Windows. See http://crbug.com/703369 |
| 71 #if defined(OS_WIN) |
| 72 platform_node_ = ui::AXPlatformNode::Create(this); |
| 73 #endif |
64 } | 74 } |
65 | 75 |
66 bool BrowserAccessibility::PlatformIsLeaf() const { | 76 bool BrowserAccessibility::PlatformIsLeaf() const { |
67 if (InternalChildCount() == 0) | 77 if (InternalChildCount() == 0) |
68 return true; | 78 return true; |
69 | 79 |
70 // These types of objects may have children that we use as internal | 80 // These types of objects may have children that we use as internal |
71 // implementation details, but we want to expose them as leaves to platform | 81 // implementation details, but we want to expose them as leaves to platform |
72 // accessibility APIs because screen readers might be confused if they find | 82 // accessibility APIs because screen readers might be confused if they find |
73 // any children. | 83 // any children. |
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1269 const ui::AXActionData& data) { | 1279 const ui::AXActionData& data) { |
1270 NOTREACHED(); | 1280 NOTREACHED(); |
1271 return false; | 1281 return false; |
1272 } | 1282 } |
1273 | 1283 |
1274 void BrowserAccessibility::DoDefaultAction() { | 1284 void BrowserAccessibility::DoDefaultAction() { |
1275 NOTREACHED(); | 1285 NOTREACHED(); |
1276 } | 1286 } |
1277 | 1287 |
1278 } // namespace content | 1288 } // namespace content |
OLD | NEW |