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

Side by Side Diff: components/autofill/core/browser/autofill_profile_comparator.cc

Issue 2546653006: [Merge m56][autofill] Merge can select the wrong address. (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/autofill/core/browser/autofill_profile_comparator.h" 5 #include "components/autofill/core/browser/autofill_profile_comparator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 kStreetAddress, 541 kStreetAddress,
542 (p2.use_date() > p1.use_date() ? address2 : address1), 542 (p2.use_date() > p1.use_date() ? address2 : address1),
543 app_locale_); 543 app_locale_);
544 break; 544 break;
545 case S1_CONTAINS_S2: 545 case S1_CONTAINS_S2:
546 // address1 has more unique tokens than address2. 546 // address1 has more unique tokens than address2.
547 address->SetInfo(kStreetAddress, address1, app_locale_); 547 address->SetInfo(kStreetAddress, address1, app_locale_);
548 break; 548 break;
549 case S2_CONTAINS_S1: 549 case S2_CONTAINS_S1:
550 // address2 has more unique tokens than address1. 550 // address2 has more unique tokens than address1.
551 address->SetInfo(kStreetAddress, address1, app_locale_); 551 address->SetInfo(kStreetAddress, address2, app_locale_);
552 break; 552 break;
553 case DIFFERENT_TOKENS: 553 case DIFFERENT_TOKENS:
554 default: 554 default:
555 // The addresses aren't mergeable and we shouldn't be doing any of 555 // The addresses aren't mergeable and we shouldn't be doing any of
556 // this. 556 // this.
557 NOTREACHED(); 557 NOTREACHED();
558 return false; 558 return false;
559 } 559 }
560 } 560 }
561 } 561 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison( 862 const base::string16& address2 = rewriter.Rewrite(NormalizeForComparison(
863 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_))); 863 p2.GetInfo(AutofillType(ADDRESS_HOME_STREET_ADDRESS), app_locale_)));
864 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) { 864 if (CompareTokens(address1, address2) == DIFFERENT_TOKENS) {
865 return false; 865 return false;
866 } 866 }
867 867
868 return true; 868 return true;
869 } 869 }
870 870
871 } // namespace autofill 871 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698