Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 static std::unique_ptr<NativeViewAccessibility> Create(View* view); | 45 // A method for View to create a new NativeViewAccessibility instance for the |
| 46 // given View. To retrieve the instance for |view|, use GetForView() instead. | |
| 47 static std::unique_ptr<NativeViewAccessibility> CreateForView(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); |
| 55 | 57 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 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: |
| 93 // Creates new platform-specific NativeViewAccessibility subclass instances. | |
| 94 static NativeViewAccessibility* Create(View* view); | |
|
tapted
2017/03/06 01:43:09
Do we need this? (i.e. Why can't we use the curren
Patti Lor
2017/03/13 03:03:26
You're right, it looks like we don't need this any
| |
| 95 | |
| 87 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); | 96 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); |
| 88 | 97 |
| 89 // We own this, but it is reference-counted on some platforms so we can't use | 98 // 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. | 99 // a scoped_ptr. It is dereferenced in the destructor. |
| 91 ui::AXPlatformNode* ax_node_; | 100 ui::AXPlatformNode* ax_node_; |
| 92 | 101 |
| 93 ui::AXNodeData data_; | 102 ui::AXNodeData data_; |
| 94 | 103 |
| 95 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); | 104 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); |
| 96 }; | 105 }; |
| 97 | 106 |
| 98 } // namespace views | 107 } // namespace views |
| 99 | 108 |
| 100 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ | 109 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ |
| OLD | NEW |