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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 base::string16* value) const; | 79 base::string16* value) const; |
80 base::string16 GetString16Attribute( | 80 base::string16 GetString16Attribute( |
81 AXStringAttribute attribute) const; | 81 AXStringAttribute attribute) const; |
82 | 82 |
83 bool HasIntListAttribute(AXIntListAttribute attribute) const; | 83 bool HasIntListAttribute(AXIntListAttribute attribute) const; |
84 const std::vector<int32_t>& GetIntListAttribute( | 84 const std::vector<int32_t>& GetIntListAttribute( |
85 AXIntListAttribute attribute) const; | 85 AXIntListAttribute attribute) const; |
86 bool GetIntListAttribute(AXIntListAttribute attribute, | 86 bool GetIntListAttribute(AXIntListAttribute attribute, |
87 std::vector<int32_t>* value) const; | 87 std::vector<int32_t>* value) const; |
88 | 88 |
| 89 bool HasStringListAttribute(AXStringListAttribute attribute) const; |
| 90 const std::vector<std::string>& GetStringListAttribute( |
| 91 AXStringListAttribute attribute) const; |
| 92 bool GetStringListAttribute(AXStringListAttribute attribute, |
| 93 std::vector<std::string>* value) const; |
| 94 |
89 bool GetHtmlAttribute(const char* attr, base::string16* value) const; | 95 bool GetHtmlAttribute(const char* attr, base::string16* value) const; |
90 bool GetHtmlAttribute(const char* attr, std::string* value) const; | 96 bool GetHtmlAttribute(const char* attr, std::string* value) const; |
91 | 97 |
92 // Setting accessibility attributes. | 98 // Setting accessibility attributes. |
93 void AddStringAttribute(AXStringAttribute attribute, | 99 void AddStringAttribute(AXStringAttribute attribute, |
94 const std::string& value); | 100 const std::string& value); |
95 void AddIntAttribute(AXIntAttribute attribute, int value); | 101 void AddIntAttribute(AXIntAttribute attribute, int value); |
96 void AddFloatAttribute(AXFloatAttribute attribute, float value); | 102 void AddFloatAttribute(AXFloatAttribute attribute, float value); |
97 void AddBoolAttribute(AXBoolAttribute attribute, bool value); | 103 void AddBoolAttribute(AXBoolAttribute attribute, bool value); |
98 void AddIntListAttribute(AXIntListAttribute attribute, | 104 void AddIntListAttribute(AXIntListAttribute attribute, |
99 const std::vector<int32_t>& value); | 105 const std::vector<int32_t>& value); |
| 106 void AddStringListAttribute(AXStringListAttribute attribute, |
| 107 const std::vector<std::string>& value); |
100 | 108 |
101 // Convenience functions, mainly for writing unit tests. | 109 // Convenience functions, mainly for writing unit tests. |
102 // Equivalent to AddStringAttribute(ATTR_NAME, name). | 110 // Equivalent to AddStringAttribute(ATTR_NAME, name). |
103 void SetName(const std::string& name); | 111 void SetName(const std::string& name); |
104 void SetName(const base::string16& name); | 112 void SetName(const base::string16& name); |
105 // Equivalent to AddStringAttribute(ATTR_VALUE, value). | 113 // Equivalent to AddStringAttribute(ATTR_VALUE, value). |
106 void SetValue(const std::string& value); | 114 void SetValue(const std::string& value); |
107 void SetValue(const base::string16& value); | 115 void SetValue(const base::string16& value); |
108 | 116 |
109 // Set or check bits in |state|. | 117 // Set or check bits in |state|. |
110 bool HasState(ui::AXState state_flag) const; | 118 bool HasState(ui::AXState state_flag) const; |
111 void AddState(ui::AXState state_flag); | 119 void AddState(ui::AXState state_flag); |
112 | 120 |
113 // Return a string representation of this data, for debugging. | 121 // Return a string representation of this data, for debugging. |
114 virtual std::string ToString() const; | 122 virtual std::string ToString() const; |
115 | 123 |
116 // As much as possible this should behave as a simple, serializable, | 124 // As much as possible this should behave as a simple, serializable, |
117 // copyable struct. | 125 // copyable struct. |
118 int32_t id; | 126 int32_t id; |
119 AXRole role; | 127 AXRole role; |
120 uint32_t state; | 128 uint32_t state; |
121 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; | 129 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; |
122 std::vector<std::pair<AXIntAttribute, int32_t>> int_attributes; | 130 std::vector<std::pair<AXIntAttribute, int32_t>> int_attributes; |
123 std::vector<std::pair<AXFloatAttribute, float>> float_attributes; | 131 std::vector<std::pair<AXFloatAttribute, float>> float_attributes; |
124 std::vector<std::pair<AXBoolAttribute, bool>> bool_attributes; | 132 std::vector<std::pair<AXBoolAttribute, bool>> bool_attributes; |
125 std::vector<std::pair<AXIntListAttribute, std::vector<int32_t>>> | 133 std::vector<std::pair<AXIntListAttribute, std::vector<int32_t>>> |
126 intlist_attributes; | 134 intlist_attributes; |
| 135 std::vector<std::pair<AXStringListAttribute, std::vector<std::string>>> |
| 136 stringlist_attributes; |
127 base::StringPairs html_attributes; | 137 base::StringPairs html_attributes; |
128 std::vector<int32_t> child_ids; | 138 std::vector<int32_t> child_ids; |
129 | 139 |
130 // TODO(dmazzoni): replace the following three members with a single | 140 // TODO(dmazzoni): replace the following three members with a single |
131 // instance of AXRelativeBounds. | 141 // instance of AXRelativeBounds. |
132 | 142 |
133 // The id of an ancestor node in the same AXTree that this object's | 143 // The id of an ancestor node in the same AXTree that this object's |
134 // bounding box is relative to, or -1 if there's no offset container. | 144 // bounding box is relative to, or -1 if there's no offset container. |
135 int offset_container_id; | 145 int offset_container_id; |
136 | 146 |
137 // The relative bounding box of this node. | 147 // The relative bounding box of this node. |
138 gfx::RectF location; | 148 gfx::RectF location; |
139 | 149 |
140 // An additional transform to apply to position this object and its subtree. | 150 // An additional transform to apply to position this object and its subtree. |
141 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform | 151 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform |
142 // takes up a fair amount of space. The assignment operator and copy | 152 // takes up a fair amount of space. The assignment operator and copy |
143 // constructor both make a duplicate of the owned pointer, so it acts more | 153 // constructor both make a duplicate of the owned pointer, so it acts more |
144 // like a member than a pointer. | 154 // like a member than a pointer. |
145 std::unique_ptr<gfx::Transform> transform; | 155 std::unique_ptr<gfx::Transform> transform; |
146 }; | 156 }; |
147 | 157 |
148 } // namespace ui | 158 } // namespace ui |
149 | 159 |
150 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ | 160 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
OLD | NEW |