Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(950)

Side by Side Diff: content/browser/accessibility/accessibility_tree_formatter_win.cc

Issue 1410333006: Enough hacks to make wstring printfs unneeded (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(SUCCEEDED(hr)); 100 DCHECK(SUCCEEDED(hr));
101 base::win::ScopedComPtr<IAccessible2> ax_embed; 101 base::win::ScopedComPtr<IAccessible2> ax_embed;
102 hr = embedded_object.QueryInterface(ax_embed.Receive()); 102 hr = embedded_object.QueryInterface(ax_embed.Receive());
103 DCHECK(SUCCEEDED(hr)); 103 DCHECK(SUCCEEDED(hr));
104 hr = ax_embed->get_indexInParent(&child_index); 104 hr = ax_embed->get_indexInParent(&child_index);
105 DCHECK(SUCCEEDED(hr)); 105 DCHECK(SUCCEEDED(hr));
106 } 106 }
107 107
108 base::string16 child_index_str(L"<obj"); 108 base::string16 child_index_str(L"<obj");
109 if (child_index >= 0) { 109 if (child_index >= 0) {
110 base::StringAppendF(&child_index_str, L"%d>", child_index); 110 /*base::StringAppendF(&child_index_str, L"%d>", child_index);*/
111 } else { 111 } else {
112 base::StringAppendF(&child_index_str, L">"); 112 /*base::StringAppendF(&child_index_str, L">");*/
113 } 113 }
114 base::ReplaceFirstSubstringAfterOffset(&ia2_hypertext, hypertext_index, 114 base::ReplaceFirstSubstringAfterOffset(&ia2_hypertext, hypertext_index,
115 embedded_character, child_index_str); 115 embedded_character, child_index_str);
116 ++character_index; 116 ++character_index;
117 hypertext_index += child_index_str.length(); 117 hypertext_index += child_index_str.length();
118 --number_of_embeds; 118 --number_of_embeds;
119 } 119 }
120 DCHECK_EQ(number_of_embeds, 0); 120 DCHECK_EQ(number_of_embeds, 0);
121 121
122 return ia2_hypertext; 122 return ia2_hypertext;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 for (int i = 0; i < arraysize(ALL_ATTRIBUTES); i++) { 301 for (int i = 0; i < arraysize(ALL_ATTRIBUTES); i++) {
302 const char* attribute_name = ALL_ATTRIBUTES[i]; 302 const char* attribute_name = ALL_ATTRIBUTES[i];
303 const base::Value* value; 303 const base::Value* value;
304 if (!dict.Get(attribute_name, &value)) 304 if (!dict.Get(attribute_name, &value))
305 continue; 305 continue;
306 306
307 switch (value->GetType()) { 307 switch (value->GetType()) {
308 case base::Value::TYPE_STRING: { 308 case base::Value::TYPE_STRING: {
309 base::string16 string_value; 309 base::string16 string_value;
310 value->GetAsString(&string_value); 310 value->GetAsString(&string_value);
311 WriteAttribute(false, 311 /* WriteAttribute(false,
brucedawson 2015/10/20 21:43:00 String printing of UTF8toUTF16(attribute_name), th
312 base::StringPrintf(L"%ls='%ls'", 312 base::StringPrintf(L"%ls='%ls'",
313 base::UTF8ToUTF16(attribute_name).c_str(), 313 base::UTF8ToUTF16(attribute_name).c_str(),
314 string_value.c_str()), 314 string_value.c_str()),
315 &line); 315 &line);*/
316 break; 316 break;
317 } 317 }
318 case base::Value::TYPE_INTEGER: { 318 case base::Value::TYPE_INTEGER: {
319 int int_value; 319 int int_value;
320 value->GetAsInteger(&int_value); 320 value->GetAsInteger(&int_value);
321 WriteAttribute(false, 321 /*WriteAttribute(false,
322 base::StringPrintf(L"%ls=%d", 322 base::StringPrintf(L"%ls=%d",
323 base::UTF8ToUTF16( 323 base::UTF8ToUTF16(
324 attribute_name).c_str(), 324 attribute_name).c_str(),
325 int_value), 325 int_value),
326 &line); 326 &line);*/
327 break; 327 break;
328 } 328 }
329 case base::Value::TYPE_DOUBLE: { 329 case base::Value::TYPE_DOUBLE: {
330 double double_value; 330 double double_value;
331 value->GetAsDouble(&double_value); 331 value->GetAsDouble(&double_value);
332 WriteAttribute(false, 332 /* WriteAttribute(false,
333 base::StringPrintf(L"%ls=%.2f", 333 base::StringPrintf(L"%ls=%.2f",
334 base::UTF8ToUTF16( 334 base::UTF8ToUTF16(
335 attribute_name).c_str(), 335 attribute_name).c_str(),
336 double_value), 336 double_value),
337 &line); 337 &line);*/
338 break; 338 break;
339 } 339 }
340 case base::Value::TYPE_LIST: { 340 case base::Value::TYPE_LIST: {
341 // Currently all list values are string and are written without 341 // Currently all list values are string and are written without
342 // attribute names. 342 // attribute names.
343 const base::ListValue* list_value; 343 const base::ListValue* list_value;
344 value->GetAsList(&list_value); 344 value->GetAsList(&list_value);
345 for (base::ListValue::const_iterator it = list_value->begin(); 345 for (base::ListValue::const_iterator it = list_value->begin();
346 it != list_value->end(); 346 it != list_value->end();
347 ++it) { 347 ++it) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 const std::string AccessibilityTreeFormatter::GetAllowString() { 398 const std::string AccessibilityTreeFormatter::GetAllowString() {
399 return "@WIN-ALLOW:"; 399 return "@WIN-ALLOW:";
400 } 400 }
401 401
402 // static 402 // static
403 const std::string AccessibilityTreeFormatter::GetDenyString() { 403 const std::string AccessibilityTreeFormatter::GetDenyString() {
404 return "@WIN-DENY:"; 404 return "@WIN-DENY:";
405 } 405 }
406 406
407 } // namespace content 407 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698