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_BASE_H_ | 5 #ifndef UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ |
6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ | 6 #define UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ |
7 | 7 |
8 #include "ui/accessibility/ax_enums.h" | 8 #include "ui/accessibility/ax_enums.h" |
9 #include "ui/accessibility/platform/ax_platform_node.h" | 9 #include "ui/accessibility/platform/ax_platform_node.h" |
10 #include "ui/gfx/geometry/rect.h" | 10 #include "ui/gfx/geometry/rect.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 | 14 |
| 15 struct AXNodeData; |
15 class AXPlatformNodeDelegate; | 16 class AXPlatformNodeDelegate; |
16 | 17 |
17 class AXPlatformNodeBase : public AXPlatformNode { | 18 class AXPlatformNodeBase : public AXPlatformNode { |
18 public: | 19 public: |
19 virtual void Init(AXPlatformNodeDelegate* delegate); | 20 virtual void Init(AXPlatformNodeDelegate* delegate); |
20 | 21 |
21 // These are simple wrappers to our delegate. | 22 // These are simple wrappers to our delegate. |
22 AXRole GetRole() const; | 23 const AXNodeData& GetData() const; |
23 gfx::Rect GetBoundsInScreen() const; | 24 gfx::Rect GetBoundsInScreen() const; |
24 gfx::NativeViewAccessible GetParent(); | 25 gfx::NativeViewAccessible GetParent(); |
25 int GetChildCount(); | 26 int GetChildCount(); |
26 gfx::NativeViewAccessible ChildAtIndex(int index); | 27 gfx::NativeViewAccessible ChildAtIndex(int index); |
| 28 int GetIndexInParent(); |
27 | 29 |
28 // AXPlatformNode | 30 // AXPlatformNode. |
29 void Destroy() override; | 31 void Destroy() override; |
30 gfx::NativeViewAccessible GetNativeViewAccessible() override; | 32 gfx::NativeViewAccessible GetNativeViewAccessible() override; |
31 | 33 |
| 34 // Helpers. |
| 35 AXPlatformNodeBase* GetPreviousSibling(); |
| 36 AXPlatformNodeBase* GetNextSibling(); |
| 37 bool IsDescendant(AXPlatformNodeBase* descendant); |
| 38 |
| 39 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; |
| 40 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; |
| 41 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; |
| 42 |
| 43 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; |
| 44 float GetFloatAttribute(ui::AXFloatAttribute attr) const; |
| 45 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; |
| 46 |
| 47 bool HasIntAttribute(ui::AXIntAttribute attribute) const; |
| 48 int GetIntAttribute(ui::AXIntAttribute attribute) const; |
| 49 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; |
| 50 |
| 51 bool HasStringAttribute( |
| 52 ui::AXStringAttribute attribute) const; |
| 53 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; |
| 54 bool GetStringAttribute(ui::AXStringAttribute attribute, |
| 55 std::string* value) const; |
| 56 bool GetString16Attribute(ui::AXStringAttribute attribute, |
| 57 base::string16* value) const; |
| 58 base::string16 GetString16Attribute( |
| 59 ui::AXStringAttribute attribute) const; |
| 60 |
32 protected: | 61 protected: |
33 AXPlatformNodeBase(); | 62 AXPlatformNodeBase(); |
34 ~AXPlatformNodeBase() override; | 63 ~AXPlatformNodeBase() override; |
35 | 64 |
36 AXPlatformNodeDelegate* delegate_; // Weak. Owns this. | 65 AXPlatformNodeDelegate* delegate_; // Weak. Owns this. |
37 | 66 |
38 private: | 67 private: |
39 DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeBase); | 68 DISALLOW_COPY_AND_ASSIGN(AXPlatformNodeBase); |
40 }; | 69 }; |
41 | 70 |
42 } // namespace ui | 71 } // namespace ui |
43 | 72 |
44 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ | 73 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_BASE_H_ |
OLD | NEW |