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
3 // found in the LICENSE file.
5 #ifndef UI_ACCESSIBILITY_AX_NODE_DATA_H_
6 #define UI_ACCESSIBILITY_AX_NODE_DATA_H_
12 #include "base/strings/string16.h"
13 #include "base/strings/string_split.h"
14 #include "ui/accessibility/ax_enums.h"
15 #include "ui/accessibility/ax_export.h"
16 #include "ui/gfx/geometry/rect.h"
20 // A compact representation of the accessibility information for a
21 // single web object, in a form that can be serialized and sent from
22 // one process to another.
23 struct AX_EXPORT AXNodeData
{
25 virtual ~AXNodeData();
27 void AddStringAttribute(AXStringAttribute attribute
,
28 const std::string
& value
);
29 void AddIntAttribute(AXIntAttribute attribute
, int value
);
30 void AddFloatAttribute(AXFloatAttribute attribute
, float value
);
31 void AddBoolAttribute(AXBoolAttribute attribute
, bool value
);
32 void AddIntListAttribute(AXIntListAttribute attribute
,
33 const std::vector
<int32
>& value
);
35 // Convenience functions, mainly for writing unit tests.
36 // Equivalent to AddStringAttribute(ATTR_NAME, name).
37 void SetName(std::string name
);
38 // Equivalent to AddStringAttribute(ATTR_VALUE, value).
39 void SetValue(std::string value
);
41 // Return a string representation of this data, for debugging.
42 std::string
ToString() const;
44 // This is a simple serializable struct. All member variables should be
45 // public and copyable.
50 std::vector
<std::pair
<AXStringAttribute
, std::string
> > string_attributes
;
51 std::vector
<std::pair
<AXIntAttribute
, int32
> > int_attributes
;
52 std::vector
<std::pair
<AXFloatAttribute
, float> > float_attributes
;
53 std::vector
<std::pair
<AXBoolAttribute
, bool> > bool_attributes
;
54 std::vector
<std::pair
<AXIntListAttribute
, std::vector
<int32
> > >
56 base::StringPairs html_attributes
;
57 std::vector
<int32
> child_ids
;
62 #endif // UI_ACCESSIBILITY_AX_NODE_DATA_H_