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

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

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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/browser_accessibility.h" 5 #include "content/browser/accessibility/browser_accessibility.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 for (size_t i = 0; i < string_attributes_.size(); ++i) { 437 for (size_t i = 0; i < string_attributes_.size(); ++i) {
438 if (string_attributes_[i].first == attribute) { 438 if (string_attributes_[i].first == attribute) {
439 *value = string_attributes_[i].second; 439 *value = string_attributes_[i].second;
440 return true; 440 return true;
441 } 441 }
442 } 442 }
443 443
444 return false; 444 return false;
445 } 445 }
446 446
447 string16 BrowserAccessibility::GetString16Attribute( 447 base::string16 BrowserAccessibility::GetString16Attribute(
448 StringAttribute attribute) const { 448 StringAttribute attribute) const {
449 std::string value_utf8; 449 std::string value_utf8;
450 if (!GetStringAttribute(attribute, &value_utf8)) 450 if (!GetStringAttribute(attribute, &value_utf8))
451 return string16(); 451 return base::string16();
452 return UTF8ToUTF16(value_utf8); 452 return UTF8ToUTF16(value_utf8);
453 } 453 }
454 454
455 bool BrowserAccessibility::GetString16Attribute( 455 bool BrowserAccessibility::GetString16Attribute(
456 StringAttribute attribute, 456 StringAttribute attribute,
457 string16* value) const { 457 base::string16* value) const {
458 std::string value_utf8; 458 std::string value_utf8;
459 if (!GetStringAttribute(attribute, &value_utf8)) 459 if (!GetStringAttribute(attribute, &value_utf8))
460 return false; 460 return false;
461 *value = UTF8ToUTF16(value_utf8); 461 *value = UTF8ToUTF16(value_utf8);
462 return true; 462 return true;
463 } 463 }
464 464
465 void BrowserAccessibility::SetStringAttribute( 465 void BrowserAccessibility::SetStringAttribute(
466 StringAttribute attribute, const std::string& value) { 466 StringAttribute attribute, const std::string& value) {
467 for (size_t i = 0; i < string_attributes_.size(); ++i) { 467 for (size_t i = 0; i < string_attributes_.size(); ++i) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 if (LowerCaseEqualsASCII(attr, html_attr)) { 515 if (LowerCaseEqualsASCII(attr, html_attr)) {
516 *value = html_attributes_[i].second; 516 *value = html_attributes_[i].second;
517 return true; 517 return true;
518 } 518 }
519 } 519 }
520 520
521 return false; 521 return false;
522 } 522 }
523 523
524 bool BrowserAccessibility::GetHtmlAttribute( 524 bool BrowserAccessibility::GetHtmlAttribute(
525 const char* html_attr, string16* value) const { 525 const char* html_attr, base::string16* value) const {
526 std::string value_utf8; 526 std::string value_utf8;
527 if (!GetHtmlAttribute(html_attr, &value_utf8)) 527 if (!GetHtmlAttribute(html_attr, &value_utf8))
528 return false; 528 return false;
529 *value = UTF8ToUTF16(value_utf8); 529 *value = UTF8ToUTF16(value_utf8);
530 return true; 530 return true;
531 } 531 }
532 532
533 bool BrowserAccessibility::GetAriaTristate( 533 bool BrowserAccessibility::GetAriaTristate(
534 const char* html_attr, 534 const char* html_attr,
535 bool* is_defined, 535 bool* is_defined,
536 bool* is_mixed) const { 536 bool* is_mixed) const {
537 *is_defined = false; 537 *is_defined = false;
538 *is_mixed = false; 538 *is_mixed = false;
539 539
540 string16 value; 540 base::string16 value;
541 if (!GetHtmlAttribute(html_attr, &value) || 541 if (!GetHtmlAttribute(html_attr, &value) ||
542 value.empty() || 542 value.empty() ||
543 EqualsASCII(value, "undefined")) { 543 EqualsASCII(value, "undefined")) {
544 return false; // Not set (and *is_defined is also false) 544 return false; // Not set (and *is_defined is also false)
545 } 545 }
546 546
547 *is_defined = true; 547 *is_defined = true;
548 548
549 if (EqualsASCII(value, "true")) 549 if (EqualsASCII(value, "true"))
550 return true; 550 return true;
(...skipping 29 matching lines...) Expand all
580 return name_; 580 return name_;
581 } 581 }
582 582
583 std::string result; 583 std::string result;
584 for (uint32 i = 0; i < PlatformChildCount(); ++i) 584 for (uint32 i = 0; i < PlatformChildCount(); ++i)
585 result += PlatformGetChild(i)->GetTextRecursive(); 585 result += PlatformGetChild(i)->GetTextRecursive();
586 return result; 586 return result;
587 } 587 }
588 588
589 } // namespace content 589 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/accessibility/browser_accessibility.h ('k') | content/browser/accessibility/browser_accessibility_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698