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

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

Issue 2607043002: [Autofill] Credit Card Autofill Last Used Date Experiment (Closed)
Patch Set: Add date formatter based on pattern 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 // Logs the number of days since the credit card was last used and records its 177 // Returns the date when the credit card was last used in autofill, show
178 // use. 178 // expiration date if |show_expiration_date| is true, and show time detail
179 // if |show_time_detail| is true.
180 base::string16 GetLastUsedDateForDisplay(bool show_expiration_date,
181 bool show_time_detail) const;
182
183 // Logs the number of days since the credit card was last used and records
184 // its use.
179 void RecordAndLogUse(); 185 void RecordAndLogUse();
180 186
181 // Converts a string representation of a month (such as "February" or "feb." 187 // 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 188 // or "2") into a numeric value in [1, 12]. Returns true on successful
183 // conversion or false if a month was not recognized. 189 // conversion or false if a month was not recognized.
184 static bool ConvertMonth(const base::string16& month, 190 static bool ConvertMonth(const base::string16& month,
185 const std::string& app_locale, 191 const std::string& app_locale,
186 int* num); 192 int* num);
187 193
194 base::string16 GetShortMonthLabel(int32_t zero_base_month_index,
195 const std::string& app_locale) const;
196
188 // Returns whether the credit card is expired based on |current_time|. 197 // Returns whether the credit card is expired based on |current_time|.
189 bool IsExpired(const base::Time& current_time) const; 198 bool IsExpired(const base::Time& current_time) const;
190 199
191 // Whether the card expiration date should be updated. 200 // Whether the card expiration date should be updated.
192 bool ShouldUpdateExpiration(const base::Time& current_time) const; 201 bool ShouldUpdateExpiration(const base::Time& current_time) const;
193 202
194 const std::string& billing_address_id() const { return billing_address_id_; } 203 const std::string& billing_address_id() const { return billing_address_id_; }
195 void set_billing_address_id(const std::string& id) { 204 void set_billing_address_id(const std::string& id) {
196 billing_address_id_ = id; 205 billing_address_id_ = id;
197 } 206 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 extern const char kGenericCard[]; 275 extern const char kGenericCard[];
267 extern const char kJCBCard[]; 276 extern const char kJCBCard[];
268 extern const char kMasterCard[]; 277 extern const char kMasterCard[];
269 extern const char kMirCard[]; 278 extern const char kMirCard[];
270 extern const char kUnionPay[]; 279 extern const char kUnionPay[];
271 extern const char kVisaCard[]; 280 extern const char kVisaCard[];
272 281
273 } // namespace autofill 282 } // namespace autofill
274 283
275 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_ 284 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_CREDIT_CARD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698