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

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

Issue 2249773002: Scan card holder name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass CreditCard, don't alter the constructor. Created 4 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
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate_unittest.cc ('k') | 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 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/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 void AutofillManager::ShowAutofillSettings() { 256 void AutofillManager::ShowAutofillSettings() {
257 client_->ShowAutofillSettings(); 257 client_->ShowAutofillSettings();
258 } 258 }
259 259
260 bool AutofillManager::ShouldShowScanCreditCard(const FormData& form, 260 bool AutofillManager::ShouldShowScanCreditCard(const FormData& form,
261 const FormFieldData& field) { 261 const FormFieldData& field) {
262 if (!client_->HasCreditCardScanFeature()) 262 if (!client_->HasCreditCardScanFeature())
263 return false; 263 return false;
264 264
265 AutofillField* autofill_field = GetAutofillField(form, field); 265 AutofillField* autofill_field = GetAutofillField(form, field);
266 if (!autofill_field || 266 if (!autofill_field)
267 autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) { 267 return false;
268
269 bool is_card_number_field =
270 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER &&
271 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
272 base::ASCIIToUTF16("0123456789"));
273 if (!is_card_number_field &&
274 autofill_field->Type().GetStorableType() != CREDIT_CARD_NAME_FULL) {
268 return false; 275 return false;
269 } 276 }
270 277
271 static const int kShowScanCreditCardMaxValueLength = 6; 278 static const int kShowScanCreditCardMaxValueLength = 6;
272 return field.value.size() <= kShowScanCreditCardMaxValueLength && 279 return field.value.size() <= kShowScanCreditCardMaxValueLength;
273 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
274 base::ASCIIToUTF16("0123456789"));
275 } 280 }
276 281
277 bool AutofillManager::ShouldShowCreditCardSigninPromo( 282 bool AutofillManager::ShouldShowCreditCardSigninPromo(
278 const FormData& form, 283 const FormData& form,
279 const FormFieldData& field) { 284 const FormFieldData& field) {
280 if (!IsAutofillCreditCardSigninPromoEnabled()) 285 if (!IsAutofillCreditCardSigninPromoEnabled())
281 return false; 286 return false;
282 287
283 // Check whether we are dealing with a credit card field and whether it's 288 // Check whether we are dealing with a credit card field and whether it's
284 // appropriate to show the promo (e.g. the platform is supported). 289 // appropriate to show the promo (e.g. the platform is supported).
(...skipping 1781 matching lines...) Expand 10 before | Expand all | Expand 10 after
2066 if (i > 0) 2071 if (i > 0)
2067 fputs("Next oldest form:\n", file); 2072 fputs("Next oldest form:\n", file);
2068 } 2073 }
2069 fputs("\n", file); 2074 fputs("\n", file);
2070 2075
2071 fclose(file); 2076 fclose(file);
2072 } 2077 }
2073 #endif // ENABLE_FORM_DEBUG_DUMP 2078 #endif // ENABLE_FORM_DEBUG_DUMP
2074 2079
2075 } // namespace autofill 2080 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698