Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: content/public/common/ax_node_data.cc

Issue 67283004: First step to move common accessibility code out of content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved out of public api Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #include "content/public/common/ax_node_data.h"
6
7 #include <set>
8
9 #include "base/containers/hash_tables.h"
10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h"
13
14 using base::DoubleToString;
15 using base::IntToString;
16
17 namespace {
18
19 #ifndef NDEBUG
20 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.
21 std::string str;
22 for (size_t i = 0; i < items.size(); ++i) {
23 if (i > 0)
24 str += ",";
25 str += IntToString(items[i]);
26 }
27 return str;
28 }
29 #endif
30
31 } // Anonymous namespace
32
33 namespace content {
34
35 AXNodeData::AXNodeData()
36 : id(-1),
37 role(WebKit::WebAXRoleUnknown),
38 state(-1) {
39 }
40
41 AXNodeData::~AXNodeData() {
42 }
43
44 void AXNodeData::AddStringAttribute(
45 StringAttribute attribute, const std::string& value) {
46 string_attributes.push_back(std::make_pair(attribute, value));
47 }
48
49 void AXNodeData::AddIntAttribute(
50 IntAttribute attribute, int value) {
51 int_attributes.push_back(std::make_pair(attribute, value));
52 }
53
54 void AXNodeData::AddFloatAttribute(
55 FloatAttribute attribute, float value) {
56 float_attributes.push_back(std::make_pair(attribute, value));
57 }
58
59 void AXNodeData::AddBoolAttribute(
60 BoolAttribute attribute, bool value) {
61 bool_attributes.push_back(std::make_pair(attribute, value));
62 }
63
64 void AXNodeData::AddIntListAttribute(
65 IntListAttribute attribute, const std::vector<int32>& value) {
66 intlist_attributes.push_back(std::make_pair(attribute, value));
67 }
68
69 void AXNodeData::SetName(std::string name) {
70 string_attributes.push_back(std::make_pair(ATTR_NAME, name));
71 }
72
73 void AXNodeData::SetValue(std::string value) {
74 string_attributes.push_back(std::make_pair(ATTR_VALUE, value));
75 }
76
77 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698