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 55cc829541016954a3789a8eb92ead607e9af09c..282b1e5208022820d6b7ecd27f451a30b6099d01 100644 |
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
@@ -8,9 +8,8 @@ |
#include "base/memory/singleton.h" |
#include "chrome/browser/browser_process.h" |
-#include "chrome/browser/extensions/api/automation_internal/automation_event_router.h" |
+#include "chrome/browser/extensions/api/automation_internal/automation_util.h" |
#include "chrome/browser/profiles/profile_manager.h" |
-#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/aura/window.h" |
@@ -20,7 +19,6 @@ |
#include "ui/views/widget/widget.h" |
using content::BrowserContext; |
-using extensions::AutomationEventRouter; |
// static |
AutomationManagerAura* AutomationManagerAura::GetInstance() { |
@@ -66,7 +64,20 @@ |
views::AXAuraObjWrapper* aura_obj = |
views::AXAuraObjCache::GetInstance()->GetOrCreate(view); |
+ |
+ if (processing_events_) { |
+ pending_events_.push_back(std::make_pair(aura_obj, event_type)); |
+ return; |
+ } |
+ |
+ processing_events_ = true; |
SendEvent(context, aura_obj, event_type); |
+ |
+ for (size_t i = 0; i < pending_events_.size(); ++i) |
+ SendEvent(context, pending_events_[i].first, pending_events_[i].second); |
+ |
+ processing_events_ = false; |
+ pending_events_.clear(); |
} |
void AutomationManagerAura::HandleAlert(content::BrowserContext* context, |
@@ -121,28 +132,21 @@ |
void AutomationManagerAura::SendEvent(BrowserContext* context, |
views::AXAuraObjWrapper* aura_obj, |
ui::AXEvent event_type) { |
- if (processing_events_) { |
- pending_events_.push_back(std::make_pair(aura_obj, event_type)); |
- return; |
- } |
- processing_events_ = true; |
+ ui::AXTreeUpdate update; |
+ current_tree_serializer_->SerializeChanges(aura_obj, &update); |
- ExtensionMsg_AccessibilityEventParams params; |
- current_tree_serializer_->SerializeChanges(aura_obj, ¶ms.update); |
- params.tree_id = 0; |
- params.id = aura_obj->GetID(); |
- params.event_type = event_type; |
- AutomationEventRouter* router = AutomationEventRouter::GetInstance(); |
- router->DispatchAccessibilityEvent(params); |
- |
- processing_events_ = false; |
- auto pending_events_copy = pending_events_; |
- pending_events_.clear(); |
- for (size_t i = 0; i < pending_events_copy.size(); ++i) { |
- SendEvent(context, |
- pending_events_copy[i].first, |
- pending_events_copy[i].second); |
- } |
+ // Route this event to special process/routing ids recognized by the |
+ // Automation API as the desktop tree. |
+ // TODO(dtseng): Would idealy define these special desktop constants in idl. |
+ content::AXEventNotificationDetails detail( |
+ update.node_id_to_clear, update.nodes, event_type, aura_obj->GetID(), |
+ std::map<int32, int>(), |
+ 0, /* process_id */ |
+ 0 /* routing_id */); |
+ std::vector<content::AXEventNotificationDetails> details; |
+ details.push_back(detail); |
+ extensions::automation_util::DispatchAccessibilityEventsToAutomation( |
+ details, context, gfx::Vector2d()); |
} |
void AutomationManagerAura::OnNativeFocusChanged(aura::Window* focused_now) { |