Index: content/public/common/ax_node_data.cc |
diff --git a/content/public/common/ax_node_data.cc b/content/public/common/ax_node_data.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..70cda68e87535306cfb5543775206ca895ec9ce3 |
--- /dev/null |
+++ b/content/public/common/ax_node_data.cc |
@@ -0,0 +1,77 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/public/common/ax_node_data.h" |
+ |
+#include <set> |
+ |
+#include "base/containers/hash_tables.h" |
+#include "base/strings/string_number_conversions.h" |
+#include "base/strings/string_util.h" |
+#include "base/strings/utf_string_conversions.h" |
+ |
+using base::DoubleToString; |
+using base::IntToString; |
+ |
+namespace { |
+ |
+#ifndef NDEBUG |
+std::string IntVectorToString(const std::vector<int>& items) { |
aboxhall
2013/11/11 18:20:35
Is this used, given all the debugging logic was re
dmazzoni
2013/11/12 00:03:04
Done.
|
+ std::string str; |
+ for (size_t i = 0; i < items.size(); ++i) { |
+ if (i > 0) |
+ str += ","; |
+ str += IntToString(items[i]); |
+ } |
+ return str; |
+} |
+#endif |
+ |
+} // Anonymous namespace |
+ |
+namespace content { |
+ |
+AXNodeData::AXNodeData() |
+ : id(-1), |
+ role(WebKit::WebAXRoleUnknown), |
+ state(-1) { |
+} |
+ |
+AXNodeData::~AXNodeData() { |
+} |
+ |
+void AXNodeData::AddStringAttribute( |
+ StringAttribute attribute, const std::string& value) { |
+ string_attributes.push_back(std::make_pair(attribute, value)); |
+} |
+ |
+void AXNodeData::AddIntAttribute( |
+ IntAttribute attribute, int value) { |
+ int_attributes.push_back(std::make_pair(attribute, value)); |
+} |
+ |
+void AXNodeData::AddFloatAttribute( |
+ FloatAttribute attribute, float value) { |
+ float_attributes.push_back(std::make_pair(attribute, value)); |
+} |
+ |
+void AXNodeData::AddBoolAttribute( |
+ BoolAttribute attribute, bool value) { |
+ bool_attributes.push_back(std::make_pair(attribute, value)); |
+} |
+ |
+void AXNodeData::AddIntListAttribute( |
+ IntListAttribute attribute, const std::vector<int32>& value) { |
+ intlist_attributes.push_back(std::make_pair(attribute, value)); |
+} |
+ |
+void AXNodeData::SetName(std::string name) { |
+ string_attributes.push_back(std::make_pair(ATTR_NAME, name)); |
+} |
+ |
+void AXNodeData::SetValue(std::string value) { |
+ string_attributes.push_back(std::make_pair(ATTR_VALUE, value)); |
+} |
+ |
+} // namespace content |