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

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

Issue 1540423004: Add card details and legal message to Android save credit card infobar. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Edits Created 4 years, 11 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 Suggestion* suggestion = &suggestions.back(); 968 Suggestion* suggestion = &suggestions.back();
969 969
970 suggestion->value = credit_card->GetInfo(type, app_locale_); 970 suggestion->value = credit_card->GetInfo(type, app_locale_);
971 suggestion->icon = base::UTF8ToUTF16(credit_card->type()); 971 suggestion->icon = base::UTF8ToUTF16(credit_card->type());
972 suggestion->backend_id = credit_card->guid(); 972 suggestion->backend_id = credit_card->guid();
973 973
974 // If the value is the card number, the label is the expiration date. 974 // If the value is the card number, the label is the expiration date.
975 // Otherwise the label is the card number, or if that is empty the 975 // Otherwise the label is the card number, or if that is empty the
976 // cardholder name. The label should never repeat the value. 976 // cardholder name. The label should never repeat the value.
977 if (type.GetStorableType() == CREDIT_CARD_NUMBER) { 977 if (type.GetStorableType() == CREDIT_CARD_NUMBER) {
978 suggestion->value = credit_card->TypeAndLastFourDigits(); 978 suggestion->value = credit_card->TypeAndLastFourDigitsForDisplay();
979 suggestion->label = credit_card->GetInfo( 979 suggestion->label = credit_card->GetInfo(
980 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_); 980 AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR), app_locale_);
981 } else if (credit_card->number().empty()) { 981 } else if (credit_card->number().empty()) {
982 if (type.GetStorableType() != CREDIT_CARD_NAME) { 982 if (type.GetStorableType() != CREDIT_CARD_NAME) {
983 suggestion->label = 983 suggestion->label =
984 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_); 984 credit_card->GetInfo(AutofillType(CREDIT_CARD_NAME), app_locale_);
985 } 985 }
986 } else { 986 } else {
987 #if defined(OS_ANDROID) 987 #if defined(OS_ANDROID)
988 // Since Android places the label on its own row, there's more horizontal 988 // Since Android places the label on its own row, there's more horizontal
989 // space to work with. Show "Amex - 1234" rather than desktop's "*1234". 989 // space to work with. Show "Amex ***1234" rather than desktop's "*1234".
990 suggestion->label = credit_card->TypeAndLastFourDigits(); 990 suggestion->label = credit_card->TypeAndLastFourDigitsForDisplay();
991 #else 991 #else
992 suggestion->label = base::ASCIIToUTF16("*"); 992 suggestion->label = base::ASCIIToUTF16("*");
993 suggestion->label.append(credit_card->LastFourDigits()); 993 suggestion->label.append(credit_card->LastFourDigits());
994 #endif 994 #endif
995 } 995 }
996 } 996 }
997 return suggestions; 997 return suggestions;
998 } 998 }
999 999
1000 bool PersonalDataManager::IsAutofillEnabled() const { 1000 bool PersonalDataManager::IsAutofillEnabled() const {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 web_profiles().end()); 1370 web_profiles().end());
1371 if (IsExperimentalWalletIntegrationEnabled() && 1371 if (IsExperimentalWalletIntegrationEnabled() &&
1372 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) { 1372 pref_service_->GetBoolean(prefs::kAutofillWalletImportEnabled)) {
1373 profiles_.insert( 1373 profiles_.insert(
1374 profiles_.end(), server_profiles_.begin(), server_profiles_.end()); 1374 profiles_.end(), server_profiles_.begin(), server_profiles_.end());
1375 } 1375 }
1376 return profiles_; 1376 return profiles_;
1377 } 1377 }
1378 1378
1379 } // namespace autofill 1379 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698