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 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 #include <utility> | 12 #include <utility> |
13 | 13 |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/memory/ptr_util.h" |
15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/values.h" |
20 #include "base/win/scoped_bstr.h" | 22 #include "base/win/scoped_bstr.h" |
21 #include "base/win/scoped_comptr.h" | 23 #include "base/win/scoped_comptr.h" |
22 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h
" | 24 #include "content/browser/accessibility/accessibility_tree_formatter_utils_win.h
" |
23 #include "content/browser/accessibility/browser_accessibility_manager.h" | 25 #include "content/browser/accessibility/browser_accessibility_manager.h" |
24 #include "content/browser/accessibility/browser_accessibility_win.h" | 26 #include "content/browser/accessibility/browser_accessibility_win.h" |
25 #include "third_party/iaccessible2/ia2_api_all.h" | 27 #include "third_party/iaccessible2/ia2_api_all.h" |
26 #include "ui/base/win/atl_module.h" | 28 #include "ui/base/win/atl_module.h" |
27 | 29 |
28 | 30 |
29 namespace content { | 31 namespace content { |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 dict->SetString("help", base::string16(temp_bstr, temp_bstr.Length())); | 268 dict->SetString("help", base::string16(temp_bstr, temp_bstr.Length())); |
267 temp_bstr.Reset(); | 269 temp_bstr.Reset(); |
268 | 270 |
269 BrowserAccessibility* root = node.manager()->GetRootManager()->GetRoot(); | 271 BrowserAccessibility* root = node.manager()->GetRootManager()->GetRoot(); |
270 LONG left, top, width, height; | 272 LONG left, top, width, height; |
271 LONG root_left, root_top, root_width, root_height; | 273 LONG root_left, root_top, root_width, root_height; |
272 if (SUCCEEDED(ax_object->GetCOM()->accLocation(&left, &top, &width, &height, | 274 if (SUCCEEDED(ax_object->GetCOM()->accLocation(&left, &top, &width, &height, |
273 variant_self)) && | 275 variant_self)) && |
274 SUCCEEDED(ToBrowserAccessibilityWin(root)->GetCOM()->accLocation( | 276 SUCCEEDED(ToBrowserAccessibilityWin(root)->GetCOM()->accLocation( |
275 &root_left, &root_top, &root_width, &root_height, variant_self))) { | 277 &root_left, &root_top, &root_width, &root_height, variant_self))) { |
276 base::DictionaryValue* location = new base::DictionaryValue; | 278 auto location = base::MakeUnique<base::DictionaryValue>(); |
277 location->SetInteger("x", left - root_left); | 279 location->SetInteger("x", left - root_left); |
278 location->SetInteger("y", top - root_top); | 280 location->SetInteger("y", top - root_top); |
279 dict->Set("location", location); | 281 dict->Set("location", std::move(location)); |
280 | 282 |
281 base::DictionaryValue* size = new base::DictionaryValue; | 283 auto size = base::MakeUnique<base::DictionaryValue>(); |
282 size->SetInteger("width", width); | 284 size->SetInteger("width", width); |
283 size->SetInteger("height", height); | 285 size->SetInteger("height", height); |
284 dict->Set("size", size); | 286 dict->Set("size", std::move(size)); |
285 } | 287 } |
286 | 288 |
287 LONG index_in_parent; | 289 LONG index_in_parent; |
288 if (SUCCEEDED(ax_object->GetCOM()->get_indexInParent(&index_in_parent))) | 290 if (SUCCEEDED(ax_object->GetCOM()->get_indexInParent(&index_in_parent))) |
289 dict->SetInteger("index_in_parent", index_in_parent); | 291 dict->SetInteger("index_in_parent", index_in_parent); |
290 | 292 |
291 LONG n_relations; | 293 LONG n_relations; |
292 if (SUCCEEDED(ax_object->GetCOM()->get_nRelations(&n_relations))) | 294 if (SUCCEEDED(ax_object->GetCOM()->get_nRelations(&n_relations))) |
293 dict->SetInteger("n_relations", n_relations); | 295 dict->SetInteger("n_relations", n_relations); |
294 | 296 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 457 |
456 const std::string AccessibilityTreeFormatterWin::GetAllowString() { | 458 const std::string AccessibilityTreeFormatterWin::GetAllowString() { |
457 return "@WIN-ALLOW:"; | 459 return "@WIN-ALLOW:"; |
458 } | 460 } |
459 | 461 |
460 const std::string AccessibilityTreeFormatterWin::GetDenyString() { | 462 const std::string AccessibilityTreeFormatterWin::GetDenyString() { |
461 return "@WIN-DENY:"; | 463 return "@WIN-DENY:"; |
462 } | 464 } |
463 | 465 |
464 } // namespace content | 466 } // namespace content |
OLD | NEW |