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 // See http://crbug.com/441488 for potential improvements to the server |
Mathieu
2016/02/23 15:23:03
this bug has been closed, but I believe we are not
sebsg
2016/02/24 18:49:44
Done.
| |
503 // which may obviate the need for this logic. | 503 // which may obviate the need for this logic. |
504 bool believe_server = | 504 bool believe_server = |
505 !(server_type_ == NAME_FULL && heuristic_type_ == CREDIT_CARD_NAME) && | 505 !(server_type_ == NAME_FULL && heuristic_type_ == CREDIT_CARD_NAME) && |
506 !(server_type_ == CREDIT_CARD_NAME && heuristic_type_ == NAME_FULL) && | 506 !(server_type_ == CREDIT_CARD_NAME && heuristic_type_ == NAME_FULL) && |
507 !(server_type_ == NAME_FIRST && | |
508 heuristic_type_ == CREDIT_CARD_NAME_FIRST) && | |
509 !(server_type_ == NAME_LAST && | |
510 heuristic_type_ == CREDIT_CARD_NAME_LAST) && | |
507 // CVC is sometimes type="password", which tricks the server. | 511 // CVC is sometimes type="password", which tricks the server. |
508 // See http://crbug.com/469007 | 512 // See http://crbug.com/469007 |
509 !(AutofillType(server_type_).group() == PASSWORD_FIELD && | 513 !(AutofillType(server_type_).group() == PASSWORD_FIELD && |
510 heuristic_type_ == CREDIT_CARD_VERIFICATION_CODE); | 514 heuristic_type_ == CREDIT_CARD_VERIFICATION_CODE); |
511 if (believe_server) | 515 if (believe_server) |
512 return AutofillType(server_type_); | 516 return AutofillType(server_type_); |
513 } | 517 } |
514 | 518 |
515 return AutofillType(heuristic_type_); | 519 return AutofillType(heuristic_type_); |
516 } | 520 } |
517 | 521 |
518 bool AutofillField::IsEmpty() const { | 522 bool AutofillField::IsEmpty() const { |
519 return value.empty(); | 523 return value.empty(); |
520 } | 524 } |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
624 if (compare.StringsEqual(value_stripped, option_contents)) { | 628 if (compare.StringsEqual(value_stripped, option_contents)) { |
625 if (index) | 629 if (index) |
626 *index = i; | 630 *index = i; |
627 return true; | 631 return true; |
628 } | 632 } |
629 } | 633 } |
630 return false; | 634 return false; |
631 } | 635 } |
632 | 636 |
633 } // namespace autofill | 637 } // namespace autofill |
OLD | NEW |