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

Side by Side Diff: chrome/browser/autofill/autofill_profile.cc

Issue 7645038: Autofill: Check for different string sizes when comparing for equality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use StringToLowerASCII. Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/webdata/web_database_migration_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/autofill/autofill_profile.h" 5 #include "chrome/browser/autofill/autofill_profile.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 const string16 AutofillProfile::PrimaryValue() const { 536 const string16 AutofillProfile::PrimaryValue() const {
537 return GetInfo(ADDRESS_HOME_LINE1) + 537 return GetInfo(ADDRESS_HOME_LINE1) +
538 GetInfo(ADDRESS_HOME_CITY); 538 GetInfo(ADDRESS_HOME_CITY);
539 } 539 }
540 540
541 // Functor used to check for case-insensitive equality of two strings. 541 // Functor used to check for case-insensitive equality of two strings.
542 struct CaseInsensitiveStringEquals 542 struct CaseInsensitiveStringEquals
543 : public std::binary_function<string16, string16, bool> 543 : public std::binary_function<string16, string16, bool>
544 { 544 {
545 bool operator()(const string16& x, const string16& y) const { 545 bool operator()(const string16& x, const string16& y) const {
546 return std::equal(x.begin(), x.end(), y.begin(), 546 if (x.size() != y.size()) return false;
Ilya Sherman 2011/08/17 00:58:55 nit: The size check isn't actually necessary if us
547 base::CaseInsensitiveCompare<string16::value_type>()); 547 return StringToLowerASCII(x) == StringToLowerASCII(y);
548 } 548 }
549 }; 549 };
550 550
551 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) { 551 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) {
552 FieldTypeSet field_types; 552 FieldTypeSet field_types;
553 profile.GetNonEmptyTypes(&field_types); 553 profile.GetNonEmptyTypes(&field_types);
554 554
555 // Only transfer "full" types (e.g. full name) and not fragments (e.g. 555 // Only transfer "full" types (e.g. full name) and not fragments (e.g.
556 // first name, last name). 556 // first name, last name).
557 CollapseCompoundFieldTypes(&field_types); 557 CollapseCompoundFieldTypes(&field_types);
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_STATE)) 774 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_STATE))
775 << " " 775 << " "
776 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_ZIP)) 776 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_ZIP))
777 << " " 777 << " "
778 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY)) 778 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY))
779 << " " 779 << " "
780 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)) 780 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER))
781 << " " 781 << " "
782 << UTF16ToUTF8(MultiString(profile, PHONE_FAX_WHOLE_NUMBER)); 782 << UTF16ToUTF8(MultiString(profile, PHONE_FAX_WHOLE_NUMBER));
783 } 783 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/webdata/web_database_migration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698