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
3 // found in the LICENSE file.
5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_
8 #include "ui/accessibility/ax_enums.h"
9 #include "ui/accessibility/ax_export.h"
10 #include "ui/gfx/native_widget_types.h"
14 class AXPlatformNodeDelegate
;
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).
21 class AX_EXPORT AXPlatformNode
{
23 // Create an appropriate platform-specific instance. The delegate owns the
24 // AXPlatformNode instance (or manages its lifecycle in some other way).
25 static AXPlatformNode
* Create(AXPlatformNodeDelegate
* delegate
);
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
);
32 // Call Destroy rather than deleting this, because the subclass may
33 // use reference counting.
34 virtual void Destroy() = 0;
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.
39 virtual gfx::NativeViewAccessible
GetNativeViewAccessible() = 0;
41 // Fire a platform-specific notification that an event has occurred on
43 virtual void NotifyAccessibilityEvent(ui::AXEvent event_type
) = 0;
45 // Return this object's delegate.
46 virtual AXPlatformNodeDelegate
* GetDelegate() const = 0;
50 virtual ~AXPlatformNode();
55 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_