| OLD | NEW |
| 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_field.h" | 5 #include "components/autofill/core/browser/autofill_field.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/i18n/case_conversion.h" | 10 #include "base/i18n/case_conversion.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 if (LastTwoDigitsMatch(value, field->option_values[i]) || | 282 if (LastTwoDigitsMatch(value, field->option_values[i]) || |
| 283 LastTwoDigitsMatch(value, field->option_contents[i])) { | 283 LastTwoDigitsMatch(value, field->option_contents[i])) { |
| 284 field->value = field->option_values[i]; | 284 field->value = field->option_values[i]; |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 } | 287 } |
| 288 | 288 |
| 289 return false; | 289 return false; |
| 290 } | 290 } |
| 291 | 291 |
| 292 // Try to fill a credit card type |value| (Visa, MasterCard, etc.) into the | 292 // Try to fill a credit card type |value| (Visa, Mastercard, etc.) into the |
| 293 // given |field|. We ignore whitespace when filling credit card types to | 293 // given |field|. We ignore whitespace when filling credit card types to |
| 294 // allow for cases such as "Master Card". | 294 // allow for cases such as "Master card". |
| 295 | 295 |
| 296 bool FillCreditCardTypeSelectControl(const base::string16& value, | 296 bool FillCreditCardTypeSelectControl(const base::string16& value, |
| 297 FormFieldData* field) { | 297 FormFieldData* field) { |
| 298 if (SetSelectControlValueSubstringMatch(value, /* ignore_whitespace= */ true, | 298 if (SetSelectControlValueSubstringMatch(value, /* ignore_whitespace= */ true, |
| 299 field)) { | 299 field)) { |
| 300 return true; | 300 return true; |
| 301 } else if (value == l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX)) { | 301 } else if (value == l10n_util::GetStringUTF16(IDS_AUTOFILL_CC_AMEX)) { |
| 302 // For American Express, also try filling as "AmEx". | 302 // For American Express, also try filling as "AmEx". |
| 303 return SetSelectControlValueSubstringMatch( | 303 return SetSelectControlValueSubstringMatch( |
| 304 ASCIIToUTF16("AmEx"), /* ignore_whitespace= */ true, field); | 304 ASCIIToUTF16("AmEx"), /* ignore_whitespace= */ true, field); |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 761 } |
| 762 return best_match; | 762 return best_match; |
| 763 } | 763 } |
| 764 | 764 |
| 765 bool AutofillField::IsCreditCardPrediction() const { | 765 bool AutofillField::IsCreditCardPrediction() const { |
| 766 return AutofillType(server_type_).group() == CREDIT_CARD || | 766 return AutofillType(server_type_).group() == CREDIT_CARD || |
| 767 AutofillType(heuristic_type_).group() == CREDIT_CARD; | 767 AutofillType(heuristic_type_).group() == CREDIT_CARD; |
| 768 } | 768 } |
| 769 | 769 |
| 770 } // namespace autofill | 770 } // namespace autofill |
| OLD | NEW |