OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/browser_accessibility_win.h" | 5 #include "chrome/browser/browser_accessibility_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/browser_accessibility_manager_win.h" | 8 #include "chrome/browser/browser_accessibility_manager_win.h" |
9 | 9 |
10 using webkit_glue::WebAccessibility; | 10 using webkit_glue::WebAccessibility; |
(...skipping 10 matching lines...) Expand all Loading... |
21 BrowserAccessibility::~BrowserAccessibility() { | 21 BrowserAccessibility::~BrowserAccessibility() { |
22 InactivateTree(); | 22 InactivateTree(); |
23 } | 23 } |
24 | 24 |
25 void BrowserAccessibility::Initialize( | 25 void BrowserAccessibility::Initialize( |
26 BrowserAccessibilityManager* manager, | 26 BrowserAccessibilityManager* manager, |
27 BrowserAccessibility* parent, | 27 BrowserAccessibility* parent, |
28 LONG child_id, | 28 LONG child_id, |
29 LONG index_in_parent, | 29 LONG index_in_parent, |
30 const webkit_glue::WebAccessibility& src) { | 30 const webkit_glue::WebAccessibility& src) { |
| 31 DCHECK_EQ(children_.size(), 0U); |
| 32 |
31 manager_ = manager; | 33 manager_ = manager; |
32 parent_ = parent; | 34 parent_ = parent; |
33 child_id_ = child_id; | 35 child_id_ = child_id; |
34 index_in_parent_ = index_in_parent; | 36 index_in_parent_ = index_in_parent; |
35 | 37 |
36 renderer_id_ = src.id; | 38 renderer_id_ = src.id; |
37 name_ = src.name; | 39 name_ = src.name; |
38 value_ = src.value; | 40 value_ = src.value; |
39 attributes_ = src.attributes; | 41 attributes_ = src.attributes; |
40 location_ = src.location; | 42 location_ = src.location; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 return parent_->IsDescendantOf(ancestor); | 85 return parent_->IsDescendantOf(ancestor); |
84 } | 86 } |
85 | 87 |
86 return false; | 88 return false; |
87 } | 89 } |
88 | 90 |
89 BrowserAccessibility* BrowserAccessibility::GetParent() { | 91 BrowserAccessibility* BrowserAccessibility::GetParent() { |
90 return parent_; | 92 return parent_; |
91 } | 93 } |
92 | 94 |
| 95 uint32 BrowserAccessibility::GetChildCount() { |
| 96 return children_.size(); |
| 97 } |
| 98 |
93 BrowserAccessibility* BrowserAccessibility::GetPreviousSibling() { | 99 BrowserAccessibility* BrowserAccessibility::GetPreviousSibling() { |
94 if (parent_ && index_in_parent_ > 0) | 100 if (parent_ && index_in_parent_ > 0) |
95 return parent_->children_[index_in_parent_ - 1]; | 101 return parent_->children_[index_in_parent_ - 1]; |
96 | 102 |
97 return NULL; | 103 return NULL; |
98 } | 104 } |
99 | 105 |
100 BrowserAccessibility* BrowserAccessibility::GetNextSibling() { | 106 BrowserAccessibility* BrowserAccessibility::GetNextSibling() { |
101 if (parent_ && | 107 if (parent_ && |
102 index_in_parent_ < static_cast<int>(parent_->children_.size() - 1)) { | 108 index_in_parent_ < static_cast<int>(parent_->children_.size() - 1)) { |
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 } | 1026 } |
1021 | 1027 |
1022 // The role should always be set. | 1028 // The role should always be set. |
1023 DCHECK(!role_name_.empty() || role_); | 1029 DCHECK(!role_name_.empty() || role_); |
1024 | 1030 |
1025 // If we didn't explicitly set the IAccessible2 role, make it the same | 1031 // If we didn't explicitly set the IAccessible2 role, make it the same |
1026 // as the MSAA role. | 1032 // as the MSAA role. |
1027 if (!ia2_role_) | 1033 if (!ia2_role_) |
1028 ia2_role_ = role_; | 1034 ia2_role_ = role_; |
1029 } | 1035 } |
OLD | NEW |