| 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/arc_accessibility_helper_bri
dge.h" | 5 #include "chrome/browser/chromeos/arc/accessibility/arc_accessibility_helper_bri
dge.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 if (event_data->event_type != | 201 if (event_data->event_type != |
| 202 arc::mojom::AccessibilityEventType::VIEW_FOCUSED) | 202 arc::mojom::AccessibilityEventType::VIEW_FOCUSED) |
| 203 return; | 203 return; |
| 204 | 204 |
| 205 CHECK_EQ(1U, event_data.get()->node_data.size()); | 205 CHECK_EQ(1U, event_data.get()->node_data.size()); |
| 206 DispatchFocusChange(event_data.get()->node_data[0].get()); | 206 DispatchFocusChange(event_data.get()->node_data[0].get()); |
| 207 } | 207 } |
| 208 | 208 |
| 209 void ArcAccessibilityHelperBridge::OnAction( | 209 void ArcAccessibilityHelperBridge::OnAction( |
| 210 const ui::AXActionData& data) const { | 210 const ui::AXActionData& data) const { |
| 211 arc::mojom::AccessibilityActionType mojo_action; | 211 arc::mojom::AccessibilityActionDataPtr action_data = |
| 212 arc::mojom::AccessibilityActionData::New(); |
| 213 |
| 214 action_data->node_id = data.target_node_id; |
| 215 |
| 212 switch (data.action) { | 216 switch (data.action) { |
| 213 case ui::AX_ACTION_DO_DEFAULT: | 217 case ui::AX_ACTION_DO_DEFAULT: |
| 214 mojo_action = arc::mojom::AccessibilityActionType::CLICK; | 218 action_data->action_type = arc::mojom::AccessibilityActionType::CLICK; |
| 219 break; |
| 220 case ui::AX_ACTION_CUSTOM_ACTION: |
| 221 action_data->action_type = |
| 222 arc::mojom::AccessibilityActionType::CUSTOM_ACTION; |
| 223 action_data->custom_action_id = data.custom_action_id; |
| 215 break; | 224 break; |
| 216 default: | 225 default: |
| 217 return; | 226 return; |
| 218 } | 227 } |
| 219 | 228 |
| 220 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( | 229 auto* instance = ARC_GET_INSTANCE_FOR_METHOD( |
| 221 arc_bridge_service()->accessibility_helper(), PerformAction); | 230 arc_bridge_service()->accessibility_helper(), PerformAction); |
| 222 instance->PerformAction(data.target_node_id, mojo_action); | 231 instance->PerformAction(std::move(action_data)); |
| 223 } | 232 } |
| 224 | 233 |
| 225 void ArcAccessibilityHelperBridge::OnWindowActivated( | 234 void ArcAccessibilityHelperBridge::OnWindowActivated( |
| 226 aura::Window* gained_active, | 235 aura::Window* gained_active, |
| 227 aura::Window* lost_active) { | 236 aura::Window* lost_active) { |
| 228 if (gained_active == lost_active) | 237 if (gained_active == lost_active) |
| 229 return; | 238 return; |
| 230 | 239 |
| 231 if (!GetArcSurface(gained_active)) | 240 if (!GetArcSurface(gained_active)) |
| 232 return; | 241 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 break; | 276 break; |
| 268 } | 277 } |
| 269 } | 278 } |
| 270 } | 279 } |
| 271 | 280 |
| 272 void ArcAccessibilityHelperBridge::OnTaskSetActive(int32_t task_id) { | 281 void ArcAccessibilityHelperBridge::OnTaskSetActive(int32_t task_id) { |
| 273 current_task_id_ = task_id; | 282 current_task_id_ = task_id; |
| 274 } | 283 } |
| 275 | 284 |
| 276 } // namespace arc | 285 } // namespace arc |
| OLD | NEW |