Index: chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
diff --git a/chrome/browser/ui/ash/accessibility/automation_manager_ash.cc b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
similarity index 57% |
rename from chrome/browser/ui/ash/accessibility/automation_manager_ash.cc |
rename to chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
index a672e9c4f1c034ae6aa6cb1bdc3556d0c1b91662..8a0bc144d622f34fca4fc9779c9e0432507430be 100644 |
--- a/chrome/browser/ui/ash/accessibility/automation_manager_ash.cc |
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" |
+#include "chrome/browser/ui/aura/accessibility/automation_manager_aura.h" |
#include <vector> |
@@ -21,14 +21,14 @@ |
using content::BrowserContext; |
// static |
-AutomationManagerAsh* AutomationManagerAsh::GetInstance() { |
- return Singleton<AutomationManagerAsh>::get(); |
+AutomationManagerAura* AutomationManagerAura::GetInstance() { |
+ return Singleton<AutomationManagerAura>::get(); |
} |
-void AutomationManagerAsh::Enable(BrowserContext* context) { |
+void AutomationManagerAura::Enable(BrowserContext* context) { |
enabled_ = true; |
if (!current_tree_.get()) |
- current_tree_.reset(new AXTreeSourceAsh()); |
+ current_tree_.reset(new AXTreeSourceAura()); |
ResetSerializer(); |
SendEvent(context, current_tree_->GetRoot(), ui::AX_EVENT_LOAD_COMPLETE); |
if (!pending_alert_text_.empty()) { |
@@ -37,16 +37,16 @@ void AutomationManagerAsh::Enable(BrowserContext* context) { |
} |
} |
-void AutomationManagerAsh::Disable() { |
+void AutomationManagerAura::Disable() { |
enabled_ = false; |
// Reset the serializer to save memory. |
current_tree_serializer_->Reset(); |
} |
-void AutomationManagerAsh::HandleEvent(BrowserContext* context, |
- views::View* view, |
- ui::AXEvent event_type) { |
+void AutomationManagerAura::HandleEvent(BrowserContext* context, |
+ views::View* view, |
+ ui::AXEvent event_type) { |
if (!enabled_) |
return; |
@@ -60,11 +60,24 @@ void AutomationManagerAsh::HandleEvent(BrowserContext* context, |
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 AutomationManagerAsh::HandleAlert(content::BrowserContext* context, |
- const std::string& text) { |
+void AutomationManagerAura::HandleAlert(content::BrowserContext* context, |
+ const std::string& text) { |
if (!enabled_) { |
pending_alert_text_ = text; |
return; |
@@ -76,52 +89,51 @@ void AutomationManagerAsh::HandleAlert(content::BrowserContext* context, |
SendEvent(context, obj, ui::AX_EVENT_ALERT); |
} |
-void AutomationManagerAsh::DoDefault(int32 id) { |
+void AutomationManagerAura::DoDefault(int32 id) { |
CHECK(enabled_); |
current_tree_->DoDefault(id); |
} |
-void AutomationManagerAsh::Focus(int32 id) { |
+void AutomationManagerAura::Focus(int32 id) { |
CHECK(enabled_); |
current_tree_->Focus(id); |
} |
-void AutomationManagerAsh::MakeVisible(int32 id) { |
+void AutomationManagerAura::MakeVisible(int32 id) { |
CHECK(enabled_); |
current_tree_->MakeVisible(id); |
} |
-void AutomationManagerAsh::SetSelection(int32 id, int32 start, int32 end) { |
+void AutomationManagerAura::SetSelection(int32 id, int32 start, int32 end) { |
CHECK(enabled_); |
current_tree_->SetSelection(id, start, end); |
} |
-AutomationManagerAsh::AutomationManagerAsh() : enabled_(false) { |
+AutomationManagerAura::AutomationManagerAura() |
+ : enabled_(false), processing_events_(false) { |
} |
-AutomationManagerAsh::~AutomationManagerAsh() {} |
+AutomationManagerAura::~AutomationManagerAura() { |
+} |
-void AutomationManagerAsh::ResetSerializer() { |
+void AutomationManagerAura::ResetSerializer() { |
current_tree_serializer_.reset( |
- new ui::AXTreeSerializer<views::AXAuraObjWrapper*>( |
- current_tree_.get())); |
+ new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(current_tree_.get())); |
} |
-void AutomationManagerAsh::SendEvent(BrowserContext* context, |
- views::AXAuraObjWrapper* aura_obj, |
- ui::AXEvent event_type) { |
+void AutomationManagerAura::SendEvent(BrowserContext* context, |
+ views::AXAuraObjWrapper* aura_obj, |
+ ui::AXEvent event_type) { |
ui::AXTreeUpdate update; |
current_tree_serializer_->SerializeChanges(aura_obj, &update); |
// 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(), |
- 0, /* process_id */ |
- 0 /* routing_id */); |
+ content::AXEventNotificationDetails detail( |
+ update.node_id_to_clear, update.nodes, event_type, aura_obj->GetID(), |
+ 0, /* process_id */ |
+ 0 /* routing_id */); |
std::vector<content::AXEventNotificationDetails> details; |
details.push_back(detail); |
extensions::automation_util::DispatchAccessibilityEventsToAutomation( |