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

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

Issue 2715543003: Views a11y: Implement AXPlatformNode::FromNativeViewAccessible on all platforms. (Closed)
Patch Set: Make GetForView protected. Created 3 years, 9 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
« no previous file with comments | « ui/gfx/native_widget_types.h ('k') | ui/views/accessibility/native_view_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/accessibility/ax_action_data.h" 10 #include "ui/accessibility/ax_action_data.h"
(...skipping 22 matching lines...) Expand all
33 33
34 namespace views { 34 namespace views {
35 35
36 class View; 36 class View;
37 class Widget; 37 class Widget;
38 38
39 class VIEWS_EXPORT NativeViewAccessibility 39 class VIEWS_EXPORT NativeViewAccessibility
40 : public ui::AXPlatformNodeDelegate, 40 : public ui::AXPlatformNodeDelegate,
41 public WidgetObserver { 41 public WidgetObserver {
42 public: 42 public:
43 static NativeViewAccessibility* Create(View* view); 43 // A method for View to create a new NativeViewAccessibility instance for the
44 // given View. To retrieve the instance for |view|, use GetForView() instead.
45 static std::unique_ptr<NativeViewAccessibility> CreateForView(View* view);
46
47 ~NativeViewAccessibility() override;
44 48
45 gfx::NativeViewAccessible GetNativeObject(); 49 gfx::NativeViewAccessible GetNativeObject();
46 50
47 // Call Destroy rather than deleting this, because the subclass may
48 // use reference counting.
49 virtual void Destroy();
50
51 void NotifyAccessibilityEvent(ui::AXEvent event_type); 51 void NotifyAccessibilityEvent(ui::AXEvent event_type);
52 52
53 // Focuses or unfocuses a View. 53 // Focuses or unfocuses a View.
54 bool SetFocused(bool focused); 54 bool SetFocused(bool focused);
55 55
56 // ui::AXPlatformNodeDelegate 56 // ui::AXPlatformNodeDelegate
57 const ui::AXNodeData& GetData() override; 57 const ui::AXNodeData& GetData() override;
58 int GetChildCount() override; 58 int GetChildCount() override;
59 gfx::NativeViewAccessible ChildAtIndex(int index) override; 59 gfx::NativeViewAccessible ChildAtIndex(int index) override;
60 gfx::NativeWindow GetTopLevelWidget() override; 60 gfx::NativeWindow GetTopLevelWidget() override;
61 gfx::NativeViewAccessible GetParent() override; 61 gfx::NativeViewAccessible GetParent() override;
62 gfx::Vector2d GetGlobalCoordinateOffset() override; 62 gfx::Vector2d GetGlobalCoordinateOffset() override;
63 gfx::NativeViewAccessible HitTestSync(int x, int y) override; 63 gfx::NativeViewAccessible HitTestSync(int x, int y) override;
64 gfx::NativeViewAccessible GetFocus() override; 64 gfx::NativeViewAccessible GetFocus() override;
65 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override; 65 gfx::AcceleratedWidget GetTargetForNativeAccessibilityEvent() override;
66 bool AccessibilityPerformAction(const ui::AXActionData& data) override; 66 bool AccessibilityPerformAction(const ui::AXActionData& data) override;
67 void DoDefaultAction() override; 67 void DoDefaultAction() override;
68 68
69 // WidgetObserver 69 // WidgetObserver
70 void OnWidgetDestroying(Widget* widget) override; 70 void OnWidgetDestroying(Widget* widget) override;
71 71
72 Widget* parent_widget() const { return parent_widget_; } 72 Widget* parent_widget() const { return parent_widget_; }
73 void SetParentWidget(Widget* parent_widget); 73 void SetParentWidget(Widget* parent_widget);
74 74
75 protected: 75 protected:
76 NativeViewAccessibility(View* view); 76 NativeViewAccessibility(View* view);
77 ~NativeViewAccessibility() override; 77
78 // Retrieves the NativeViewAccessibility instance for the given View. This
79 // invokes View::GetNativeViewAccessible() to ensure it exists.
80 static NativeViewAccessibility* GetForView(View* view);
tapted 2017/02/27 05:37:48 Hm - this is the controversial bit that I was hopi
Patti Lor 2017/03/03 02:55:54 Done.
81
82 // Retrieves the gfx::NativeViewAccessibility for |view_|'s Widget/Rootview.
83 virtual gfx::NativeViewAccessible GetNativeViewAccessibleForWidget();
78 84
79 // Weak. Owns this. 85 // Weak. Owns this.
80 View* view_; 86 View* view_;
81 87
82 // Weak. Uses WidgetObserver to clear. This is set on the root view for 88 // Weak. Uses WidgetObserver to clear. This is set on the root view for
83 // a widget that's owned by another widget, so we can walk back up the 89 // a widget that's owned by another widget, so we can walk back up the
84 // tree. 90 // tree.
85 Widget* parent_widget_; 91 Widget* parent_widget_;
86 92
87 private: 93 private:
94 // Creates new platform-specific NativeViewAccessibility subclass instances.
95 static NativeViewAccessibility* Create(View* view);
96
88 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); 97 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
89 98
90 // We own this, but it is reference-counted on some platforms so we can't use 99 // We own this, but it is reference-counted on some platforms so we can't use
91 // a scoped_ptr. It is dereferenced in the destructor. 100 // a scoped_ptr. It is dereferenced in the destructor.
92 ui::AXPlatformNode* ax_node_; 101 ui::AXPlatformNode* ax_node_;
93 102
94 ui::AXNodeData data_; 103 ui::AXNodeData data_;
95 104
96 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); 105 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility);
97 }; 106 };
98 107
99 } // namespace views 108 } // namespace views
100 109
101 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 110 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « ui/gfx/native_widget_types.h ('k') | ui/views/accessibility/native_view_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698