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

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

Issue 2639403002: [Autofill] Remove direct use of base::Time::Now() in Autofill (Closed)
Patch Set: Rebase 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 230050832cbd2e6228907a269564e54567ef3f47..eb650cf326911b12996b1087ef6e81518d4d2ab3 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -34,6 +34,7 @@
#include "build/build_config.h"
#include "components/autofill/core/browser/autocomplete_history_manager.h"
#include "components/autofill/core/browser/autofill_client.h"
+#include "components/autofill/core/browser/autofill_clock.h"
#include "components/autofill/core/browser/autofill_data_model.h"
#include "components/autofill/core/browser/autofill_experiments.h"
#include "components/autofill/core/browser/autofill_external_delegate.h"
@@ -1198,7 +1199,7 @@ bool AutofillManager::GetProfilesForCreditCardUpload(
std::vector<AutofillProfile>* profiles,
const GURL& source_url) 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.
@@ -1566,7 +1567,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();
}
@@ -1864,7 +1865,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

Powered by Google App Engine
This is Rietveld 408576698