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

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

Issue 2026353002: [Autofill] Credit Card Assist Infobar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bool fix Created 4 years, 5 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 1eddaf56a271eecb2dcc4b95b4059054c51b8c10..f4d256e8c90442c925a2cc7f2507c998de6e7aad 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_(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_(this),
weak_ptr_factory_(this) {
DCHECK(driver_);
DCHECK(client_);
@@ -1778,6 +1781,15 @@ 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()))
please use gerrit instead 2016/07/29 16:33:20 Nit: Using .front() instead of [0] would be more i
Mathieu 2016/07/29 20:19:17 Done.
+ assist_manager_.ShowAssistForCreditCard(*cards[0]);
please use gerrit instead 2016/07/29 16:33:20 Ditto
Mathieu 2016/07/29 20:19:17 Done.
+ }
+
// 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.

Powered by Google App Engine
This is Rietveld 408576698