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 <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 Loading... | |
| 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); |
| 40 | 42 |
| 41 gfx::NativeViewAccessible GetNativeObject(); | 43 gfx::NativeViewAccessible GetNativeObject(); |
| 42 | 44 |
| 43 // Call Destroy rather than deleting this, because the subclass may | 45 // Call Destroy rather than deleting this, because the subclass may |
| 44 // use reference counting. | 46 // use reference counting. |
| 45 virtual void Destroy(); | 47 virtual void Destroy(); |
| 46 | 48 |
| 47 void NotifyAccessibilityEvent(ui::AXEvent event_type); | 49 void NotifyAccessibilityEvent(ui::AXEvent event_type); |
| 48 | 50 |
| 49 // Focuses or unfocuses a View. | 51 // Focuses or unfocuses a View. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 74 | 76 |
| 75 // Weak. Owns this. | 77 // Weak. Owns this. |
| 76 View* view_; | 78 View* view_; |
| 77 | 79 |
| 78 // Weak. Uses WidgetObserver to clear. This is set on the root view for | 80 // 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 | 81 // a widget that's owned by another widget, so we can walk back up the |
| 80 // tree. | 82 // tree. |
| 81 Widget* parent_widget_; | 83 Widget* parent_widget_; |
| 82 | 84 |
| 83 private: | 85 private: |
| 86 // A static map of all the Views with an associated NativeViewAccessibility. | |
|
dmazzoni
2016/12/28 18:02:35
Perhaps:
// A static map from every View to its a
Patti Lor
2017/01/11 02:01:48
Done.
| |
| 87 typedef std::map<View*, NativeViewAccessibility*> NativeViewAccessibilityMap; | |
| 88 static NativeViewAccessibilityMap* GetNativeViewAccessibilityMap(); | |
| 89 | |
| 90 // Creates new platform-specific NativeViewAccessibility subclass instances. | |
| 91 static NativeViewAccessibility* CreateNewNativeViewAccessibilityImpl( | |
|
tapted
2016/12/22 02:56:36
Can we call this just `Create` still? (Also - I th
Patti Lor
2017/01/11 02:01:48
Renamed, but kept this returning a raw ptr as disc
| |
| 92 View* view); | |
| 93 | |
| 84 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); | 94 void PopulateChildWidgetVector(std::vector<Widget*>* result_child_widgets); |
| 85 | 95 |
| 86 // We own this, but it is reference-counted on some platforms so we can't use | 96 // 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. | 97 // a scoped_ptr. It is dereferenced in the destructor. |
| 88 ui::AXPlatformNode* ax_node_; | 98 ui::AXPlatformNode* ax_node_; |
| 89 | 99 |
| 90 ui::AXNodeData data_; | 100 ui::AXNodeData data_; |
| 91 | 101 |
| 92 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); | 102 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); |
| 93 }; | 103 }; |
| 94 | 104 |
| 95 } // namespace views | 105 } // namespace views |
| 96 | 106 |
| 97 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ | 107 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ |
| OLD | NEW |