| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (GetBooleanProperty(node, android_boolean_property)) \ | 171 if (GetBooleanProperty(node, android_boolean_property)) \ |
| 172 out_data->AddStateFlag(chrome_state); | 172 out_data->AddStateFlag(chrome_state); |
| 173 | 173 |
| 174 using AXBooleanProperty = arc::mojom::AccessibilityBooleanProperty; | 174 using AXBooleanProperty = arc::mojom::AccessibilityBooleanProperty; |
| 175 | 175 |
| 176 // These mappings were taken from accessibility utils (Android -> Chrome) and | 176 // These mappings were taken from accessibility utils (Android -> Chrome) and |
| 177 // BrowserAccessibilityAndroid. They do not completely match the above two | 177 // BrowserAccessibilityAndroid. They do not completely match the above two |
| 178 // sources. | 178 // sources. |
| 179 // The FOCUSABLE state is not mapped because Android places focusability on | 179 // The FOCUSABLE state is not mapped because Android places focusability on |
| 180 // many ancestor nodes. | 180 // many ancestor nodes. |
| 181 MAP_STATE(AXBooleanProperty::CHECKED, ui::AX_STATE_CHECKED); | |
| 182 MAP_STATE(AXBooleanProperty::EDITABLE, ui::AX_STATE_EDITABLE); | 181 MAP_STATE(AXBooleanProperty::EDITABLE, ui::AX_STATE_EDITABLE); |
| 183 MAP_STATE(AXBooleanProperty::MULTI_LINE, ui::AX_STATE_MULTILINE); | 182 MAP_STATE(AXBooleanProperty::MULTI_LINE, ui::AX_STATE_MULTILINE); |
| 184 MAP_STATE(AXBooleanProperty::PASSWORD, ui::AX_STATE_PROTECTED); | 183 MAP_STATE(AXBooleanProperty::PASSWORD, ui::AX_STATE_PROTECTED); |
| 185 MAP_STATE(AXBooleanProperty::SELECTED, ui::AX_STATE_SELECTED); | 184 MAP_STATE(AXBooleanProperty::SELECTED, ui::AX_STATE_SELECTED); |
| 186 | 185 |
| 187 #undef MAP_STATE | 186 #undef MAP_STATE |
| 188 | 187 |
| 188 if (GetBooleanProperty(node, AXBooleanProperty::CHECKABLE)) { |
| 189 const bool is_checked = |
| 190 GetBooleanProperty(node, AXBooleanProperty::CHECKED); |
| 191 const ui::AXCheckedState checked_state = |
| 192 is_checked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE; |
| 193 out_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checked_state); |
| 194 } |
| 195 |
| 189 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED)) | 196 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED)) |
| 190 out_data->AddStateFlag(ui::AX_STATE_DISABLED); | 197 out_data->AddStateFlag(ui::AX_STATE_DISABLED); |
| 191 } | 198 } |
| 192 | 199 |
| 193 } // namespace | 200 } // namespace |
| 194 | 201 |
| 195 namespace arc { | 202 namespace arc { |
| 196 | 203 |
| 197 AXTreeSourceArc::AXTreeSourceArc(int32_t id) | 204 AXTreeSourceArc::AXTreeSourceArc(int32_t id) |
| 198 : tree_id_(id), | 205 : tree_id_(id), |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 parent_map_.clear(); | 365 parent_map_.clear(); |
| 359 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); | 366 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); |
| 360 root_id_ = -1; | 367 root_id_ = -1; |
| 361 focused_node_id_ = -1; | 368 focused_node_id_ = -1; |
| 362 extensions::AutomationEventRouter* router = | 369 extensions::AutomationEventRouter* router = |
| 363 extensions::AutomationEventRouter::GetInstance(); | 370 extensions::AutomationEventRouter::GetInstance(); |
| 364 router->DispatchTreeDestroyedEvent(tree_id_, nullptr); | 371 router->DispatchTreeDestroyedEvent(tree_id_, nullptr); |
| 365 } | 372 } |
| 366 | 373 |
| 367 } // namespace arc | 374 } // namespace arc |
| OLD | NEW |