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

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

Issue 2803823002: Fix Chrome OS virtual keyboard accessibility (Closed)
Patch Set: 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_widget_obj_wrapper.h" 5 #include "ui/views/accessibility/ax_widget_obj_wrapper.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_action_data.h"
8 #include "ui/accessibility/ax_node_data.h" 9 #include "ui/accessibility/ax_node_data.h"
9 #include "ui/views/accessibility/ax_aura_obj_cache.h" 10 #include "ui/views/accessibility/ax_aura_obj_cache.h"
10 #include "ui/views/accessibility/ax_aura_obj_wrapper.h" 11 #include "ui/views/accessibility/ax_aura_obj_wrapper.h"
11 #include "ui/views/widget/widget.h" 12 #include "ui/views/widget/widget.h"
12 #include "ui/views/widget/widget_delegate.h" 13 #include "ui/views/widget/widget_delegate.h"
13 14
14 namespace views { 15 namespace views {
15 16
16 AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) { 17 AXWidgetObjWrapper::AXWidgetObjWrapper(Widget* widget) : widget_(widget) {
17 widget->AddObserver(this); 18 widget->AddObserver(this);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 base::UTF16ToUTF8( 50 base::UTF16ToUTF8(
50 widget_->widget_delegate()->GetAccessibleWindowTitle())); 51 widget_->widget_delegate()->GetAccessibleWindowTitle()));
51 out_node_data->location = gfx::RectF(widget_->GetWindowBoundsInScreen()); 52 out_node_data->location = gfx::RectF(widget_->GetWindowBoundsInScreen());
52 out_node_data->state = 0; 53 out_node_data->state = 0;
53 } 54 }
54 55
55 int32_t AXWidgetObjWrapper::GetID() { 56 int32_t AXWidgetObjWrapper::GetID() {
56 return AXAuraObjCache::GetInstance()->GetID(widget_); 57 return AXAuraObjCache::GetInstance()->GetID(widget_);
57 } 58 }
58 59
60 bool AXWidgetObjWrapper::HandleAccessibleAction(
David Tseng 2017/04/06 16:45:44 I think this is the wrong level of abstraction to
dmazzoni 2017/04/07 23:34:09 No, because a HIT_TEST is fired on the root. We ju
61 const ui::AXActionData& action) {
62 if (action.action == ui::AX_ACTION_HIT_TEST) {
63 // For a hit test event, try to delegate to a View, and if that
64 // fails fire the event directly.
65 views::View* root_view = widget_->GetRootView();
66 views::View* hit_view =
67 root_view->GetEventHandlerForPoint(action.target_point);
68 if (hit_view) {
69 AXAuraObjWrapper* view_wrapper =
70 AXAuraObjCache::GetInstance()->GetOrCreate(hit_view);
71 if (view_wrapper)
72 return view_wrapper->HandleAccessibleAction(action);
73 }
74
75 AXAuraObjCache::GetInstance()->FireEvent(this,
76 action.hit_test_event_to_fire);
77 return true;
78 }
79
80 return false;
81 }
82
59 void AXWidgetObjWrapper::OnWidgetDestroying(Widget* widget) { 83 void AXWidgetObjWrapper::OnWidgetDestroying(Widget* widget) {
60 AXAuraObjCache::GetInstance()->Remove(widget); 84 AXAuraObjCache::GetInstance()->Remove(widget);
61 } 85 }
62 86
63 void AXWidgetObjWrapper::OnWidgetClosing(Widget* widget) { 87 void AXWidgetObjWrapper::OnWidgetClosing(Widget* widget) {
64 AXAuraObjCache::GetInstance()->Remove(widget); 88 AXAuraObjCache::GetInstance()->Remove(widget);
65 } 89 }
66 90
67 void AXWidgetObjWrapper::OnWidgetVisibilityChanged(Widget*, bool) { 91 void AXWidgetObjWrapper::OnWidgetVisibilityChanged(Widget*, bool) {
68 // If a widget changes visibility it may affect what's focused, in particular 92 // If a widget changes visibility it may affect what's focused, in particular
69 // when a widget that contains the focused view gets hidden. 93 // when a widget that contains the focused view gets hidden.
70 AXAuraObjCache::GetInstance()->OnFocusedViewChanged(); 94 AXAuraObjCache::GetInstance()->OnFocusedViewChanged();
71 } 95 }
72 96
73 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) { 97 void AXWidgetObjWrapper::OnWillRemoveView(Widget* widget, View* view) {
74 AXAuraObjCache::GetInstance()->RemoveViewSubtree(view); 98 AXAuraObjCache::GetInstance()->RemoveViewSubtree(view);
75 } 99 }
76 100
77 } // namespace views 101 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698