OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ | 5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ |
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ | 6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ |
7 | 7 |
| 8 #include "ui/accessibility/ax_enums.h" |
8 #include "ui/accessibility/ax_export.h" | 9 #include "ui/accessibility/ax_export.h" |
9 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
10 | 11 |
11 namespace ui { | 12 namespace ui { |
12 | 13 |
13 class AXPlatformNodeDelegate; | 14 class AXPlatformNodeDelegate; |
14 | 15 |
| 16 // AXPlatformNode is the abstract base class for an implementation of |
| 17 // native accessibility APIs on supported platforms (e.g. Windows, Mac OS X). |
| 18 // An object that wants to be accessible can derive from AXPlatformNodeDelegate |
| 19 // and then call AXPlatformNode::Create. The delegate implementation should |
| 20 // own the AXPlatformNode instance (or otherwise manage its lifecycle). |
15 class AX_EXPORT AXPlatformNode { | 21 class AX_EXPORT AXPlatformNode { |
16 public: | 22 public: |
17 // Create a platform appropriate instance. | 23 // Create an appropriate platform-specific instance. The delegate owns the |
| 24 // AXPlatformNode instance (or manages its lifecycle in some other way). |
18 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); | 25 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); |
19 | 26 |
| 27 // Cast a gfx::NativeViewAccessible to an AXPlatformNode if it is one, |
| 28 // or return NULL if it's not an instance of this class. |
| 29 static AXPlatformNode* FromNativeViewAccessible( |
| 30 gfx::NativeViewAccessible accessible); |
| 31 |
20 // Call Destroy rather than deleting this, because the subclass may | 32 // Call Destroy rather than deleting this, because the subclass may |
21 // use reference counting. | 33 // use reference counting. |
22 virtual void Destroy() = 0; | 34 virtual void Destroy() = 0; |
23 | 35 |
| 36 // Get the platform-specific accessible object type for this instance. |
| 37 // On some platforms this is just a type cast, on others it may be a |
| 38 // wrapper object or handle. |
24 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; | 39 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; |
25 | 40 |
| 41 // Fire a platform-specific notification that an event has occurred on |
| 42 // this object. |
| 43 virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) = 0; |
| 44 |
26 protected: | 45 protected: |
27 AXPlatformNode(); | 46 AXPlatformNode(); |
28 virtual ~AXPlatformNode(); | 47 virtual ~AXPlatformNode(); |
29 }; | 48 }; |
30 | 49 |
31 } // namespace ui | 50 } // namespace ui |
32 | 51 |
33 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ | 52 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ |
OLD | NEW |