| 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/credit_card.h" | 5 #include "components/autofill/core/browser/credit_card.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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 return true; | 567 return true; |
| 568 } | 568 } |
| 569 | 569 |
| 570 int CreditCard::Compare(const CreditCard& credit_card) const { | 570 int CreditCard::Compare(const CreditCard& credit_card) const { |
| 571 // The following CreditCard field types are the only types we store in the | 571 // The following CreditCard field types are the only types we store in the |
| 572 // WebDB so far, so we're only concerned with matching these types in the | 572 // WebDB so far, so we're only concerned with matching these types in the |
| 573 // credit card. | 573 // credit card. |
| 574 const ServerFieldType types[] = {CREDIT_CARD_NAME_FULL, CREDIT_CARD_NUMBER, | 574 const ServerFieldType types[] = {CREDIT_CARD_NAME_FULL, CREDIT_CARD_NUMBER, |
| 575 CREDIT_CARD_EXP_MONTH, | 575 CREDIT_CARD_EXP_MONTH, |
| 576 CREDIT_CARD_EXP_4_DIGIT_YEAR}; | 576 CREDIT_CARD_EXP_4_DIGIT_YEAR}; |
| 577 for (size_t i = 0; i < arraysize(types); ++i) { | 577 for (ServerFieldType type : types) { |
| 578 int comparison = | 578 int comparison = GetRawInfo(type).compare(credit_card.GetRawInfo(type)); |
| 579 GetRawInfo(types[i]).compare(credit_card.GetRawInfo(types[i])); | |
| 580 if (comparison != 0) | 579 if (comparison != 0) |
| 581 return comparison; | 580 return comparison; |
| 582 } | 581 } |
| 583 | 582 |
| 584 int comparison = server_id_.compare(credit_card.server_id_); | 583 int comparison = server_id_.compare(credit_card.server_id_); |
| 585 if (comparison != 0) | 584 if (comparison != 0) |
| 586 return comparison; | 585 return comparison; |
| 587 | 586 |
| 588 comparison = billing_address_id_.compare(credit_card.billing_address_id_); | 587 comparison = billing_address_id_.compare(credit_card.billing_address_id_); |
| 589 if (comparison != 0) | 588 if (comparison != 0) |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 const char kAmericanExpressCard[] = "americanExpressCC"; | 862 const char kAmericanExpressCard[] = "americanExpressCC"; |
| 864 const char kDinersCard[] = "dinersCC"; | 863 const char kDinersCard[] = "dinersCC"; |
| 865 const char kDiscoverCard[] = "discoverCC"; | 864 const char kDiscoverCard[] = "discoverCC"; |
| 866 const char kGenericCard[] = "genericCC"; | 865 const char kGenericCard[] = "genericCC"; |
| 867 const char kJCBCard[] = "jcbCC"; | 866 const char kJCBCard[] = "jcbCC"; |
| 868 const char kMasterCard[] = "masterCardCC"; | 867 const char kMasterCard[] = "masterCardCC"; |
| 869 const char kUnionPay[] = "unionPayCC"; | 868 const char kUnionPay[] = "unionPayCC"; |
| 870 const char kVisaCard[] = "visaCC"; | 869 const char kVisaCard[] = "visaCC"; |
| 871 | 870 |
| 872 } // namespace autofill | 871 } // namespace autofill |
| OLD | NEW |