OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AX_NODE_DATA_H_ | 5 #ifndef UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
6 #define UI_ACCESSIBILITY_AX_NODE_DATA_H_ | 6 #define UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
13 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
14 #include "ui/accessibility/ax_enums.h" | 16 #include "ui/accessibility/ax_enums.h" |
15 #include "ui/accessibility/ax_export.h" | 17 #include "ui/accessibility/ax_export.h" |
16 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
17 | 19 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 const std::string& GetStringAttribute(AXStringAttribute attribute) const; | 58 const std::string& GetStringAttribute(AXStringAttribute attribute) const; |
57 bool GetStringAttribute(AXStringAttribute attribute, | 59 bool GetStringAttribute(AXStringAttribute attribute, |
58 std::string* value) const; | 60 std::string* value) const; |
59 | 61 |
60 bool GetString16Attribute(AXStringAttribute attribute, | 62 bool GetString16Attribute(AXStringAttribute attribute, |
61 base::string16* value) const; | 63 base::string16* value) const; |
62 base::string16 GetString16Attribute( | 64 base::string16 GetString16Attribute( |
63 AXStringAttribute attribute) const; | 65 AXStringAttribute attribute) const; |
64 | 66 |
65 bool HasIntListAttribute(AXIntListAttribute attribute) const; | 67 bool HasIntListAttribute(AXIntListAttribute attribute) const; |
66 const std::vector<int32>& GetIntListAttribute( | 68 const std::vector<int32_t>& GetIntListAttribute( |
67 AXIntListAttribute attribute) const; | 69 AXIntListAttribute attribute) const; |
68 bool GetIntListAttribute(AXIntListAttribute attribute, | 70 bool GetIntListAttribute(AXIntListAttribute attribute, |
69 std::vector<int32>* value) const; | 71 std::vector<int32_t>* value) const; |
70 | 72 |
71 bool GetHtmlAttribute(const char* attr, base::string16* value) const; | 73 bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
72 bool GetHtmlAttribute(const char* attr, std::string* value) const; | 74 bool GetHtmlAttribute(const char* attr, std::string* value) const; |
73 | 75 |
74 // Setting accessibility attributes. | 76 // Setting accessibility attributes. |
75 void AddStringAttribute(AXStringAttribute attribute, | 77 void AddStringAttribute(AXStringAttribute attribute, |
76 const std::string& value); | 78 const std::string& value); |
77 void AddIntAttribute(AXIntAttribute attribute, int value); | 79 void AddIntAttribute(AXIntAttribute attribute, int value); |
78 void AddFloatAttribute(AXFloatAttribute attribute, float value); | 80 void AddFloatAttribute(AXFloatAttribute attribute, float value); |
79 void AddBoolAttribute(AXBoolAttribute attribute, bool value); | 81 void AddBoolAttribute(AXBoolAttribute attribute, bool value); |
80 void AddIntListAttribute(AXIntListAttribute attribute, | 82 void AddIntListAttribute(AXIntListAttribute attribute, |
81 const std::vector<int32>& value); | 83 const std::vector<int32_t>& value); |
82 | 84 |
83 // Convenience functions, mainly for writing unit tests. | 85 // Convenience functions, mainly for writing unit tests. |
84 // Equivalent to AddStringAttribute(ATTR_NAME, name). | 86 // Equivalent to AddStringAttribute(ATTR_NAME, name). |
85 void SetName(const std::string& name); | 87 void SetName(const std::string& name); |
86 // Equivalent to AddStringAttribute(ATTR_VALUE, value). | 88 // Equivalent to AddStringAttribute(ATTR_VALUE, value). |
87 void SetValue(const std::string& value); | 89 void SetValue(const std::string& value); |
88 | 90 |
89 // Return a string representation of this data, for debugging. | 91 // Return a string representation of this data, for debugging. |
90 virtual std::string ToString() const; | 92 virtual std::string ToString() const; |
91 | 93 |
92 bool IsRoot() const; | 94 bool IsRoot() const; |
93 void SetRoot(); | 95 void SetRoot(); |
94 | 96 |
95 // This is a simple serializable struct. All member variables should be | 97 // This is a simple serializable struct. All member variables should be |
96 // public and copyable. | 98 // public and copyable. |
97 int32 id; | 99 int32_t id; |
98 AXRole role; | 100 AXRole role; |
99 uint32 state; | 101 uint32_t state; |
100 gfx::Rect location; | 102 gfx::Rect location; |
101 std::vector<std::pair<AXStringAttribute, std::string> > string_attributes; | 103 std::vector<std::pair<AXStringAttribute, std::string> > string_attributes; |
102 std::vector<std::pair<AXIntAttribute, int32> > int_attributes; | 104 std::vector<std::pair<AXIntAttribute, int32_t>> int_attributes; |
103 std::vector<std::pair<AXFloatAttribute, float> > float_attributes; | 105 std::vector<std::pair<AXFloatAttribute, float> > float_attributes; |
104 std::vector<std::pair<AXBoolAttribute, bool> > bool_attributes; | 106 std::vector<std::pair<AXBoolAttribute, bool> > bool_attributes; |
105 std::vector<std::pair<AXIntListAttribute, std::vector<int32> > > | 107 std::vector<std::pair<AXIntListAttribute, std::vector<int32_t>>> |
106 intlist_attributes; | 108 intlist_attributes; |
107 base::StringPairs html_attributes; | 109 base::StringPairs html_attributes; |
108 std::vector<int32> child_ids; | 110 std::vector<int32_t> child_ids; |
109 }; | 111 }; |
110 | 112 |
111 } // namespace ui | 113 } // namespace ui |
112 | 114 |
113 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ | 115 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
OLD | NEW |