| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 const std::string& value); | 86 const std::string& value); |
| 87 void AddIntAttribute(AXIntAttribute attribute, int value); | 87 void AddIntAttribute(AXIntAttribute attribute, int value); |
| 88 void AddFloatAttribute(AXFloatAttribute attribute, float value); | 88 void AddFloatAttribute(AXFloatAttribute attribute, float value); |
| 89 void AddBoolAttribute(AXBoolAttribute attribute, bool value); | 89 void AddBoolAttribute(AXBoolAttribute attribute, bool value); |
| 90 void AddIntListAttribute(AXIntListAttribute attribute, | 90 void AddIntListAttribute(AXIntListAttribute attribute, |
| 91 const std::vector<int32_t>& value); | 91 const std::vector<int32_t>& value); |
| 92 | 92 |
| 93 // Convenience functions, mainly for writing unit tests. | 93 // Convenience functions, mainly for writing unit tests. |
| 94 // Equivalent to AddStringAttribute(ATTR_NAME, name). | 94 // Equivalent to AddStringAttribute(ATTR_NAME, name). |
| 95 void SetName(const std::string& name); | 95 void SetName(const std::string& name); |
| 96 void SetName(const base::string16& name); |
| 96 // Equivalent to AddStringAttribute(ATTR_VALUE, value). | 97 // Equivalent to AddStringAttribute(ATTR_VALUE, value). |
| 97 void SetValue(const std::string& value); | 98 void SetValue(const std::string& value); |
| 99 void SetValue(const base::string16& value); |
| 100 |
| 101 // Helper to check whether |state_flag| is set in the given |state|. |
| 102 static bool IsFlagSet(uint32_t state, ui::AXState state_flag); |
| 103 |
| 104 // Set or check bits in |state_|. |
| 105 void AddStateFlag(ui::AXState state_flag); |
| 106 bool HasStateFlag(ui::AXState state_flag) const; |
| 98 | 107 |
| 99 // Return a string representation of this data, for debugging. | 108 // Return a string representation of this data, for debugging. |
| 100 virtual std::string ToString() const; | 109 virtual std::string ToString() const; |
| 101 | 110 |
| 102 // As much as possible this should behave as a simple, serializable, | 111 // As much as possible this should behave as a simple, serializable, |
| 103 // copyable struct. | 112 // copyable struct. |
| 104 int32_t id; | 113 int32_t id; |
| 105 AXRole role; | 114 AXRole role; |
| 106 uint32_t state; | 115 uint32_t state; |
| 107 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; | 116 std::vector<std::pair<AXStringAttribute, std::string>> string_attributes; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 127 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform | 136 // NOTE: this member is a std::unique_ptr because it's rare and gfx::Transform |
| 128 // takes up a fair amount of space. The assignment operator and copy | 137 // takes up a fair amount of space. The assignment operator and copy |
| 129 // constructor both make a duplicate of the owned pointer, so it acts more | 138 // constructor both make a duplicate of the owned pointer, so it acts more |
| 130 // like a member than a pointer. | 139 // like a member than a pointer. |
| 131 std::unique_ptr<gfx::Transform> transform; | 140 std::unique_ptr<gfx::Transform> transform; |
| 132 }; | 141 }; |
| 133 | 142 |
| 134 } // namespace ui | 143 } // namespace ui |
| 135 | 144 |
| 136 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ | 145 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_ |
| OLD | NEW |