| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/aura/accessibility/automation_manager_aura.h" | 5 #include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 views::AXAuraObjWrapper* obj = | 78 views::AXAuraObjWrapper* obj = |
| 79 static_cast<AXRootObjWrapper*>(current_tree_->GetRoot()) | 79 static_cast<AXRootObjWrapper*>(current_tree_->GetRoot()) |
| 80 ->GetAlertForText(text); | 80 ->GetAlertForText(text); |
| 81 SendEvent(context, obj, ui::AX_EVENT_ALERT); | 81 SendEvent(context, obj, ui::AX_EVENT_ALERT); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void AutomationManagerAura::PerformAction( | 84 void AutomationManagerAura::PerformAction( |
| 85 const ui::AXActionData& data) { | 85 const ui::AXActionData& data) { |
| 86 CHECK(enabled_); | 86 CHECK(enabled_); |
| 87 | 87 |
| 88 if (current_tree_->HandleAccessibleAction(data)) { | 88 current_tree_->HandleAccessibleAction(data); |
| 89 // This accessible action is handled by custom action implemented by the | |
| 90 // target view. | |
| 91 return; | |
| 92 } | |
| 93 | |
| 94 switch (data.action) { | |
| 95 case ui::AX_ACTION_DO_DEFAULT: | |
| 96 current_tree_->DoDefault(data.target_node_id); | |
| 97 break; | |
| 98 case ui::AX_ACTION_FOCUS: | |
| 99 current_tree_->Focus(data.target_node_id); | |
| 100 break; | |
| 101 case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE: | |
| 102 current_tree_->MakeVisible(data.target_node_id); | |
| 103 break; | |
| 104 case ui::AX_ACTION_SET_SELECTION: | |
| 105 if (data.anchor_node_id != data.focus_node_id) { | |
| 106 NOTREACHED(); | |
| 107 return; | |
| 108 } | |
| 109 current_tree_->SetSelection( | |
| 110 data.anchor_node_id, data.anchor_offset, data.focus_offset); | |
| 111 break; | |
| 112 case ui::AX_ACTION_SHOW_CONTEXT_MENU: | |
| 113 current_tree_->ShowContextMenu(data.target_node_id); | |
| 114 break; | |
| 115 case ui::AX_ACTION_SET_ACCESSIBILITY_FOCUS: | |
| 116 // Sent by ChromeVox but doesn't need to be handled by aura. | |
| 117 break; | |
| 118 case ui::AX_ACTION_SET_SEQUENTIAL_FOCUS_NAVIGATION_STARTING_POINT: | |
| 119 // Sent by ChromeVox but doesn't need to be handled by aura. | |
| 120 break; | |
| 121 case ui::AX_ACTION_BLUR: | |
| 122 case ui::AX_ACTION_DECREMENT: | |
| 123 case ui::AX_ACTION_GET_IMAGE_DATA: | |
| 124 case ui::AX_ACTION_HIT_TEST: | |
| 125 case ui::AX_ACTION_INCREMENT: | |
| 126 case ui::AX_ACTION_REPLACE_SELECTED_TEXT: | |
| 127 case ui::AX_ACTION_SCROLL_TO_POINT: | |
| 128 case ui::AX_ACTION_SET_SCROLL_OFFSET: | |
| 129 case ui::AX_ACTION_SET_VALUE: | |
| 130 // Not implemented yet. | |
| 131 NOTREACHED(); | |
| 132 break; | |
| 133 case ui::AX_ACTION_NONE: | |
| 134 NOTREACHED(); | |
| 135 break; | |
| 136 } | |
| 137 } | 89 } |
| 138 | 90 |
| 139 void AutomationManagerAura::OnChildWindowRemoved( | 91 void AutomationManagerAura::OnChildWindowRemoved( |
| 140 views::AXAuraObjWrapper* parent) { | 92 views::AXAuraObjWrapper* parent) { |
| 141 if (!enabled_) | 93 if (!enabled_) |
| 142 return; | 94 return; |
| 143 | 95 |
| 144 if (!parent) | 96 if (!parent) |
| 145 parent = current_tree_->GetRoot(); | 97 parent = current_tree_->GetRoot(); |
| 146 | 98 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 154 |
| 203 processing_events_ = false; | 155 processing_events_ = false; |
| 204 auto pending_events_copy = pending_events_; | 156 auto pending_events_copy = pending_events_; |
| 205 pending_events_.clear(); | 157 pending_events_.clear(); |
| 206 for (size_t i = 0; i < pending_events_copy.size(); ++i) { | 158 for (size_t i = 0; i < pending_events_copy.size(); ++i) { |
| 207 SendEvent(context, | 159 SendEvent(context, |
| 208 pending_events_copy[i].first, | 160 pending_events_copy[i].first, |
| 209 pending_events_copy[i].second); | 161 pending_events_copy[i].second); |
| 210 } | 162 } |
| 211 } | 163 } |
| OLD | NEW |