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 1eddaf56a271eecb2dcc4b95b4059054c51b8c10..0cd2a72ab0226387e8d4a815b7becf30bbdc6874 100644 |
--- a/components/autofill/core/browser/autofill_manager.cc |
+++ b/components/autofill/core/browser/autofill_manager.cc |
@@ -209,6 +209,7 @@ AutofillManager::AutofillManager( |
user_did_accept_upload_prompt_(false), |
external_delegate_(NULL), |
test_delegate_(NULL), |
+ assist_manager_(new AssistManager(this)), |
weak_ptr_factory_(this) { |
if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) { |
download_manager_.reset(new AutofillDownloadManager(driver, this)); |
@@ -1291,6 +1292,7 @@ void AutofillManager::Reset() { |
new AutofillMetrics::FormEventLogger(false /* is_for_credit_card */)); |
credit_card_form_event_logger_.reset( |
new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)); |
+ assist_manager_->Reset(); |
has_logged_autofill_enabled_ = false; |
has_logged_address_suggestions_count_ = false; |
did_show_suggestions_ = false; |
@@ -1330,6 +1332,7 @@ AutofillManager::AutofillManager(AutofillDriver* driver, |
unmasking_query_id_(-1), |
external_delegate_(NULL), |
test_delegate_(NULL), |
+ assist_manager_(new AssistManager(this)), |
weak_ptr_factory_(this) { |
DCHECK(driver_); |
DCHECK(client_); |
@@ -1778,6 +1781,16 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) { |
#endif |
} |
+ if (assist_manager_->CanShowCreditCardAssist(form_structures_.get())) { |
+ const std::vector<CreditCard*> cards = |
+ 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[0]->IsExpired(base::Time::Now())) { |
+ assist_manager_->ShowAssistForCreditCard(*cards[0]); |
+ } |
+ } |
+ |
// For the |non_queryable_forms|, we have all the field type info we're ever |
// going to get about them. For the other forms, we'll wait until we get a |
// response from the server. |