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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Added DCHECK 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 815c74247528f834ede152f626927ce6a6beffba..72cf42156b3eb55a299558fdbe890ff651ddb29b 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -51,6 +51,7 @@
#include "components/autofill/core/browser/phone_number_i18n.h"
#include "components/autofill/core/browser/popup_item_ids.h"
#include "components/autofill/core/browser/validation.h"
+#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_data_validation.h"
#include "components/autofill/core/common/autofill_pref_names.h"
@@ -1229,7 +1230,7 @@ bool AutofillManager::GetProfilesForCreditCardUpload(
address_upload_decision_metric,
std::string* rappor_metric_name) const {
std::vector<AutofillProfile> candidate_profiles;
- const base::Time now = base::Time::Now();
+ const base::Time now = AutofillClock::Now();
const base::TimeDelta fifteen_minutes = base::TimeDelta::FromMinutes(15);
// First, collect all of the addresses used recently.
@@ -1597,7 +1598,7 @@ void AutofillManager::FillOrPreviewDataModelForm(
} else if (is_credit_card && IsCreditCardExpirationType(
cached_field->Type().GetStorableType()) &&
static_cast<const CreditCard*>(&data_model)
- ->IsExpired(base::Time::Now())) {
+ ->IsExpired(AutofillClock::Now())) {
// Don't fill expired cards expiration date.
value = base::string16();
}
@@ -1895,7 +1896,7 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) {
personal_data_->GetCreditCardsToSuggest();
// Expired cards are last in the sorted order, so if the first one is
// expired, they all are.
- if (!cards.empty() && !cards.front()->IsExpired(base::Time::Now()))
+ if (!cards.empty() && !cards.front()->IsExpired(AutofillClock::Now()))
autofill_assistant_.ShowAssistForCreditCard(*cards.front());
}
#endif
« no previous file with comments | « components/autofill/core/browser/autofill_data_model.cc ('k') | components/autofill/core/browser/autofill_profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698