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

Side by Side Diff: ui/views/accessibility/native_view_accessibility.h

Issue 2119413004: a11y: Exclude children of nested keyboard accessible controls from a11y tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix widget children. Created 3 years, 11 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 #ifndef UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 5 #ifndef UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 6 #define UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
7 7
8 #include <map>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "build/build_config.h" 11 #include "build/build_config.h"
10 #include "ui/accessibility/ax_action_data.h" 12 #include "ui/accessibility/ax_action_data.h"
11 #include "ui/accessibility/ax_node_data.h" 13 #include "ui/accessibility/ax_node_data.h"
12 #include "ui/accessibility/platform/ax_platform_node.h" 14 #include "ui/accessibility/platform/ax_platform_node.h"
13 #include "ui/accessibility/platform/ax_platform_node_delegate.h" 15 #include "ui/accessibility/platform/ax_platform_node_delegate.h"
14 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
15 #include "ui/views/views_export.h" 17 #include "ui/views/views_export.h"
16 #include "ui/views/widget/widget_observer.h" 18 #include "ui/views/widget/widget_observer.h"
17 19
(...skipping 11 matching lines...) Expand all
29 31
30 namespace views { 32 namespace views {
31 33
32 class View; 34 class View;
33 class Widget; 35 class Widget;
34 36
35 class VIEWS_EXPORT NativeViewAccessibility 37 class VIEWS_EXPORT NativeViewAccessibility
36 : public ui::AXPlatformNodeDelegate, 38 : public ui::AXPlatformNodeDelegate,
37 public WidgetObserver { 39 public WidgetObserver {
38 public: 40 public:
39 static NativeViewAccessibility* Create(View* view); 41 static NativeViewAccessibility* GetOrCreate(View* view);
42
43 ~NativeViewAccessibility() override;
40 44
41 gfx::NativeViewAccessible GetNativeObject(); 45 gfx::NativeViewAccessible GetNativeObject();
42 46
43 // Call Destroy rather than deleting this, because the subclass may
44 // use reference counting.
45 virtual void Destroy();
46
47 void NotifyAccessibilityEvent(ui::AXEvent event_type); 47 void NotifyAccessibilityEvent(ui::AXEvent event_type);
48 48
49 // Focuses or unfocuses a View. 49 // Focuses or unfocuses a View.
50 bool SetFocused(bool focused); 50 bool SetFocused(bool focused);
51 51
52 // ui::AXPlatformNodeDelegate 52 // ui::AXPlatformNodeDelegate
53 const ui::AXNodeData& GetData() override; 53 const ui::AXNodeData& GetData() override;
54 int GetChildCount() override; 54 int GetChildCount() override;
55 gfx::NativeViewAccessible ChildAtIndex(int index) override; 55 gfx::NativeViewAccessible ChildAtIndex(int index) override;
56 gfx::NativeWindow GetTopLevelWidget() override; 56 gfx::NativeWindow GetTopLevelWidget() override;
57 gfx::NativeViewAccessible GetParent() override; 57 gfx::NativeViewAccessible GetParent() override;
58 gfx::Vector2d GetGlobalCoordinateOffset() override; 58 gfx::Vector2d GetGlobalCoordinateOffset() override;
59 gfx::NativeViewAccessible HitTestSync(int x, int y) override; 59 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
60 gfx::NativeViewAccessible GetFocus() override; 60 gfx::NativeViewAccessible GetFocus() override;
61 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; 61 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
62 bool AccessibilityPerformAction(const ui::AXActionData& data) override; 62 bool AccessibilityPerformAction(const ui::AXActionData& data) override;
63 void DoDefaultAction() override; 63 void DoDefaultAction() override;
64 64
65 // WidgetObserver 65 // WidgetObserver
66 void OnWidgetDestroying(Widget* widget) override; 66 void OnWidgetDestroying(Widget* widget) override;
67 67
68 Widget* parent_widget() const { return parent_widget_; } 68 Widget* parent_widget() const { return parent_widget_; }
69 void SetParentWidget(Widget* parent_widget); 69 void SetParentWidget(Widget* parent_widget);
70 70
71 protected: 71 protected:
72 NativeViewAccessibility(View* view); 72 NativeViewAccessibility(View* view);
73 ~NativeViewAccessibility() override;
74 73
75 // Weak. Owns this. 74 // Weak. Owns this.
76 View* view_; 75 View* view_;
77 76
78 // Weak. Uses WidgetObserver to clear. This is set on the root view for 77 // Weak. Uses WidgetObserver to clear. This is set on the root view for
79 // a widget that's owned by another widget, so we can walk back up the 78 // a widget that's owned by another widget, so we can walk back up the
80 // tree. 79 // tree.
81 Widget* parent_widget_; 80 Widget* parent_widget_;
82 81
83 private: 82 private:
83 // A static map from every View to its associated NativeViewAccessibility.
84 typedef std::map<View*, NativeViewAccessibility*> NativeViewAccessibilityMap;
tapted 2017/01/11 18:27:39 can this (and the <map> #include) move into the .c
Patti Lor 2017/02/21 03:29:16 Deleted as no longer needed :) Thanks for your sug
85
86 // Creates new platform-specific NativeViewAccessibility subclass instances.
87 static NativeViewAccessibility* Create(View* view);
88
84 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); 89 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
85 90
86 // We own this, but it is reference-counted on some platforms so we can't use 91 // We own this, but it is reference-counted on some platforms so we can't use
87 // a scoped_ptr. It is dereferenced in the destructor. 92 // a scoped_ptr. It is dereferenced in the destructor.
88 ui::AXPlatformNode* ax_node_; 93 ui::AXPlatformNode* ax_node_;
89 94
90 ui::AXNodeData data_; 95 ui::AXNodeData data_;
91 96
92 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); 97 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility);
93 }; 98 };
94 99
95 } // namespace views 100 } // namespace views
96 101
97 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 102 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698