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/accessibility_tree_formatter.h" | 5 #include "content/browser/accessibility/accessibility_tree_formatter.h" |
6 | 6 |
7 #include <oleacc.h> | 7 #include <oleacc.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h " | 15 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h " |
16 #include "content/browser/accessibility/browser_accessibility_manager.h" | 16 #include "content/browser/accessibility/browser_accessibility_manager.h" |
17 #include "content/browser/accessibility/browser_accessibility_win.h" | 17 #include "content/browser/accessibility/browser_accessibility_win.h" |
18 #include "content/common/accessibility_node_data.h" | 18 #include "content/common/accessibility_node_data.h" |
19 #include "third_party/iaccessible2/ia2_api_all.h" | 19 #include "third_party/iaccessible2/ia2_api_all.h" |
20 #include "ui/base/win/atl_module.h" | 20 #include "ui/base/win/atl_module.h" |
21 | 21 |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 void AccessibilityTreeFormatter::Initialize() { | 24 void AccessibilityTreeFormatter::Initialize() { |
25 ui::win::CreateATLModuleIfNeeded(); | 25 ui::win::CreateATLModuleIfNeeded(); |
26 } | 26 } |
27 | 27 |
28 string16 AccessibilityTreeFormatter::ToString( | 28 string16 AccessibilityTreeFormatter::ToString( |
29 BrowserAccessibility* node, char* prefix) { | 29 BrowserAccessibility* node, string16& indent) { |
dmazzoni
2013/04/08 05:46:35
string16& indent -> const string16& indent
| |
30 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); | 30 BrowserAccessibilityWin* acc_obj = node->ToBrowserAccessibilityWin(); |
31 | 31 |
32 // Get the computed name. | 32 // Get the computed name. |
33 VARIANT variant_self; | 33 VARIANT variant_self; |
34 variant_self.vt = VT_I4; | 34 variant_self.vt = VT_I4; |
35 variant_self.lVal = CHILDID_SELF; | 35 variant_self.lVal = CHILDID_SELF; |
36 CComBSTR msaa_variant; | 36 CComBSTR msaa_variant; |
37 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); | 37 HRESULT hresult = acc_obj->get_accName(variant_self, &msaa_variant); |
38 string16 name; | 38 string16 name; |
39 if (S_OK == hresult) | 39 if (S_OK == hresult) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 Add(false, base::StringPrintf(L"n_selections=%d", n_selections)); | 149 Add(false, base::StringPrintf(L"n_selections=%d", n_selections)); |
150 if (n_selections > 0) { | 150 if (n_selections > 0) { |
151 LONG start, end; | 151 LONG start, end; |
152 if (acc_obj->get_selection(0, &start, &end) == S_OK) { | 152 if (acc_obj->get_selection(0, &start, &end) == S_OK) { |
153 Add(false, base::StringPrintf(L"selection_start=%d", start)); | 153 Add(false, base::StringPrintf(L"selection_start=%d", start)); |
154 Add(false, base::StringPrintf(L"selection_end=%d", end)); | 154 Add(false, base::StringPrintf(L"selection_end=%d", end)); |
155 } | 155 } |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 return UTF8ToUTF16(prefix) + FinishLine() + ASCIIToUTF16("\n"); | 159 return indent + FinishLine() + ASCIIToUTF16("\n"); |
160 } | 160 } |
161 | 161 |
162 // static | 162 // static |
163 const base::FilePath::StringType | 163 const base::FilePath::StringType |
164 AccessibilityTreeFormatter::GetActualFileSuffix() { | 164 AccessibilityTreeFormatter::GetActualFileSuffix() { |
165 return FILE_PATH_LITERAL("-actual-win.txt"); | 165 return FILE_PATH_LITERAL("-actual-win.txt"); |
166 } | 166 } |
167 | 167 |
168 // static | 168 // static |
169 const base::FilePath::StringType | 169 const base::FilePath::StringType |
(...skipping 10 matching lines...) Expand all Loading... | |
180 const std::string AccessibilityTreeFormatter::GetAllowString() { | 180 const std::string AccessibilityTreeFormatter::GetAllowString() { |
181 return "@WIN-ALLOW:"; | 181 return "@WIN-ALLOW:"; |
182 } | 182 } |
183 | 183 |
184 // static | 184 // static |
185 const std::string AccessibilityTreeFormatter::GetDenyString() { | 185 const std::string AccessibilityTreeFormatter::GetDenyString() { |
186 return "@WIN-DENY:"; | 186 return "@WIN-DENY:"; |
187 } | 187 } |
188 | 188 |
189 } // namespace content | 189 } // namespace content |
OLD | NEW |