| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ | 5 #ifndef CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ |
| 6 #define CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ | 6 #define CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "content/common/content_export.h" |
| 9 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
| 10 #include "ui/accessibility/ax_tree_data.h" |
| 11 #include "ui/accessibility/ax_tree_update.h" |
| 10 | 12 |
| 11 namespace content { | 13 namespace content { |
| 12 | 14 |
| 13 enum AXContentIntAttribute { | 15 enum AXContentIntAttribute { |
| 14 // The routing ID of this root node. | |
| 15 AX_CONTENT_ATTR_ROUTING_ID, | |
| 16 | |
| 17 // The routing ID of this tree's parent. | |
| 18 AX_CONTENT_ATTR_PARENT_ROUTING_ID, | |
| 19 | |
| 20 // The routing ID of this node's child tree. | 16 // The routing ID of this node's child tree. |
| 21 AX_CONTENT_ATTR_CHILD_ROUTING_ID, | 17 AX_CONTENT_ATTR_CHILD_ROUTING_ID, |
| 22 | 18 |
| 23 // The browser plugin instance ID of this node's child tree. | 19 // The browser plugin instance ID of this node's child tree. |
| 24 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, | 20 AX_CONTENT_ATTR_CHILD_BROWSER_PLUGIN_INSTANCE_ID, |
| 25 | 21 |
| 26 AX_CONTENT_INT_ATTRIBUTE_LAST | 22 AX_CONTENT_INT_ATTRIBUTE_LAST |
| 27 }; | 23 }; |
| 28 | 24 |
| 29 // A subclass of AXNodeData that contains extra fields for | 25 // A subclass of AXNodeData that contains extra fields for |
| 30 // content-layer-specific AX attributes. | 26 // content-layer-specific AX attributes. |
| 31 struct CONTENT_EXPORT AXContentNodeData : public ui::AXNodeData { | 27 struct CONTENT_EXPORT AXContentNodeData : public ui::AXNodeData { |
| 32 AXContentNodeData(); | 28 AXContentNodeData(); |
| 33 ~AXContentNodeData() override; | 29 ~AXContentNodeData() override; |
| 34 | 30 |
| 35 bool HasContentIntAttribute(AXContentIntAttribute attribute) const; | 31 bool HasContentIntAttribute(AXContentIntAttribute attribute) const; |
| 36 int GetContentIntAttribute(AXContentIntAttribute attribute) const; | 32 int GetContentIntAttribute(AXContentIntAttribute attribute) const; |
| 37 bool GetContentIntAttribute(AXContentIntAttribute attribute, | 33 bool GetContentIntAttribute(AXContentIntAttribute attribute, |
| 38 int* value) const; | 34 int* value) const; |
| 39 void AddContentIntAttribute(AXContentIntAttribute attribute, int value); | 35 void AddContentIntAttribute(AXContentIntAttribute attribute, int value); |
| 40 | 36 |
| 41 // Return a string representation of this data, for debugging. | 37 // Return a string representation of this data, for debugging. |
| 42 std::string ToString() const override; | 38 std::string ToString() const override; |
| 43 | 39 |
| 44 // This is a simple serializable struct. All member variables should be | 40 // This is a simple serializable struct. All member variables should be |
| 45 // public and copyable. | 41 // public and copyable. |
| 46 std::vector<std::pair<AXContentIntAttribute, int32> > content_int_attributes; | 42 std::vector<std::pair<AXContentIntAttribute, int32> > content_int_attributes; |
| 47 }; | 43 }; |
| 48 | 44 |
| 45 // A subclass of AXTreeData that contains extra fields for |
| 46 // content-layer-specific AX attributes. |
| 47 struct CONTENT_EXPORT AXContentTreeData : public ui::AXTreeData { |
| 48 AXContentTreeData(); |
| 49 ~AXContentTreeData() override; |
| 50 |
| 51 // Return a string representation of this data, for debugging. |
| 52 std::string ToString() const override; |
| 53 |
| 54 // The routing ID of this frame. |
| 55 int routing_id; |
| 56 |
| 57 // The routing ID of the parent frame. |
| 58 int parent_routing_id; |
| 59 }; |
| 60 |
| 61 typedef ui::AXTreeUpdateBase<content::AXContentNodeData, |
| 62 content::AXContentTreeData> AXContentTreeUpdate; |
| 63 |
| 49 } // namespace content | 64 } // namespace content |
| 50 | 65 |
| 51 #endif // CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ | 66 #endif // CONTENT_COMMON_AX_CONTENT_NODE_DATA_H_ |
| OLD | NEW |