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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "content/browser/accessibility/browser_accessibility_android.h" | 18 #include "content/browser/accessibility/browser_accessibility_android.h" |
19 | 19 |
20 using base::StringPrintf; | 20 using base::StringPrintf; |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 namespace { | 24 namespace { |
25 const char* BOOL_ATTRIBUTES[] = { | 25 |
| 26 const char* const BOOL_ATTRIBUTES[] = { |
26 "checkable", | 27 "checkable", |
27 "checked", | 28 "checked", |
28 "clickable", | 29 "clickable", |
29 "collection", | 30 "collection", |
30 "collection_item", | 31 "collection_item", |
31 "content_invalid", | 32 "content_invalid", |
32 "disabled", | 33 "disabled", |
33 "dismissable", | 34 "dismissable", |
34 "editable_text", | 35 "editable_text", |
35 "focusable", | 36 "focusable", |
36 "focused", | 37 "focused", |
37 "heading", | 38 "heading", |
38 "hierarchical", | 39 "hierarchical", |
39 "invisible", | 40 "invisible", |
40 "link", | 41 "link", |
41 "multiline", | 42 "multiline", |
42 "password", | 43 "password", |
43 "range", | 44 "range", |
44 "scrollable", | 45 "scrollable", |
45 "selected" | 46 "selected" |
46 }; | 47 }; |
47 | 48 |
48 const char* STRING_ATTRIBUTES[] = { | 49 const char* const STRING_ATTRIBUTES[] = { |
49 "name" | 50 "name" |
50 }; | 51 }; |
51 | 52 |
52 const char* INT_ATTRIBUTES[] = { | 53 const char* const INT_ATTRIBUTES[] = { |
53 "item_index", | 54 "item_index", |
54 "item_count", | 55 "item_count", |
55 "row_count", | 56 "row_count", |
56 "column_count", | 57 "column_count", |
57 "row_index", | 58 "row_index", |
58 "row_span", | 59 "row_span", |
59 "column_index", | 60 "column_index", |
60 "column_span", | 61 "column_span", |
61 "input_type", | 62 "input_type", |
62 "live_region_type", | 63 "live_region_type", |
63 "range_min", | 64 "range_min", |
64 "range_max", | 65 "range_max", |
65 "range_current_value", | 66 "range_current_value", |
66 "text_change_added_count", | 67 "text_change_added_count", |
67 "text_change_removed_count", | 68 "text_change_removed_count", |
68 }; | 69 }; |
69 } | 70 |
| 71 } // namespace |
70 | 72 |
71 class AccessibilityTreeFormatterAndroid : public AccessibilityTreeFormatter { | 73 class AccessibilityTreeFormatterAndroid : public AccessibilityTreeFormatter { |
72 public: | 74 public: |
73 explicit AccessibilityTreeFormatterAndroid(); | 75 AccessibilityTreeFormatterAndroid(); |
74 ~AccessibilityTreeFormatterAndroid() override; | 76 ~AccessibilityTreeFormatterAndroid() override; |
75 | 77 |
76 private: | 78 private: |
77 const base::FilePath::StringType GetExpectedFileSuffix() override; | 79 const base::FilePath::StringType GetExpectedFileSuffix() override; |
78 const std::string GetAllowEmptyString() override; | 80 const std::string GetAllowEmptyString() override; |
79 const std::string GetAllowString() override; | 81 const std::string GetAllowString() override; |
80 const std::string GetDenyString() override; | 82 const std::string GetDenyString() override; |
81 void AddProperties(const BrowserAccessibility& node, | 83 void AddProperties(const BrowserAccessibility& node, |
82 base::DictionaryValue* dict) override; | 84 base::DictionaryValue* dict) override; |
83 base::string16 ToString(const base::DictionaryValue& node) override; | 85 base::string16 ToString(const base::DictionaryValue& node) override; |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 | 224 |
223 const std::string AccessibilityTreeFormatterAndroid::GetAllowString() { | 225 const std::string AccessibilityTreeFormatterAndroid::GetAllowString() { |
224 return "@ANDROID-ALLOW:"; | 226 return "@ANDROID-ALLOW:"; |
225 } | 227 } |
226 | 228 |
227 const std::string AccessibilityTreeFormatterAndroid::GetDenyString() { | 229 const std::string AccessibilityTreeFormatterAndroid::GetDenyString() { |
228 return "@ANDROID-DENY:"; | 230 return "@ANDROID-DENY:"; |
229 } | 231 } |
230 | 232 |
231 } // namespace content | 233 } // namespace content |
OLD | NEW |