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

Unified Diff: ui/views/accessibility/ax_aura_obj_cache.cc

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: Rebase Created 3 years, 8 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: ui/views/accessibility/ax_aura_obj_cache.cc
diff --git a/ui/views/accessibility/ax_aura_obj_cache.cc b/ui/views/accessibility/ax_aura_obj_cache.cc
index ad9df5c9fdd4d75a1b1e802c85352dd1de7f41f0..cfb2cdf97fd37682048d7ed41ec2545e770d1104 100644
--- a/ui/views/accessibility/ax_aura_obj_cache.cc
+++ b/ui/views/accessibility/ax_aura_obj_cache.cc
@@ -34,6 +34,14 @@ AXAuraObjWrapper* AXAuraObjCache::GetOrCreate(Widget* widget) {
AXAuraObjWrapper* AXAuraObjCache::GetOrCreate(aura::Window* window) {
if (!focus_client_) {
+ // Note: On Chrome OS, there's exactly one root window per screen,
+ // it's the same as ash::Shell::Get()->GetPrimaryRootWindow() when
+ // there's only one screen. Observing the root window allows us to
+ // detect any time a window is added or removed.
+ //
+ // TODO(dmazzoni): Explicitly observe each root window on Chrome OS
+ // and track as root windows are added and removed.
+ // http://crbug.com/713278
aura::Window* root_window = window->GetRootWindow();
if (root_window) {
focus_client_ = aura::client::GetFocusClient(root_window);
@@ -124,6 +132,12 @@ void AXAuraObjCache::OnFocusedViewChanged() {
view->NotifyAccessibilityEvent(ui::AX_EVENT_FOCUS, true);
}
+void AXAuraObjCache::FireEvent(AXAuraObjWrapper* aura_obj,
+ ui::AXEvent event_type) {
+ if (delegate_)
+ delegate_->OnEvent(aura_obj, event_type);
+}
+
AXAuraObjCache::AXAuraObjCache()
: current_id_(1),
focus_client_(nullptr),
@@ -181,6 +195,15 @@ void AXAuraObjCache::OnWindowDestroying(aura::Window* window) {
focus_client_ = nullptr;
}
+void AXAuraObjCache::OnWindowHierarchyChanged(
+ const HierarchyChangeParams& params) {
+ aura::Window* window = params.target;
+ if (window->parent()) {
+ delegate_->OnEvent(GetOrCreate(window->parent()),
+ ui::AX_EVENT_CHILDREN_CHANGED);
+ }
+}
+
template <typename AuraViewWrapper, typename AuraView>
AXAuraObjWrapper* AXAuraObjCache::CreateInternal(
AuraView* aura_view,

Powered by Google App Engine
This is Rietveld 408576698