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

Side by Side Diff: chrome/browser/chromeos/arc/accessibility/ax_tree_source_arc.cc

Issue 2694903010: AX checked state changes (Closed)
Patch Set: After fixing checkable logic in android, test also needed to be fixed 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 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
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 isChecked = GetBooleanProperty(node, AXBooleanProperty::CHECKED);
178 const int checkedState =
179 isChecked ? ui::AX_CHECKED_STATE_TRUE : ui::AX_CHECKED_STATE_FALSE;
180 out_data->AddIntAttribute(ui::AX_ATTR_CHECKED_STATE, checkedState);
181 }
182
177 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED)) 183 if (!GetBooleanProperty(node, AXBooleanProperty::ENABLED))
178 out_data->AddStateFlag(ui::AX_STATE_DISABLED); 184 out_data->AddStateFlag(ui::AX_STATE_DISABLED);
179 } 185 }
180 186
181 } // namespace 187 } // namespace
182 188
183 namespace arc { 189 namespace arc {
184 190
185 AXTreeSourceArc::AXTreeSourceArc(int32_t id) 191 AXTreeSourceArc::AXTreeSourceArc(int32_t id)
186 : tree_id_(id), 192 : tree_id_(id),
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 parent_map_.clear(); 342 parent_map_.clear();
337 current_tree_serializer_.reset(new AXTreeArcSerializer(this)); 343 current_tree_serializer_.reset(new AXTreeArcSerializer(this));
338 root_id_ = -1; 344 root_id_ = -1;
339 focused_node_id_ = -1; 345 focused_node_id_ = -1;
340 extensions::AutomationEventRouter* router = 346 extensions::AutomationEventRouter* router =
341 extensions::AutomationEventRouter::GetInstance(); 347 extensions::AutomationEventRouter::GetInstance();
342 router->DispatchTreeDestroyedEvent(tree_id_, nullptr); 348 router->DispatchTreeDestroyedEvent(tree_id_, nullptr);
343 } 349 }
344 350
345 } // namespace arc 351 } // namespace arc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698