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

Unified Diff: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc

Issue 2426193003: Re-land: Create AXAction and AXActionData as a way to simplify accessibility actions (Closed)
Patch Set: Rebase Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
index 44dd07306fbd9b6dacebedc1268950472ae68a18..bd05eb4de92fef9334ccd9dea459cad5a1f73922 100644
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
@@ -16,6 +16,8 @@
#include "chrome/common/extensions/chrome_extension_messages.h"
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_context.h"
+#include "ui/accessibility/ax_action_data.h"
+#include "ui/accessibility/ax_enums.h"
#include "ui/aura/window.h"
#include "ui/views/accessibility/ax_aura_obj_wrapper.h"
#include "ui/views/view.h"
@@ -81,36 +83,45 @@ void AutomationManagerAura::HandleAlert(content::BrowserContext* context,
SendEvent(context, obj, ui::AX_EVENT_ALERT);
}
-void AutomationManagerAura::DoDefault(int32_t id) {
+void AutomationManagerAura::PerformAction(
+ const ui::AXActionData& data) {
CHECK(enabled_);
- current_tree_->DoDefault(id);
-}
-
-void AutomationManagerAura::Focus(int32_t id) {
- CHECK(enabled_);
- current_tree_->Focus(id);
-}
-
-void AutomationManagerAura::MakeVisible(int32_t id) {
- CHECK(enabled_);
- current_tree_->MakeVisible(id);
-}
-void AutomationManagerAura::SetSelection(int32_t anchor_id,
- int32_t anchor_offset,
- int32_t focus_id,
- int32_t focus_offset) {
- CHECK(enabled_);
- if (anchor_id != focus_id) {
- NOTREACHED();
- return;
+ switch (data.action) {
+ case ui::AX_ACTION_DO_DEFAULT:
+ current_tree_->DoDefault(data.target_node_id);
+ break;
+ case ui::AX_ACTION_SET_FOCUS:
+ current_tree_->Focus(data.target_node_id);
+ break;
+ case ui::AX_ACTION_SCROLL_TO_MAKE_VISIBLE:
+ current_tree_->MakeVisible(data.target_node_id);
+ break;
+ case ui::AX_ACTION_SET_SELECTION:
+ if (data.anchor_node_id != data.focus_node_id) {
+ NOTREACHED();
+ return;
+ }
+ current_tree_->SetSelection(
+ data.anchor_node_id, data.anchor_offset, data.focus_offset);
+ break;
+ case ui::AX_ACTION_SHOW_CONTEXT_MENU:
+ current_tree_->ShowContextMenu(data.target_node_id);
+ break;
+ case ui::AX_ACTION_SET_ACCESSIBILITY_FOCUS:
+ // Sent by ChromeVox but doesn't need to be handled by aura.
+ break;
+ case ui::AX_ACTION_HIT_TEST:
+ case ui::AX_ACTION_SCROLL_TO_POINT:
+ case ui::AX_ACTION_SET_SCROLL_OFFSET:
+ case ui::AX_ACTION_SET_VALUE:
+ // Not implemented yet.
+ NOTREACHED();
+ break;
+ case ui::AX_ACTION_NONE:
+ NOTREACHED();
+ break;
}
- current_tree_->SetSelection(anchor_id, anchor_offset, focus_offset);
-}
-
-void AutomationManagerAura::ShowContextMenu(int32_t id) {
- CHECK(enabled_);
- current_tree_->ShowContextMenu(id);
}
void AutomationManagerAura::OnChildWindowRemoved(
« no previous file with comments | « chrome/browser/ui/aura/accessibility/automation_manager_aura.h ('k') | chrome/common/extensions/api/automation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698