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

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

Issue 2257493004: Add "AutofillScanCardholderName" feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable feature by default 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_experiments.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>
11 #include <limits> 11 #include <limits>
12 #include <map> 12 #include <map>
13 #include <set> 13 #include <set>
14 #include <utility> 14 #include <utility>
15 15
16 #include "base/bind.h" 16 #include "base/bind.h"
17 #include "base/command_line.h" 17 #include "base/command_line.h"
18 #include "base/containers/adapters.h" 18 #include "base/containers/adapters.h"
19 #include "base/feature_list.h"
19 #include "base/files/file_util.h" 20 #include "base/files/file_util.h"
20 #include "base/guid.h" 21 #include "base/guid.h"
21 #include "base/logging.h" 22 #include "base/logging.h"
22 #include "base/message_loop/message_loop.h" 23 #include "base/message_loop/message_loop.h"
23 #include "base/path_service.h" 24 #include "base/path_service.h"
24 #include "base/strings/string16.h" 25 #include "base/strings/string16.h"
25 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
27 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
28 #include "base/strings/utf_string_conversions.h" 29 #include "base/strings/utf_string_conversions.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return false; 264 return false;
264 265
265 AutofillField* autofill_field = GetAutofillField(form, field); 266 AutofillField* autofill_field = GetAutofillField(form, field);
266 if (!autofill_field) 267 if (!autofill_field)
267 return false; 268 return false;
268 269
269 bool is_card_number_field = 270 bool is_card_number_field =
270 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER && 271 autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER &&
271 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value), 272 base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
272 base::ASCIIToUTF16("0123456789")); 273 base::ASCIIToUTF16("0123456789"));
273 if (!is_card_number_field && 274
274 autofill_field->Type().GetStorableType() != CREDIT_CARD_NAME_FULL) { 275 bool is_scannable_name_on_card_field =
276 autofill_field->Type().GetStorableType() == CREDIT_CARD_NAME_FULL &&
277 base::FeatureList::IsEnabled(kAutofillScanCardholderName);
278
279 if (!is_card_number_field && !is_scannable_name_on_card_field)
275 return false; 280 return false;
276 }
277 281
278 static const int kShowScanCreditCardMaxValueLength = 6; 282 static const int kShowScanCreditCardMaxValueLength = 6;
279 return field.value.size() <= kShowScanCreditCardMaxValueLength; 283 return field.value.size() <= kShowScanCreditCardMaxValueLength;
280 } 284 }
281 285
282 bool AutofillManager::ShouldShowCreditCardSigninPromo( 286 bool AutofillManager::ShouldShowCreditCardSigninPromo(
283 const FormData& form, 287 const FormData& form,
284 const FormFieldData& field) { 288 const FormFieldData& field) {
285 if (!IsAutofillCreditCardSigninPromoEnabled()) 289 if (!IsAutofillCreditCardSigninPromoEnabled())
286 return false; 290 return false;
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
2071 if (i > 0) 2075 if (i > 0)
2072 fputs("Next oldest form:\n", file); 2076 fputs("Next oldest form:\n", file);
2073 } 2077 }
2074 fputs("\n", file); 2078 fputs("\n", file);
2075 2079
2076 fclose(file); 2080 fclose(file);
2077 } 2081 }
2078 #endif // ENABLE_FORM_DEBUG_DUMP 2082 #endif // ENABLE_FORM_DEBUG_DUMP
2079 2083
2080 } // namespace autofill 2084 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_experiments.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698