| 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" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "ui/accessibility/ax_action_data.h" | 12 #include "ui/accessibility/ax_action_data.h" |
| 13 #include "ui/accessibility/ax_node_data.h" | 13 #include "ui/accessibility/ax_node_data.h" |
| 14 #include "ui/accessibility/platform/ax_platform_node.h" | 14 #include "ui/accessibility/platform/ax_platform_node.h" |
| 15 #include "ui/accessibility/platform/ax_platform_node_delegate.h" | 15 #include "ui/accessibility/platform/ax_platform_node_delegate.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/views/accessibility/native_view_accessibility_base.h" |
| 17 #include "ui/views/views_export.h" | 18 #include "ui/views/views_export.h" |
| 18 #include "ui/views/widget/widget_observer.h" | 19 #include "ui/views/widget/widget_observer.h" |
| 19 | 20 |
| 20 // Set PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL if this platform has a | |
| 21 // specific implementation of NativeViewAccessibility::Create(). | |
| 22 #undef PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL | |
| 23 | |
| 24 #if defined(OS_WIN) | |
| 25 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1 | |
| 26 #endif | |
| 27 | |
| 28 #if defined(OS_MACOSX) | |
| 29 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1 | |
| 30 #endif | |
| 31 | |
| 32 #if defined(OS_LINUX) && defined(USE_X11) && !defined(OS_CHROMEOS) | |
| 33 #define PLATFORM_HAS_NATIVE_VIEW_ACCESSIBILITY_IMPL 1 | |
| 34 #endif | |
| 35 | |
| 36 namespace views { | 21 namespace views { |
| 37 | 22 |
| 38 class View; | 23 class View; |
| 39 class Widget; | 24 class Widget; |
| 40 | 25 |
| 41 class VIEWS_EXPORT NativeViewAccessibility | 26 class VIEWS_EXPORT NativeViewAccessibility : public NativeViewAccessibilityBase, |
| 42 : public ui::AXPlatformNodeDelegate, | 27 public ui::AXPlatformNodeDelegate, |
| 43 public WidgetObserver { | 28 public WidgetObserver { |
| 44 public: | 29 public: |
| 45 static std::unique_ptr<NativeViewAccessibility> Create(View* view); | |
| 46 | |
| 47 ~NativeViewAccessibility() override; | 30 ~NativeViewAccessibility() override; |
| 48 | 31 |
| 49 gfx::NativeViewAccessible GetNativeObject(); | 32 // NativeViewAccessibilityBase: |
| 50 | 33 gfx::NativeViewAccessible GetNativeObject() override; |
| 51 void NotifyAccessibilityEvent(ui::AXEvent event_type); | 34 void NotifyAccessibilityEvent(ui::AXEvent event_type) override; |
| 52 | 35 |
| 53 // Focuses or unfocuses a View. | 36 // Focuses or unfocuses a View. |
| 54 bool SetFocused(bool focused); | 37 bool SetFocused(bool focused); |
| 55 | 38 |
| 56 // ui::AXPlatformNodeDelegate | 39 // ui::AXPlatformNodeDelegate |
| 57 const ui::AXNodeData& GetData() override; | 40 const ui::AXNodeData& GetData() override; |
| 58 int GetChildCount() override; | 41 int GetChildCount() override; |
| 59 gfx::NativeViewAccessible ChildAtIndex(int index) override; | 42 gfx::NativeViewAccessible ChildAtIndex(int index) override; |
| 60 gfx::NativeWindow GetTopLevelWidget() override; | 43 gfx::NativeWindow GetTopLevelWidget() override; |
| 61 gfx::NativeViewAccessible GetParent() override; | 44 gfx::NativeViewAccessible GetParent() override; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 ui::AXPlatformNode* ax_node_; | 74 ui::AXPlatformNode* ax_node_; |
| 92 | 75 |
| 93 ui::AXNodeData data_; | 76 ui::AXNodeData data_; |
| 94 | 77 |
| 95 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); | 78 DISALLOW_COPY_AND_ASSIGN(NativeViewAccessibility); |
| 96 }; | 79 }; |
| 97 | 80 |
| 98 } // namespace views | 81 } // namespace views |
| 99 | 82 |
| 100 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ | 83 #endif // UI_VIEWS_ACCESSIBILITY_NATIVE_VIEW_ACCESSIBILITY_H_ |
| OLD | NEW |