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

Side by Side Diff: ui/views/accessibility/ax_window_obj_wrapper.cc

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: Rebase on dependent change 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/accessibility/ax_window_obj_wrapper.h" 5 #include "ui/views/accessibility/ax_window_obj_wrapper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/accessibility/ax_node_data.h" 10 #include "ui/accessibility/ax_node_data.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 if (widget && widget->IsVisible()) 47 if (widget && widget->IsVisible())
48 out_children->push_back(AXAuraObjCache::GetInstance()->GetOrCreate(widget)); 48 out_children->push_back(AXAuraObjCache::GetInstance()->GetOrCreate(widget));
49 } 49 }
50 50
51 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) { 51 void AXWindowObjWrapper::Serialize(ui::AXNodeData* out_node_data) {
52 out_node_data->id = GetID(); 52 out_node_data->id = GetID();
53 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW; 53 out_node_data->role = is_alert_ ? ui::AX_ROLE_ALERT : ui::AX_ROLE_WINDOW;
54 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME, 54 out_node_data->AddStringAttribute(ui::AX_ATTR_NAME,
55 base::UTF16ToUTF8(window_->GetTitle())); 55 base::UTF16ToUTF8(window_->GetTitle()));
56 out_node_data->state = 0; 56 out_node_data->state = 0;
57 out_node_data->location = gfx::RectF(window_->bounds()); 57 out_node_data->location = gfx::RectF(window_->GetBoundsInScreen());
58 58
59 ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id = 59 ui::AXTreeIDRegistry::AXTreeID child_ax_tree_id =
60 window_->GetProperty(ui::kChildAXTreeID); 60 window_->GetProperty(ui::kChildAXTreeID);
61 if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID) 61 if (child_ax_tree_id != ui::AXTreeIDRegistry::kNoAXTreeID)
62 out_node_data->AddIntAttribute(ui::AX_ATTR_CHILD_TREE_ID, child_ax_tree_id); 62 out_node_data->AddIntAttribute(ui::AX_ATTR_CHILD_TREE_ID, child_ax_tree_id);
63 } 63 }
64 64
65 int32_t AXWindowObjWrapper::GetID() { 65 int32_t AXWindowObjWrapper::GetID() {
66 return AXAuraObjCache::GetInstance()->GetID(window_); 66 return AXAuraObjCache::GetInstance()->GetID(window_);
67 } 67 }
(...skipping 10 matching lines...) Expand all
78 78
79 void AXWindowObjWrapper::OnWindowHierarchyChanged( 79 void AXWindowObjWrapper::OnWindowHierarchyChanged(
80 const HierarchyChangeParams& params) { 80 const HierarchyChangeParams& params) {
81 if (params.phase == WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGED) 81 if (params.phase == WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGED)
82 AXAuraObjCache::GetInstance()->Remove(params.target, params.old_parent); 82 AXAuraObjCache::GetInstance()->Remove(params.target, params.old_parent);
83 } 83 }
84 84
85 void AXWindowObjWrapper::OnWindowBoundsChanged(aura::Window* window, 85 void AXWindowObjWrapper::OnWindowBoundsChanged(aura::Window* window,
86 const gfx::Rect& old_bounds, 86 const gfx::Rect& old_bounds,
87 const gfx::Rect& new_bounds) { 87 const gfx::Rect& new_bounds) {
88 AXAuraObjCache::GetInstance()->FireEvent(this, ui::AX_EVENT_LOCATION_CHANGED);
89
88 Widget* widget = Widget::GetWidgetForNativeView(window); 90 Widget* widget = Widget::GetWidgetForNativeView(window);
89 if (widget) { 91 if (widget) {
90 widget->GetRootView()->NotifyAccessibilityEvent( 92 widget->GetRootView()->NotifyAccessibilityEvent(
91 ui::AX_EVENT_LOCATION_CHANGED, true); 93 ui::AX_EVENT_LOCATION_CHANGED, true);
92 } 94 }
93 } 95 }
94 96
97 void AXWindowObjWrapper::OnWindowPropertyChanged(aura::Window* window,
98 const void* key,
99 intptr_t old) {
100 if (key == ui::kChildAXTreeID) {
101 AXAuraObjCache::GetInstance()->FireEvent(this,
102 ui::AX_EVENT_CHILDREN_CHANGED);
103 }
104 }
105
95 } // namespace views 106 } // namespace views
OLDNEW
« ui/views/accessibility/ax_aura_obj_cache.cc ('K') | « ui/views/accessibility/ax_window_obj_wrapper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698