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

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: 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 if (x.size() != y.size()) return false;
dhollowa 2011/08/15 21:45:15 Elsewhere in the Autofill code we're using |String
James Hawkins 2011/08/15 21:57:11 Done.
546 return std::equal(x.begin(), x.end(), y.begin(), 547 return std::equal(x.begin(), x.end(), y.begin(),
547 base::CaseInsensitiveCompare<string16::value_type>()); 548 base::CaseInsensitiveCompare<string16::value_type>());
548 } 549 }
549 }; 550 };
550 551
551 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) { 552 void AutofillProfile::OverwriteWithOrAddTo(const AutofillProfile& profile) {
552 FieldTypeSet field_types; 553 FieldTypeSet field_types;
553 profile.GetNonEmptyTypes(&field_types); 554 profile.GetNonEmptyTypes(&field_types);
554 555
555 // Only transfer "full" types (e.g. full name) and not fragments (e.g. 556 // Only transfer "full" types (e.g. full name) and not fragments (e.g.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_STATE)) 775 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_STATE))
775 << " " 776 << " "
776 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_ZIP)) 777 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_ZIP))
777 << " " 778 << " "
778 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY)) 779 << UTF16ToUTF8(profile.GetInfo(ADDRESS_HOME_COUNTRY))
779 << " " 780 << " "
780 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER)) 781 << UTF16ToUTF8(MultiString(profile, PHONE_HOME_WHOLE_NUMBER))
781 << " " 782 << " "
782 << UTF16ToUTF8(MultiString(profile, PHONE_FAX_WHOLE_NUMBER)); 783 << UTF16ToUTF8(MultiString(profile, PHONE_FAX_WHOLE_NUMBER));
783 } 784 }
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