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

Side by Side Diff: content/browser/accessibility/browser_accessibility.cc

Issue 2763803002: BrowserAccessibility should own a AXPlatformNode. (Closed)
Patch Set: Created 3 years, 9 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 (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 28 matching lines...) Expand all
39 BrowserAccessibility::BrowserAccessibility() 39 BrowserAccessibility::BrowserAccessibility()
40 : manager_(NULL), 40 : manager_(NULL),
41 node_(NULL), 41 node_(NULL),
42 unique_id_(ui::AXPlatformNode::GetNextUniqueId()) { 42 unique_id_(ui::AXPlatformNode::GetNextUniqueId()) {
43 g_unique_id_map.Get()[unique_id_] = this; 43 g_unique_id_map.Get()[unique_id_] = this;
44 } 44 }
45 45
46 BrowserAccessibility::~BrowserAccessibility() { 46 BrowserAccessibility::~BrowserAccessibility() {
47 if (unique_id_) 47 if (unique_id_)
48 g_unique_id_map.Get().erase(unique_id_); 48 g_unique_id_map.Get().erase(unique_id_);
49 if (platform_node_)
50 platform_node_->Destroy();
49 } 51 }
50 52
51 // static 53 // static
52 BrowserAccessibility* BrowserAccessibility::GetFromUniqueID(int32_t unique_id) { 54 BrowserAccessibility* BrowserAccessibility::GetFromUniqueID(int32_t unique_id) {
53 auto iter = g_unique_id_map.Get().find(unique_id); 55 auto iter = g_unique_id_map.Get().find(unique_id);
54 if (iter == g_unique_id_map.Get().end()) 56 if (iter == g_unique_id_map.Get().end())
55 return nullptr; 57 return nullptr;
56 58
57 return iter->second; 59 return iter->second;
58 } 60 }
59 61
60 void BrowserAccessibility::Init(BrowserAccessibilityManager* manager, 62 void BrowserAccessibility::Init(BrowserAccessibilityManager* manager,
61 ui::AXNode* node) { 63 ui::AXNode* node) {
62 manager_ = manager; 64 manager_ = manager;
63 node_ = node; 65 node_ = node;
66 platform_node_ = ui::AXPlatformNode::Create(this);
64 } 67 }
65 68
66 bool BrowserAccessibility::PlatformIsLeaf() const { 69 bool BrowserAccessibility::PlatformIsLeaf() const {
67 if (InternalChildCount() == 0) 70 if (InternalChildCount() == 0)
68 return true; 71 return true;
69 72
70 // These types of objects may have children that we use as internal 73 // 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 74 // implementation details, but we want to expose them as leaves to platform
72 // accessibility APIs because screen readers might be confused if they find 75 // accessibility APIs because screen readers might be confused if they find
73 // any children. 76 // any children.
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 const ui::AXActionData& data) { 1285 const ui::AXActionData& data) {
1283 NOTREACHED(); 1286 NOTREACHED();
1284 return false; 1287 return false;
1285 } 1288 }
1286 1289
1287 void BrowserAccessibility::DoDefaultAction() { 1290 void BrowserAccessibility::DoDefaultAction() {
1288 NOTREACHED(); 1291 NOTREACHED();
1289 } 1292 }
1290 1293
1291 } // namespace content 1294 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698