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

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

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Show expiration date if keyboard accessory is enabled Created 3 years, 11 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 // Returns true if all field types have valid values set and the card is not 167 // Returns true if all field types have valid values set and the card is not
168 // expired. MASKED_SERVER_CARDs will never be valid because the number is 168 // expired. MASKED_SERVER_CARDs will never be valid because the number is
169 // not complete. 169 // not complete.
170 bool IsValid() const; 170 bool IsValid() const;
171 171
172 // Returns the credit card number. 172 // Returns the credit card number.
173 const base::string16& number() const { return number_; } 173 const base::string16& number() const { return number_; }
174 // Sets |number_| to |number| and computes the appropriate card |type_|. 174 // Sets |number_| to |number| and computes the appropriate card |type_|.
175 void SetNumber(const base::string16& number); 175 void SetNumber(const base::string16& number);
176 176
177 // Returns the date(MM/DD) when the credit card was last used in autofill
Jared Saul 2017/01/04 22:01:24 nit: Add period at end
jiahuiguo 2017/01/18 00:13:44 Done.
178 base::string16 LastUsedDateAsString() const;
179
177 // Logs the number of days since the credit card was last used and records its 180 // Logs the number of days since the credit card was last used and records its
178 // use. 181 // use.
179 void RecordAndLogUse(); 182 void RecordAndLogUse();
180 183
181 // Converts a string representation of a month (such as "February" or "feb." 184 // Converts a string representation of a month (such as "February" or "feb."
182 // or "2") into a numeric value in [1, 12]. Returns true on successful 185 // or "2") into a numeric value in [1, 12]. Returns true on successful
183 // conversion or false if a month was not recognized. 186 // conversion or false if a month was not recognized.
184 static bool ConvertMonth(const base::string16& month, 187 static bool ConvertMonth(const base::string16& month,
185 const std::string& app_locale, 188 const std::string& app_locale,
186 int* num); 189 int* num);
(...skipping 19 matching lines...) Expand all
206 // The type of the card to fill in to the page, e.g. 'Mastercard'. 209 // The type of the card to fill in to the page, e.g. 'Mastercard'.
207 base::string16 TypeForFill() const; 210 base::string16 TypeForFill() const;
208 211
209 // The month and year are zero if not present. 212 // The month and year are zero if not present.
210 int Expiration4DigitYear() const { return expiration_year_; } 213 int Expiration4DigitYear() const { return expiration_year_; }
211 int Expiration2DigitYear() const { return expiration_year_ % 100; } 214 int Expiration2DigitYear() const { return expiration_year_ % 100; }
212 base::string16 ExpirationMonthAsString() const; 215 base::string16 ExpirationMonthAsString() const;
213 base::string16 Expiration4DigitYearAsString() const; 216 base::string16 Expiration4DigitYearAsString() const;
214 base::string16 Expiration2DigitYearAsString() const; 217 base::string16 Expiration2DigitYearAsString() const;
215 218
219 // Formatting month or day info to exact 2 digits
csashi 2017/01/03 20:54:06 Is it not "month *and* day" ?
csashi 2017/01/03 20:54:06 exactly 2 digits
jiahuiguo 2017/01/18 00:13:45 Done.
jiahuiguo 2017/01/18 00:13:45 Done.
220 base::string16 FormatDateTo2Digit(int dateInfo) const;
csashi 2017/01/03 20:54:06 Is it 2 digits? MM/DD is 4 digits.
Jared Saul 2017/01/04 22:01:23 Yeah but this function only takes a certain part o
jiahuiguo 2017/01/18 00:13:45 Done.
jiahuiguo 2017/01/18 00:13:45 It only formats month or day for each call, return
221
216 // Sets |expiration_month_| to the integer conversion of |text| and returns 222 // Sets |expiration_month_| to the integer conversion of |text| and returns
217 // whether the operation was successful. 223 // whether the operation was successful.
218 bool SetExpirationMonthFromString(const base::string16& text, 224 bool SetExpirationMonthFromString(const base::string16& text,
219 const std::string& app_locale); 225 const std::string& app_locale);
220 226
221 // Sets |expiration_year_| to the integer conversion of |text|. Will handle 227 // Sets |expiration_year_| to the integer conversion of |text|. Will handle
222 // 4-digit year or 2-digit year (eventually converted to 4-digit year). 228 // 4-digit year or 2-digit year (eventually converted to 4-digit year).
223 void SetExpirationYearFromString(const base::string16& text); 229 void SetExpirationYearFromString(const base::string16& text);
224 230
225 // Sets |expiration_year_| and |expiration_month_| to the integer conversion 231 // Sets |expiration_year_| and |expiration_month_| to the integer conversion
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 extern const char kGenericCard[]; 272 extern const char kGenericCard[];
267 extern const char kJCBCard[]; 273 extern const char kJCBCard[];
268 extern const char kMasterCard[]; 274 extern const char kMasterCard[];
269 extern const char kMirCard[]; 275 extern const char kMirCard[];
270 extern const char kUnionPay[]; 276 extern const char kUnionPay[];
271 extern const char kVisaCard[]; 277 extern const char kVisaCard[];
272 278
273 } // namespace autofill 279 } // namespace autofill
274 280
275 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 281 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698