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

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

Issue 447903003: Autofill: improve GetCreditCardSuggestions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <iterator> 9 #include <iterator>
10 10
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
666 // The value of the stored data for this field type in the |credit_card|. 666 // The value of the stored data for this field type in the |credit_card|.
667 base::string16 creditcard_field_value = 667 base::string16 creditcard_field_value =
668 credit_card->GetInfo(type, app_locale_); 668 credit_card->GetInfo(type, app_locale_);
669 if (!creditcard_field_value.empty() && 669 if (!creditcard_field_value.empty() &&
670 StartsWith(creditcard_field_value, field_contents, false)) { 670 StartsWith(creditcard_field_value, field_contents, false)) {
671 if (type.GetStorableType() == CREDIT_CARD_NUMBER) 671 if (type.GetStorableType() == CREDIT_CARD_NUMBER)
672 creditcard_field_value = credit_card->ObfuscatedNumber(); 672 creditcard_field_value = credit_card->ObfuscatedNumber();
673 673
674 base::string16 label; 674 base::string16 label;
675 if (credit_card->number().empty()) { 675 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
676 // If there is no CC number, return name to show something. 676 label = credit_card->GetInfo(
677 label = 677 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
678 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); 678 } else if (credit_card->number().empty()) {
679 if (type.GetStorableType() != CREDIT_CARD_NAME) {
680 label =
681 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_);
682 }
679 } else { 683 } else {
680 label = kCreditCardPrefix; 684 label = kCreditCardPrefix;
681 label.append(credit_card->LastFourDigits()); 685 label.append(credit_card->LastFourDigits());
682 } 686 }
Ilya Sherman 2014/08/06 23:32:09 Please include comments explaining the goals of th
Evan Stade 2014/08/07 00:05:01 Done.
683 687
684 values->push_back(creditcard_field_value); 688 values->push_back(creditcard_field_value);
685 labels->push_back(label); 689 labels->push_back(label);
686 icons->push_back(base::UTF8ToUTF16(credit_card->type())); 690 icons->push_back(base::UTF8ToUTF16(credit_card->type()));
687 guid_pairs->push_back(GUIDPair(credit_card->guid(), 0)); 691 guid_pairs->push_back(GUIDPair(credit_card->guid(), 0));
688 } 692 }
689 } 693 }
690 } 694 }
691 695
692 bool PersonalDataManager::IsAutofillEnabled() const { 696 bool PersonalDataManager::IsAutofillEnabled() const {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1102 // Populates |auxiliary_profiles_|. 1106 // Populates |auxiliary_profiles_|.
1103 LoadAuxiliaryProfiles(record_metrics); 1107 LoadAuxiliaryProfiles(record_metrics);
1104 1108
1105 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end()); 1109 profiles_.insert(profiles_.end(), web_profiles_.begin(), web_profiles_.end());
1106 profiles_.insert( 1110 profiles_.insert(
1107 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end()); 1111 profiles_.end(), auxiliary_profiles_.begin(), auxiliary_profiles_.end());
1108 return profiles_; 1112 return profiles_;
1109 } 1113 }
1110 1114
1111 } // namespace autofill 1115 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698