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

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

Issue 2295183003: Update desktop tree when Aura windows are removed. (Closed)
Patch Set: Fix test. Created 4 years, 4 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 c0de45ea7ab691ecf1d61069df35631d7e903f19..44dd07306fbd9b6dacebedc1268950472ae68a18 100644
--- a/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
+++ b/chrome/browser/ui/aura/accessibility/automation_manager_aura.cc
@@ -17,7 +17,6 @@
#include "content/public/browser/ax_event_notification_details.h"
#include "content/public/browser/browser_context.h"
#include "ui/aura/window.h"
-#include "ui/views/accessibility/ax_aura_obj_cache.h"
#include "ui/views/accessibility/ax_aura_obj_wrapper.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
@@ -41,6 +40,7 @@ void AutomationManagerAura::Enable(BrowserContext* context) {
ResetSerializer();
SendEvent(context, current_tree_->GetRoot(), ui::AX_EVENT_LOAD_COMPLETE);
+ views::AXAuraObjCache::GetInstance()->SetDelegate(this);
#if defined(OS_CHROMEOS)
aura::Window* active_window = ash::wm::GetActiveWindow();
@@ -65,17 +65,9 @@ void AutomationManagerAura::HandleEvent(BrowserContext* context,
if (!enabled_)
return;
- if (!context && g_browser_process->profile_manager())
- context = g_browser_process->profile_manager()->GetLastUsedProfile();
-
- if (!context) {
- LOG(WARNING) << "Accessibility notification but no browser context";
- return;
- }
-
views::AXAuraObjWrapper* aura_obj =
views::AXAuraObjCache::GetInstance()->GetOrCreate(view);
- SendEvent(context, aura_obj, event_type);
+ SendEvent(nullptr, aura_obj, event_type);
}
void AutomationManagerAura::HandleAlert(content::BrowserContext* context,
@@ -121,6 +113,17 @@ void AutomationManagerAura::ShowContextMenu(int32_t id) {
current_tree_->ShowContextMenu(id);
}
+void AutomationManagerAura::OnChildWindowRemoved(
+ views::AXAuraObjWrapper* parent) {
+ if (!enabled_)
+ return;
+
+ if (!parent)
+ parent = current_tree_->GetRoot();
+
+ SendEvent(nullptr, parent, ui::AX_EVENT_CHILDREN_CHANGED);
+}
+
AutomationManagerAura::AutomationManagerAura()
: enabled_(false), processing_events_(false) {}
@@ -135,6 +138,15 @@ void AutomationManagerAura::ResetSerializer() {
void AutomationManagerAura::SendEvent(BrowserContext* context,
views::AXAuraObjWrapper* aura_obj,
ui::AXEvent event_type) {
+ if (!context && g_browser_process->profile_manager()) {
+ context = g_browser_process->profile_manager()->GetLastUsedProfile();
+ }
+
+ if (!context) {
+ LOG(WARNING) << "Accessibility notification but no browser context";
+ return;
+ }
+
if (processing_events_) {
pending_events_.push_back(std::make_pair(aura_obj, event_type));
return;
« no previous file with comments | « chrome/browser/ui/aura/accessibility/automation_manager_aura.h ('k') | ui/views/accessibility/ax_aura_obj_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698