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

Unified Diff: components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.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/ui/card_unmask_prompt_controller_impl.cc
diff --git a/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc b/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc
index 435e00caf8235a253f4f712ed3c1b4ce618385c6..d6e089c837a76f16698fadfe002f132ac22b99c7 100644
--- a/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc
+++ b/components/autofill/core/browser/ui/card_unmask_prompt_controller_impl.cc
@@ -16,6 +16,7 @@
#include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
#include "components/autofill/core/browser/validation.h"
+#include "components/autofill/core/common/autofill_clock.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/prefs/pref_service.h"
#include "grit/components_scaled_resources.h"
@@ -50,7 +51,7 @@ void CardUnmaskPromptControllerImpl::ShowPrompt(
card_unmask_view_->ControllerGone();
new_card_link_clicked_ = false;
- shown_timestamp_ = base::Time::Now();
+ shown_timestamp_ = AutofillClock::Now();
pending_response_ = CardUnmaskDelegate::UnmaskResponse();
card_unmask_view_ = card_unmask_view;
card_ = card;
@@ -107,8 +108,8 @@ void CardUnmaskPromptControllerImpl::OnVerificationResult(
unmasking_result_ = result;
AutofillMetrics::LogRealPanResult(result);
- AutofillMetrics::LogUnmaskingDuration(base::Time::Now() - verify_timestamp_,
- result);
+ AutofillMetrics::LogUnmaskingDuration(
+ AutofillClock::Now() - verify_timestamp_, result);
card_unmask_view_->GotVerificationResult(error_message,
AllowsRetry(result));
}
@@ -124,14 +125,14 @@ void CardUnmaskPromptControllerImpl::LogOnCloseEvents() {
AutofillMetrics::UnmaskPromptEvent close_reason_event = GetCloseReasonEvent();
AutofillMetrics::LogUnmaskPromptEvent(close_reason_event);
AutofillMetrics::LogUnmaskPromptEventDuration(
- base::Time::Now() - shown_timestamp_, close_reason_event);
+ AutofillClock::Now() - shown_timestamp_, close_reason_event);
if (close_reason_event == AutofillMetrics::UNMASK_PROMPT_CLOSED_NO_ATTEMPTS)
return;
if (close_reason_event ==
AutofillMetrics::UNMASK_PROMPT_CLOSED_ABANDON_UNMASKING) {
- AutofillMetrics::LogTimeBeforeAbandonUnmasking(base::Time::Now() -
+ AutofillMetrics::LogTimeBeforeAbandonUnmasking(AutofillClock::Now() -
verify_timestamp_);
}
@@ -186,7 +187,7 @@ void CardUnmaskPromptControllerImpl::OnUnmaskResponse(
const base::string16& exp_month,
const base::string16& exp_year,
bool should_store_pan) {
- verify_timestamp_ = base::Time::Now();
+ verify_timestamp_ = AutofillClock::Now();
unmasking_number_of_attempts_++;
unmasking_result_ = AutofillClient::NONE;
card_unmask_view_->DisableAndWaitForVerification();
@@ -256,7 +257,7 @@ int CardUnmaskPromptControllerImpl::GetCvcImageRid() const {
}
bool CardUnmaskPromptControllerImpl::ShouldRequestExpirationDate() const {
- return card_.ShouldUpdateExpiration(base::Time::Now()) ||
+ return card_.ShouldUpdateExpiration(AutofillClock::Now()) ||
new_card_link_clicked_;
}
@@ -300,12 +301,12 @@ bool CardUnmaskPromptControllerImpl::InputExpirationIsValid(
// Convert 2 digit year to 4 digit year.
if (year_value < 100) {
base::Time::Exploded now;
- base::Time::Now().LocalExplode(&now);
+ AutofillClock::Now().LocalExplode(&now);
year_value += (now.year / 100) * 100;
}
return IsValidCreditCardExpirationDate(year_value, month_value,
- base::Time::Now());
+ AutofillClock::Now());
}
base::TimeDelta CardUnmaskPromptControllerImpl::GetSuccessMessageDuration()
« no previous file with comments | « components/autofill/core/browser/test_autofill_clock.cc ('k') | components/autofill/core/browser/webdata/autofill_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698