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

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

Issue 2715543003: Views a11y: Implement AXPlatformNode::FromNativeViewAccessible on all platforms. (Closed)
Patch Set: Fix bad rebase. 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
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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 24 matching lines...) Expand all
35 35
36 namespace views { 36 namespace views {
37 37
38 class View; 38 class View;
39 class Widget; 39 class Widget;
40 40
41 class VIEWS_EXPORT NativeViewAccessibility 41 class VIEWS_EXPORT NativeViewAccessibility
42 : public ui::AXPlatformNodeDelegate, 42 : public ui::AXPlatformNodeDelegate,
43 public WidgetObserver { 43 public WidgetObserver {
44 public: 44 public:
45 // A method for View to create a platform-specific NativeViewAccessibility
46 // instance for |view|. To retrieve the instance for |view|, use GetForView().
45 static std::unique_ptr<NativeViewAccessibility> Create(View* view); 47 static std::unique_ptr<NativeViewAccessibility> Create(View* view);
46 48
47 ~NativeViewAccessibility() override; 49 ~NativeViewAccessibility() override;
48 50
49 gfx::NativeViewAccessible GetNativeObject(); 51 gfx::NativeViewAccessible GetNativeObject();
50 52
51 void NotifyAccessibilityEvent(ui::AXEvent event_type); 53 void NotifyAccessibilityEvent(ui::AXEvent event_type);
52 54
53 // Focuses or unfocuses a View. 55 // Focuses or unfocuses a View.
54 bool SetFocused(bool focused); 56 bool SetFocused(bool focused);
(...skipping 13 matching lines...) Expand all
68 70
69 // WidgetObserver 71 // WidgetObserver
70 void OnWidgetDestroying(Widget* widget) override; 72 void OnWidgetDestroying(Widget* widget) override;
71 73
72 Widget* parent_widget() const { return parent_widget_; } 74 Widget* parent_widget() const { return parent_widget_; }
73 void SetParentWidget(Widget* parent_widget); 75 void SetParentWidget(Widget* parent_widget);
74 76
75 protected: 77 protected:
76 explicit NativeViewAccessibility(View* view); 78 explicit NativeViewAccessibility(View* view);
77 79
80 // Retrieves the NativeViewAccessibility instance for the given View. This
81 // invokes View::GetNativeViewAccessible() to ensure it exists.
82 static NativeViewAccessibility* GetForView(View* view);
83
78 // Weak. Owns this. 84 // Weak. Owns this.
79 View* view_; 85 View* view_;
80 86
81 // Weak. Uses WidgetObserver to clear. This is set on the root view for 87 // Weak. Uses WidgetObserver to clear. This is set on the root view for
82 // a widget that's owned by another widget, so we can walk back up the 88 // a widget that's owned by another widget, so we can walk back up the
83 // tree. 89 // tree.
84 Widget* parent_widget_; 90 Widget* parent_widget_;
85 91
86 private: 92 private:
87 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); 93 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets);
88 94
89 // We own this, but it is reference-counted on some platforms so we can't use 95 // We own this, but it is reference-counted on some platforms so we can't use
90 // a scoped_ptr. It is dereferenced in the destructor. 96 // a scoped_ptr. It is dereferenced in the destructor.
91 ui::AXPlatformNode* ax_node_; 97 ui::AXPlatformNode* ax_node_;
92 98
93 ui::AXNodeData data_; 99 ui::AXNodeData data_;
94 100
95 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); 101 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility);
96 }; 102 };
97 103
98 } // namespace views 104 } // namespace views
99 105
100 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ 106 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698