OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/chromeos/arc/accessibility/ax_tree_source_arc.h" | 5 #include "chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou
ter.h" | 9 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou
ter.h" |
10 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" | 10 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if (GetBooleanProperty(node, android_boolean_property)) \ | 159 if (GetBooleanProperty(node, android_boolean_property)) \ |
160 out_data->AddStateFlag(chrome_state); | 160 out_data->AddStateFlag(chrome_state); |
161 | 161 |
162 using AXBooleanProperty = arc::mojom::AccessibilityBooleanProperty; | 162 using AXBooleanProperty = arc::mojom::AccessibilityBooleanProperty; |
163 | 163 |
164 // These mappings were taken from accessibility utils (Android -> Chrome) and | 164 // These mappings were taken from accessibility utils (Android -> Chrome) and |
165 // BrowserAccessibilityAndroid. They do not completely match the above two | 165 // BrowserAccessibilityAndroid. They do not completely match the above two |
166 // sources. | 166 // sources. |
167 // The FOCUSABLE state is not mapped because Android places focusability on | 167 // The FOCUSABLE state is not mapped because Android places focusability on |
168 // many ancestor nodes. | 168 // many ancestor nodes. |
169 MAP_STATE(AXBooleanProperty::CHECKED, ui::AX_STATE_CHECKED); | |
170 MAP_STATE(AXBooleanProperty::EDITABLE, ui::AX_STATE_EDITABLE); | 169 MAP_STATE(AXBooleanProperty::EDITABLE, ui::AX_STATE_EDITABLE); |
171 MAP_STATE(AXBooleanProperty::MULTI_LINE, ui::AX_STATE_MULTILINE); | 170 MAP_STATE(AXBooleanProperty::MULTI_LINE, ui::AX_STATE_MULTILINE); |
172 MAP_STATE(AXBooleanProperty::PASSWORD, ui::AX_STATE_PROTECTED); | 171 MAP_STATE(AXBooleanProperty::PASSWORD, ui::AX_STATE_PROTECTED); |
173 MAP_STATE(AXBooleanProperty::SELECTED, ui::AX_STATE_SELECTED); | 172 MAP_STATE(AXBooleanProperty::SELECTED, ui::AX_STATE_SELECTED); |
174 | 173 |
175 #undef MAP_STATE | 174 #undef MAP_STATE |
176 | 175 |
| 176 if (GetBooleanProperty(node, AXBooleanProperty::CHECKABLE)) { |
| 177 const bool is_checked = |
| 178 GetBooleanProperty(node, AXBooleanProperty::CHECKED); |
| 179 const ui::AXCheckedState checked_state = |
| 180 is_checked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE; |
| 181 out_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); |
| 182 } |
| 183 |
177 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED)) | 184 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED)) |
178 out_data->AddStateFlag(ui::AX_STATE_DISABLED); | 185 out_data->AddStateFlag(ui::AX_STATE_DISABLED); |
179 } | 186 } |
180 | 187 |
181 } // namespace | 188 } // namespace |
182 | 189 |
183 namespace arc { | 190 namespace arc { |
184 | 191 |
185 AXTreeSourceArc::AXTreeSourceArc(int32_t id) | 192 AXTreeSourceArc::AXTreeSourceArc(int32_t id) |
186 : tree_id_(id), | 193 : tree_id_(id), |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 parent_map_.clear(); | 343 parent_map_.clear(); |
337 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); | 344 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); |
338 root_id_ = -1; | 345 root_id_ = -1; |
339 focused_node_id_ = -1; | 346 focused_node_id_ = -1; |
340 extensions::AutomationEventRouter* router = | 347 extensions::AutomationEventRouter* router = |
341 extensions::AutomationEventRouter::GetInstance(); | 348 extensions::AutomationEventRouter::GetInstance(); |
342 router->DispatchTreeDestroyedEvent(tree_id_, nullptr); | 349 router->DispatchTreeDestroyedEvent(tree_id_, nullptr); |
343 } | 350 } |
344 | 351 |
345 } // namespace arc | 352 } // namespace arc |
OLD | NEW |