OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/dump_accessibility_tree_helper.h" | 5 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "content/browser/accessibility/browser_accessibility_cocoa.h" | 11 #include "content/browser/accessibility/browser_accessibility_cocoa.h" |
12 #include "content/browser/accessibility/browser_accessibility_mac.h" | 12 #include "content/browser/accessibility/browser_accessibility_mac.h" |
13 #include "content/browser/accessibility/browser_accessibility_manager.h" | 13 #include "content/browser/accessibility/browser_accessibility_manager.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 NSSize node_size = [[cocoa_node size] sizeValue]; | 59 NSSize node_size = [[cocoa_node size] sizeValue]; |
60 NSString* size_str = | 60 NSString* size_str = |
61 [NSString stringWithFormat:@"size=(%d, %d)", | 61 [NSString stringWithFormat:@"size=(%d, %d)", |
62 static_cast<int>(node_size.width), | 62 static_cast<int>(node_size.width), |
63 static_cast<int>(node_size.height)]; | 63 static_cast<int>(node_size.height)]; |
64 return UTF8ToUTF16([size_str cStringUsingEncoding:NSUTF8StringEncoding]); | 64 return UTF8ToUTF16([size_str cStringUsingEncoding:NSUTF8StringEncoding]); |
65 } | 65 } |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 void DumpAccessibilityTreeHelper::Initialize() {} | 69 void AccessibilityTreeFormatter::Initialize() {} |
70 | 70 |
71 string16 DumpAccessibilityTreeHelper::ToString(BrowserAccessibility* node, | 71 string16 AccessibilityTreeFormatter::ToString(BrowserAccessibility* node, |
72 char* prefix) { | 72 char* prefix) { |
73 StartLine(); | 73 StartLine(); |
74 Add(true, Format(node, "", @selector(role), "")); | 74 Add(true, Format(node, "", @selector(role), "")); |
75 Add(false, Format(node, "subrole=", @selector(subrole), "")); | 75 Add(false, Format(node, "subrole=", @selector(subrole), "")); |
76 Add(false, Format(node, "roleDescription='", | 76 Add(false, Format(node, "roleDescription='", |
77 @selector(roleDescription), | 77 @selector(roleDescription), |
78 "'")); | 78 "'")); |
79 Add(true, Format(node, "title='", @selector(title), "'")); | 79 Add(true, Format(node, "title='", @selector(title), "'")); |
80 Add(true, Format(node, "value='", @selector(value), "'")); | 80 Add(true, Format(node, "value='", @selector(value), "'")); |
81 Add(false, Format(node, "minValue='", @selector(minValue), "'")); | 81 Add(false, Format(node, "minValue='", @selector(minValue), "'")); |
(...skipping 23 matching lines...) Expand all Loading... |
105 Add(false, Format(node, "url='", @selector(url), "'")); | 105 Add(false, Format(node, "url='", @selector(url), "'")); |
106 Add(false, Format(node, "visibleCharacterRange='", | 106 Add(false, Format(node, "visibleCharacterRange='", |
107 @selector(visibleCharacterRange), "'")); | 107 @selector(visibleCharacterRange), "'")); |
108 Add(false, Format(node, "visited='", @selector(visited), "'")); | 108 Add(false, Format(node, "visited='", @selector(visited), "'")); |
109 Add(false, FormatPosition(node)); | 109 Add(false, FormatPosition(node)); |
110 Add(false, FormatSize(node)); | 110 Add(false, FormatSize(node)); |
111 | 111 |
112 return ASCIIToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 112 return ASCIIToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); |
113 } | 113 } |
114 | 114 |
| 115 // static |
115 const base::FilePath::StringType | 116 const base::FilePath::StringType |
116 DumpAccessibilityTreeHelper::GetActualFileSuffix() | 117 AccessibilityTreeFormatter::GetActualFileSuffix() { |
117 const { | |
118 return FILE_PATH_LITERAL("-actual-mac.txt"); | 118 return FILE_PATH_LITERAL("-actual-mac.txt"); |
119 } | 119 } |
120 | 120 |
| 121 // static |
121 const base::FilePath::StringType | 122 const base::FilePath::StringType |
122 DumpAccessibilityTreeHelper::GetExpectedFileSuffix() | 123 AccessibilityTreeFormatter::GetExpectedFileSuffix() { |
123 const { | |
124 return FILE_PATH_LITERAL("-expected-mac.txt"); | 124 return FILE_PATH_LITERAL("-expected-mac.txt"); |
125 } | 125 } |
126 | 126 |
127 const std::string DumpAccessibilityTreeHelper::GetAllowEmptyString() const { | 127 // static |
| 128 const std::string AccessibilityTreeFormatter::GetAllowEmptyString() { |
128 return "@MAC-ALLOW-EMPTY:"; | 129 return "@MAC-ALLOW-EMPTY:"; |
129 } | 130 } |
130 | 131 |
131 const std::string DumpAccessibilityTreeHelper::GetAllowString() const { | 132 // static |
| 133 const std::string AccessibilityTreeFormatter::GetAllowString() { |
132 return "@MAC-ALLOW:"; | 134 return "@MAC-ALLOW:"; |
133 } | 135 } |
134 | 136 |
135 const std::string DumpAccessibilityTreeHelper::GetDenyString() const { | 137 // static |
| 138 const std::string AccessibilityTreeFormatter::GetDenyString() { |
136 return "@MAC-DENY:"; | 139 return "@MAC-DENY:"; |
137 } | 140 } |
138 | 141 |
139 } // namespace content | 142 } // namespace content |
OLD | NEW |