| 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "ui/accessibility/ax_enums.h" | 9 #include "ui/accessibility/ax_enums.h" |
| 10 #include "ui/accessibility/ax_export.h" | 10 #include "ui/accessibility/ax_export.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 // Create an appropriate platform-specific instance. The delegate owns the | 40 // Create an appropriate platform-specific instance. The delegate owns the |
| 41 // AXPlatformNode instance (or manages its lifecycle in some other way). | 41 // AXPlatformNode instance (or manages its lifecycle in some other way). |
| 42 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); | 42 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); |
| 43 | 43 |
| 44 // Cast a gfx::NativeViewAccessible to an AXPlatformNode if it is one, | 44 // Cast a gfx::NativeViewAccessible to an AXPlatformNode if it is one, |
| 45 // or return NULL if it's not an instance of this class. | 45 // or return NULL if it's not an instance of this class. |
| 46 static AXPlatformNode* FromNativeViewAccessible( | 46 static AXPlatformNode* FromNativeViewAccessible( |
| 47 gfx::NativeViewAccessible accessible); | 47 gfx::NativeViewAccessible accessible); |
| 48 | 48 |
| 49 // Each platform accessibility object has a unique id that's guaranteed |
| 50 // to be a positive number. (It's stored in an int32_t as opposed to |
| 51 // uint32_t because some platforms want to negate it, so we want to ensure |
| 52 // the range is below the signed int max.) This can be used when the |
| 53 // id has to be unique across multiple frames, since node ids are |
| 54 // only unique within one tree. |
| 55 static int32_t GetNextUniqueId(); |
| 56 |
| 49 // Call Destroy rather than deleting this, because the subclass may | 57 // Call Destroy rather than deleting this, because the subclass may |
| 50 // use reference counting. | 58 // use reference counting. |
| 51 virtual void Destroy() = 0; | 59 virtual void Destroy(); |
| 52 | 60 |
| 53 // Get the platform-specific accessible object type for this instance. | 61 // Get the platform-specific accessible object type for this instance. |
| 54 // On some platforms this is just a type cast, on others it may be a | 62 // On some platforms this is just a type cast, on others it may be a |
| 55 // wrapper object or handle. | 63 // wrapper object or handle. |
| 56 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; | 64 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; |
| 57 | 65 |
| 58 // Fire a platform-specific notification that an event has occurred on | 66 // Fire a platform-specific notification that an event has occurred on |
| 59 // this object. | 67 // this object. |
| 60 virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) = 0; | 68 virtual void NotifyAccessibilityEvent(ui::AXEvent event_type) = 0; |
| 61 | 69 |
| 62 // Return this object's delegate. | 70 // Return this object's delegate. |
| 63 virtual AXPlatformNodeDelegate* GetDelegate() const = 0; | 71 virtual AXPlatformNodeDelegate* GetDelegate() const = 0; |
| 64 | 72 |
| 65 protected: | 73 protected: |
| 66 AXPlatformNode(); | 74 AXPlatformNode(); |
| 67 virtual ~AXPlatformNode(); | 75 virtual ~AXPlatformNode(); |
| 76 |
| 77 AXPlatformNode* GetFromUniqueId(int32_t unique_id); |
| 78 |
| 79 int32_t unique_id_; |
| 68 }; | 80 }; |
| 69 | 81 |
| 70 } // namespace ui | 82 } // namespace ui |
| 71 | 83 |
| 72 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ | 84 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ |
| OLD | NEW |