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" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "content/browser/accessibility/browser_accessibility_gtk.h" | 14 #include "content/browser/accessibility/browser_accessibility_gtk.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node, | 18 void AccessibilityTreeFormatter::AddProperties(const BrowserAccessibility& node, |
19 base::DictionaryValue* dict) { | 19 base::DictionaryValue* dict) { |
20 BrowserAccessibilityGtk* node_gtk = | 20 BrowserAccessibilityGtk* node_gtk = |
21 const_cast<BrowserAccessibility*>(&node)->ToBrowserAccessibilityGtk(); | 21 const_cast<BrowserAccessibility*>(&node)->ToBrowserAccessibilityGtk(); |
22 AtkObject* atk_object = node_gtk->GetAtkObject(); | 22 AtkObject* atk_object = node_gtk->GetAtkObject(); |
23 AtkRole role = atk_object_get_role(atk_object); | 23 AtkRole role = atk_object_get_role(atk_object); |
24 if (role != ATK_ROLE_UNKNOWN) | 24 if (role != ATK_ROLE_UNKNOWN) |
25 dict->SetString("role", atk_role_get_name(role)); | 25 dict->SetString("role", atk_role_get_name(role)); |
26 dict->SetString("name", atk_object_get_name(atk_object)); | 26 dict->SetString("name", atk_object_get_name(atk_object)); |
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 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.renderer_id()); |
38 } | 38 } |
39 | 39 |
40 base::string16 AccessibilityTreeFormatter::ToString( | 40 base::string16 AccessibilityTreeFormatter::ToString( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const std::string AccessibilityTreeFormatter::GetAllowString() { | 100 const std::string AccessibilityTreeFormatter::GetAllowString() { |
101 return "@GTK-ALLOW:"; | 101 return "@GTK-ALLOW:"; |
102 } | 102 } |
103 | 103 |
104 // static | 104 // static |
105 const std::string AccessibilityTreeFormatter::GetDenyString() { | 105 const std::string AccessibilityTreeFormatter::GetDenyString() { |
106 return "@GTK-DENY:"; | 106 return "@GTK-DENY:"; |
107 } | 107 } |
108 | 108 |
109 } | 109 } |
OLD | NEW |