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/accessibility/ax_node_data.h" | 10 #include "ui/gfx/geometry/rect.h" |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
13 | 14 |
14 class AXPlatformNodeDelegate; | 15 class AXPlatformNodeDelegate; |
15 | 16 |
16 class AX_EXPORT AXPlatformNode { | 17 class AX_EXPORT AXPlatformNode { |
17 public: | 18 public: |
18 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); | 19 static AXPlatformNode* Create(AXPlatformNodeDelegate* delegate); |
19 virtual ~AXPlatformNode(); | 20 virtual ~AXPlatformNode(); |
20 virtual void Detach(); | 21 virtual void Detach(); |
21 | 22 |
22 virtual gfx::NativeViewAccessible GetNativeViewAccessible(); | 23 virtual gfx::NativeViewAccessible GetNativeViewAccessible() = 0; |
23 | 24 |
24 AXPlatformNode* NextSibling(); | 25 AXRole GetRole() const; |
dmazzoni
2014/07/29 06:35:14
I don't want these to be part of the public interf
| |
25 AXPlatformNode* PreviousSibling(); | 26 gfx::Rect GetBoundsInScreen() const; |
27 | |
28 // Get the parent of the node unless it's the root, then it returns NULL. | |
29 gfx::NativeViewAccessible GetParent(); | |
30 | |
31 // Get the number of children of this node. | |
32 int GetChildCount(); | |
33 | |
34 // Get the child of a node from [0...GetChildCount() - 1] | |
35 gfx::NativeViewAccessible ChildAtIndex(int index); | |
26 | 36 |
27 protected: | 37 protected: |
28 AXPlatformNode(); | 38 AXPlatformNode(); |
29 | |
30 virtual void Init(AXPlatformNodeDelegate* delegate); | 39 virtual void Init(AXPlatformNodeDelegate* delegate); |
31 | 40 |
32 bool IsAncestor | |
33 | |
34 // Accessing accessibility attributes: | |
35 // | |
36 // There are dozens of possible attributes for an accessibility node, | |
37 // but only a few tend to apply to any one object, so we store them | |
38 // in sparse arrays of <attribute id, attribute value> pairs, organized | |
39 // by type (bool, int, float, string, int list). | |
40 // | |
41 // There are three accessors for each type of attribute: one that returns | |
42 // true if the attribute is present and false if not, one that takes a | |
43 // pointer argument and returns true if the attribute is present (if you | |
44 // need to distinguish between the default value and a missing attribute), | |
45 // and another that returns the default value for that type if the | |
46 // attribute is not present. In addition, strings can be returned as | |
47 // either std::string or base::string16, for convenience. | |
48 | |
49 bool HasBoolAttribute(ui::AXBoolAttribute attr) const; | |
50 bool GetBoolAttribute(ui::AXBoolAttribute attr) const; | |
51 bool GetBoolAttribute(ui::AXBoolAttribute attr, bool* value) const; | |
52 | |
53 bool HasFloatAttribute(ui::AXFloatAttribute attr) const; | |
54 float GetFloatAttribute(ui::AXFloatAttribute attr) const; | |
55 bool GetFloatAttribute(ui::AXFloatAttribute attr, float* value) const; | |
56 | |
57 bool HasIntAttribute(ui::AXIntAttribute attribute) const; | |
58 int GetIntAttribute(ui::AXIntAttribute attribute) const; | |
59 bool GetIntAttribute(ui::AXIntAttribute attribute, int* value) const; | |
60 | |
61 bool HasStringAttribute( | |
62 ui::AXStringAttribute attribute) const; | |
63 const std::string& GetStringAttribute(ui::AXStringAttribute attribute) const; | |
64 bool GetStringAttribute(ui::AXStringAttribute attribute, | |
65 std::string* value) const; | |
66 | |
67 bool GetString16Attribute(ui::AXStringAttribute attribute, | |
68 base::string16* value) const; | |
69 base::string16 GetString16Attribute( | |
70 ui::AXStringAttribute attribute) const; | |
71 | |
72 bool HasIntListAttribute(ui::AXIntListAttribute attribute) const; | |
73 const std::vector<int32>& GetIntListAttribute( | |
74 ui::AXIntListAttribute attribute) const; | |
75 bool GetIntListAttribute(ui::AXIntListAttribute attribute, | |
76 std::vector<int32>* value) const; | |
77 | |
78 // Retrieve the value of a html attribute from the attribute map and | |
79 // returns true if found. | |
80 bool GetHtmlAttribute(const char* attr, base::string16* value) const; | |
81 bool GetHtmlAttribute(const char* attr, std::string* value) const; | |
82 | |
83 AXPlatformNodeDelegate* delegate_; | 41 AXPlatformNodeDelegate* delegate_; |
84 }; | 42 }; |
85 | 43 |
86 } // namespace ui | 44 } // namespace ui |
87 | 45 |
88 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ | 46 #endif // UI_ACCESSIBILITY_PLATFORM_AX_PLATFORM_NODE_H_ |
OLD | NEW |