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

Unified Diff: chrome/browser/ui/ash/accessibility/automation_manager_ash.cc

Issue 1040863002: Revert "Enable chrome.automation.getDesktop on all aura platforms." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/ash/accessibility/automation_manager_ash.cc
diff --git a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc b/chrome/browser/ui/ash/accessibility/automation_manager_ash.cc
similarity index 57%
rename from chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
rename to chrome/browser/ui/ash/accessibility/automation_manager_ash.cc
index 8a0bc144d622f34fca4fc9779c9e0432507430be..a672e9c4f1c034ae6aa6cb1bdc3556d0c1b91662 100644
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
+++ b/chrome/browser/ui/ash/accessibility/automation_manager_ash.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/aura/accessibility/automation_manager_aura.h"
+#include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h"
#include <vector>
@@ -21,14 +21,14 @@
using content::BrowserContext;
// static
-AutomationManagerAura* AutomationManagerAura::GetInstance() {
- return Singleton<AutomationManagerAura>::get();
+AutomationManagerAsh* AutomationManagerAsh::GetInstance() {
+ return Singleton<AutomationManagerAsh>::get();
}
-void AutomationManagerAura::Enable(BrowserContext* context) {
+void AutomationManagerAsh::Enable(BrowserContext* context) {
enabled_ = true;
if (!current_tree_.get())
- current_tree_.reset(new AXTreeSourceAura());
+ current_tree_.reset(new AXTreeSourceAsh());
ResetSerializer();
SendEvent(context, current_tree_->GetRoot(), ui::AX_EVENT_LOAD_COMPLETE);
if (!pending_alert_text_.empty()) {
@@ -37,16 +37,16 @@ void AutomationManagerAura::Enable(BrowserContext* context) {
}
}
-void AutomationManagerAura::Disable() {
+void AutomationManagerAsh::Disable() {
enabled_ = false;
// Reset the serializer to save memory.
current_tree_serializer_->Reset();
}
-void AutomationManagerAura::HandleEvent(BrowserContext* context,
- views::View* view,
- ui::AXEvent event_type) {
+void AutomationManagerAsh::HandleEvent(BrowserContext* context,
+ views::View* view,
+ ui::AXEvent event_type) {
if (!enabled_)
return;
@@ -60,24 +60,11 @@ void AutomationManagerAura::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 AutomationManagerAura::HandleAlert(content::BrowserContext* context,
- const std::string& text) {
+void AutomationManagerAsh::HandleAlert(content::BrowserContext* context,
+ const std::string& text) {
if (!enabled_) {
pending_alert_text_ = text;
return;
@@ -89,51 +76,52 @@ void AutomationManagerAura::HandleAlert(content::BrowserContext* context,
SendEvent(context, obj, ui::AX_EVENT_ALERT);
}
-void AutomationManagerAura::DoDefault(int32 id) {
+void AutomationManagerAsh::DoDefault(int32 id) {
CHECK(enabled_);
current_tree_->DoDefault(id);
}
-void AutomationManagerAura::Focus(int32 id) {
+void AutomationManagerAsh::Focus(int32 id) {
CHECK(enabled_);
current_tree_->Focus(id);
}
-void AutomationManagerAura::MakeVisible(int32 id) {
+void AutomationManagerAsh::MakeVisible(int32 id) {
CHECK(enabled_);
current_tree_->MakeVisible(id);
}
-void AutomationManagerAura::SetSelection(int32 id, int32 start, int32 end) {
+void AutomationManagerAsh::SetSelection(int32 id, int32 start, int32 end) {
CHECK(enabled_);
current_tree_->SetSelection(id, start, end);
}
-AutomationManagerAura::AutomationManagerAura()
- : enabled_(false), processing_events_(false) {
+AutomationManagerAsh::AutomationManagerAsh() : enabled_(false) {
}
-AutomationManagerAura::~AutomationManagerAura() {
-}
+AutomationManagerAsh::~AutomationManagerAsh() {}
-void AutomationManagerAura::ResetSerializer() {
+void AutomationManagerAsh::ResetSerializer() {
current_tree_serializer_.reset(
- new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(current_tree_.get()));
+ new ui::AXTreeSerializer<views::AXAuraObjWrapper*>(
+ current_tree_.get()));
}
-void AutomationManagerAura::SendEvent(BrowserContext* context,
- views::AXAuraObjWrapper* aura_obj,
- ui::AXEvent event_type) {
+void AutomationManagerAsh::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(

Powered by Google App Engine
This is Rietveld 408576698