| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 const std::vector<int32_t>& value); | 99 const std::vector<int32_t>& value); |
| 100 | 100 |
| 101 // Convenience functions, mainly for writing unit tests. | 101 // Convenience functions, mainly for writing unit tests. |
| 102 // Equivalent to AddStringAttribute(ATTR_NAME, name). | 102 // Equivalent to AddStringAttribute(ATTR_NAME, name). |
| 103 void SetName(const std::string& name); | 103 void SetName(const std::string& name); |
| 104 void SetName(const base::string16& name); | 104 void SetName(const base::string16& name); |
| 105 // Equivalent to AddStringAttribute(ATTR_VALUE, value). | 105 // Equivalent to AddStringAttribute(ATTR_VALUE, value). |
| 106 void SetValue(const std::string& value); | 106 void SetValue(const std::string& value); |
| 107 void SetValue(const base::string16& value); | 107 void SetValue(const base::string16& value); |
| 108 | 108 |
| 109 // Set or check bits in |state|. | 109 // Returns true if the given enum bit is 1. |
| 110 bool HasState(ui::AXState state_flag) const; | 110 bool HasState(ui::AXState state_enum) const; |
| 111 void AddState(ui::AXState state_flag); | 111 bool HasAction(ui::AXAction state_enum) const; |
| 112 |
| 113 // Set bits in the given enum's corresponding bitfield. |
| 114 void AddState(ui::AXState state_enum); |
| 115 void AddAction(ui::AXAction action_enum); |
| 112 | 116 |
| 113 // Return a string representation of this data, for debugging. | 117 // Return a string representation of this data, for debugging. |
| 114 virtual std::string ToString() const; | 118 virtual std::string ToString() const; |
| 115 | 119 |
| 116 // As much as possible this should behave as a simple, serializable, | 120 // As much as possible this should behave as a simple, serializable, |
| 117 // copyable struct. | 121 // copyable struct. |
| 118 int32_t id; | 122 int32_t id; |
| 119 AXRole role; | 123 AXRole role; |
| 120 uint32_t state; | 124 uint32_t state; |
| 125 uint32_t actions; |
| 121 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; | 126 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; |
| 122 std::vector<std::pair<AXIntAttribute, int32_t>> int_attributes; | 127 std::vector<std::pair<AXIntAttribute, int32_t>> int_attributes; |
| 123 std::vector<std::pair<AXFloatAttribute, float>> float_attributes; | 128 std::vector<std::pair<AXFloatAttribute, float>> float_attributes; |
| 124 std::vector<std::pair<AXBoolAttribute, bool>> bool_attributes; | 129 std::vector<std::pair<AXBoolAttribute, bool>> bool_attributes; |
| 125 std::vector<std::pair<AXIntListAttribute, std::vector<int32_t>>> | 130 std::vector<std::pair<AXIntListAttribute, std::vector<int32_t>>> |
| 126 intlist_attributes; | 131 intlist_attributes; |
| 127 base::StringPairs html_attributes; | 132 base::StringPairs html_attributes; |
| 128 std::vector<int32_t> child_ids; | 133 std::vector<int32_t> child_ids; |
| 129 | 134 |
| 130 // TODO(dmazzoni): replace the following three members with a single | 135 // TODO(dmazzoni): replace the following three members with a single |
| (...skipping 10 matching lines...) Expand all Loading... |
| 141 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform | 146 // 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 | 147 // 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 | 148 // constructor both make a duplicate of the owned pointer, so it acts more |
| 144 // like a member than a pointer. | 149 // like a member than a pointer. |
| 145 std::unique_ptr<gfx::Transform> transform; | 150 std::unique_ptr<gfx::Transform> transform; |
| 146 }; | 151 }; |
| 147 | 152 |
| 148 } // namespace ui | 153 } // namespace ui |
| 149 | 154 |
| 150 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ | 155 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
| OLD | NEW |