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

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

Issue 2424793002: Revert of Replace for loops with |arraysize| with for each loops (Closed)
Patch Set: Created 4 years, 2 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
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/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
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 (ServerFieldType type : types) { 577 for (size_t i = 0; i < arraysize(types); ++i) {
578 int comparison = GetRawInfo(type).compare(credit_card.GetRawInfo(type)); 578 int comparison =
579 GetRawInfo(types[i]).compare(credit_card.GetRawInfo(types[i]));
579 if (comparison != 0) 580 if (comparison != 0)
580 return comparison; 581 return comparison;
581 } 582 }
582 583
583 int comparison = server_id_.compare(credit_card.server_id_); 584 int comparison = server_id_.compare(credit_card.server_id_);
584 if (comparison != 0) 585 if (comparison != 0)
585 return comparison; 586 return comparison;
586 587
587 comparison = billing_address_id_.compare(credit_card.billing_address_id_); 588 comparison = billing_address_id_.compare(credit_card.billing_address_id_);
588 if (comparison != 0) 589 if (comparison != 0)
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 const char kAmericanExpressCard[] = "americanExpressCC"; 863 const char kAmericanExpressCard[] = "americanExpressCC";
863 const char kDinersCard[] = "dinersCC"; 864 const char kDinersCard[] = "dinersCC";
864 const char kDiscoverCard[] = "discoverCC"; 865 const char kDiscoverCard[] = "discoverCC";
865 const char kGenericCard[] = "genericCC"; 866 const char kGenericCard[] = "genericCC";
866 const char kJCBCard[] = "jcbCC"; 867 const char kJCBCard[] = "jcbCC";
867 const char kMasterCard[] = "masterCardCC"; 868 const char kMasterCard[] = "masterCardCC";
868 const char kUnionPay[] = "unionPayCC"; 869 const char kUnionPay[] = "unionPayCC";
869 const char kVisaCard[] = "visaCC"; 870 const char kVisaCard[] = "visaCC";
870 871
871 } // namespace autofill 872 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/contact_info_unittest.cc ('k') | components/autofill/core/browser/credit_card_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698