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

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

Issue 1867523003: [Autofill] Suggest expired credit cards last. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactored CC suggestions to use IsExpired Created 4 years, 8 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // use. 189 // use.
190 void RecordAndLogUse(); 190 void RecordAndLogUse();
191 191
192 // Converts a string representation of a month (such as "February" or "feb." 192 // Converts a string representation of a month (such as "February" or "feb."
193 // or "2") into a numeric value in [1, 12]. Returns true on successful 193 // or "2") into a numeric value in [1, 12]. Returns true on successful
194 // conversion or false if a month was not recognized. 194 // conversion or false if a month was not recognized.
195 static bool ConvertMonth(const base::string16& month, 195 static bool ConvertMonth(const base::string16& month,
196 const std::string& app_locale, 196 const std::string& app_locale,
197 int* num); 197 int* num);
198 198
199 // Returns whether the credit card is expired base on the specified |time|.
200 bool IsExpired(base::Time::Exploded time) const;
201
199 private: 202 private:
200 // FormGroup: 203 // FormGroup:
201 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override; 204 void GetSupportedTypes(ServerFieldTypeSet* supported_types) const override;
202 205
203 // The type of the card to fill in to the page, e.g. 'Mastercard'. 206 // The type of the card to fill in to the page, e.g. 'Mastercard'.
204 base::string16 TypeForFill() const; 207 base::string16 TypeForFill() const;
205 208
206 // The month and year are zero if not present. 209 // The month and year are zero if not present.
207 int Expiration4DigitYear() const { return expiration_year_; } 210 int Expiration4DigitYear() const { return expiration_year_; }
208 int Expiration2DigitYear() const { return expiration_year_ % 100; } 211 int Expiration2DigitYear() const { return expiration_year_ % 100; }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 extern const char kDiscoverCard[]; 256 extern const char kDiscoverCard[];
254 extern const char kGenericCard[]; 257 extern const char kGenericCard[];
255 extern const char kJCBCard[]; 258 extern const char kJCBCard[];
256 extern const char kMasterCard[]; 259 extern const char kMasterCard[];
257 extern const char kUnionPay[]; 260 extern const char kUnionPay[];
258 extern const char kVisaCard[]; 261 extern const char kVisaCard[];
259 262
260 } // namespace autofill 263 } // namespace autofill
261 264
262 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 265 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698