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 #include "content/browser/accessibility/accessibility_tree_formatter.h" | 5 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
6 | 6 |
7 #include <atk/atk.h> | 7 #include <atk/atk.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 dict->SetString("description", atk_object_get_description(atk_object)); | 27 dict->SetString("description", atk_object_get_description(atk_object)); |
28 AtkStateSet* state_set = | 28 AtkStateSet* state_set = |
29 atk_object_ref_state_set(atk_object); | 29 atk_object_ref_state_set(atk_object); |
30 base::ListValue* states = new base::ListValue; | 30 base::ListValue* states = new base::ListValue; |
31 for (int i = ATK_STATE_INVALID; i < ATK_STATE_LAST_DEFINED; i++) { | 31 for (int i = ATK_STATE_INVALID; i < ATK_STATE_LAST_DEFINED; i++) { |
32 AtkStateType state_type = static_cast<AtkStateType>(i); | 32 AtkStateType state_type = static_cast<AtkStateType>(i); |
33 if (atk_state_set_contains_state(state_set, state_type)) | 33 if (atk_state_set_contains_state(state_set, state_type)) |
34 states->AppendString(atk_state_type_get_name(state_type)); | 34 states->AppendString(atk_state_type_get_name(state_type)); |
35 } | 35 } |
36 dict->Set("states", states); | 36 dict->Set("states", states); |
37 dict->SetInteger("id", node.renderer_id()); | 37 dict->SetInteger("id", node.GetId()); |
38 } | 38 } |
39 | 39 |
40 base::string16 AccessibilityTreeFormatter::ToString( | 40 base::string16 AccessibilityTreeFormatter::ToString( |
41 const base::DictionaryValue& node, | 41 const base::DictionaryValue& node, |
42 const base::string16& indent) { | 42 const base::string16& indent) { |
43 base::string16 line; | 43 base::string16 line; |
44 std::string role_value; | 44 std::string role_value; |
45 node.GetString("role", &role_value); | 45 node.GetString("role", &role_value); |
46 if (!role_value.empty()) | 46 if (!role_value.empty()) { |
47 WriteAttribute(true, base::StringPrintf("[%s]", role_value.c_str()), &line); | 47 WriteAttribute(true, |
| 48 base::StringPrintf("[%s]", role_value.c_str()), &line); |
| 49 } |
48 | 50 |
49 std::string name_value; | 51 std::string name_value; |
50 node.GetString("name", &name_value); | 52 node.GetString("name", &name_value); |
51 WriteAttribute(true, base::StringPrintf("name='%s'", name_value.c_str()), | 53 WriteAttribute(true, base::StringPrintf("name='%s'", name_value.c_str()), |
52 &line); | 54 &line); |
53 | 55 |
54 std::string description_value; | 56 std::string description_value; |
55 node.GetString("description", &description_value); | 57 node.GetString("description", &description_value); |
56 WriteAttribute(false, | 58 WriteAttribute(false, |
57 base::StringPrintf("description='%s'", | 59 base::StringPrintf("description='%s'", |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const std::string AccessibilityTreeFormatter::GetAllowString() { | 102 const std::string AccessibilityTreeFormatter::GetAllowString() { |
101 return "@GTK-ALLOW:"; | 103 return "@GTK-ALLOW:"; |
102 } | 104 } |
103 | 105 |
104 // static | 106 // static |
105 const std::string AccessibilityTreeFormatter::GetDenyString() { | 107 const std::string AccessibilityTreeFormatter::GetDenyString() { |
106 return "@GTK-DENY:"; | 108 return "@GTK-DENY:"; |
107 } | 109 } |
108 | 110 |
109 } | 111 } |
OLD | NEW |