| 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/string_search.h" | 10 #include "base/i18n/string_search.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 phone_part_ = IGNORED; | 492 phone_part_ = IGNORED; |
| 493 } | 493 } |
| 494 | 494 |
| 495 AutofillType AutofillField::Type() const { | 495 AutofillType AutofillField::Type() const { |
| 496 if (html_type_ != HTML_TYPE_UNSPECIFIED) | 496 if (html_type_ != HTML_TYPE_UNSPECIFIED) |
| 497 return AutofillType(html_type_, html_mode_); | 497 return AutofillType(html_type_, html_mode_); |
| 498 | 498 |
| 499 if (server_type_ != NO_SERVER_DATA) { | 499 if (server_type_ != NO_SERVER_DATA) { |
| 500 // See http://crbug.com/429236 for background on why we might not always | 500 // See http://crbug.com/429236 for background on why we might not always |
| 501 // believe the server. | 501 // believe the server. |
| 502 // See http://crbug.com/441488 for potential improvements to the server | 502 // TODO(http://crbug.com/589129) investigate how well the server is doing in |
| 503 // which may obviate the need for this logic. | 503 // regard to credit card predictions. |
| 504 bool believe_server = | 504 bool believe_server = |
| 505 !(server_type_ == NAME_FULL && heuristic_type_ == CREDIT_CARD_NAME) && | 505 !(server_type_ == NAME_FULL && |
| 506 !(server_type_ == CREDIT_CARD_NAME && heuristic_type_ == NAME_FULL) && | 506 heuristic_type_ == CREDIT_CARD_NAME_FULL) && |
| 507 !(server_type_ == CREDIT_CARD_NAME_FULL && |
| 508 heuristic_type_ == NAME_FULL) && |
| 509 !(server_type_ == NAME_FIRST && |
| 510 heuristic_type_ == CREDIT_CARD_NAME_FIRST) && |
| 511 !(server_type_ == NAME_LAST && |
| 512 heuristic_type_ == CREDIT_CARD_NAME_LAST) && |
| 507 // CVC is sometimes type="password", which tricks the server. | 513 // CVC is sometimes type="password", which tricks the server. |
| 508 // See http://crbug.com/469007 | 514 // See http://crbug.com/469007 |
| 509 !(AutofillType(server_type_).group() == PASSWORD_FIELD && | 515 !(AutofillType(server_type_).group() == PASSWORD_FIELD && |
| 510 heuristic_type_ == CREDIT_CARD_VERIFICATION_CODE); | 516 heuristic_type_ == CREDIT_CARD_VERIFICATION_CODE); |
| 511 if (believe_server) | 517 if (believe_server) |
| 512 return AutofillType(server_type_); | 518 return AutofillType(server_type_); |
| 513 } | 519 } |
| 514 | 520 |
| 515 return AutofillType(heuristic_type_); | 521 return AutofillType(heuristic_type_); |
| 516 } | 522 } |
| 517 | 523 |
| 518 bool AutofillField::IsEmpty() const { | 524 bool AutofillField::IsEmpty() const { |
| 519 return value.empty(); | 525 return value.empty(); |
| 520 } | 526 } |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 if (compare.StringsEqual(value_stripped, option_contents)) { | 630 if (compare.StringsEqual(value_stripped, option_contents)) { |
| 625 if (index) | 631 if (index) |
| 626 *index = i; | 632 *index = i; |
| 627 return true; | 633 return true; |
| 628 } | 634 } |
| 629 } | 635 } |
| 630 return false; | 636 return false; |
| 631 } | 637 } |
| 632 | 638 |
| 633 } // namespace autofill | 639 } // namespace autofill |
| OLD | NEW |