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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 2212063002: [Autofill] Implement Autofill Assistant infobar for iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ifdef Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/autofill/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)), 201 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)),
202 has_logged_autofill_enabled_(false), 202 has_logged_autofill_enabled_(false),
203 has_logged_address_suggestions_count_(false), 203 has_logged_address_suggestions_count_(false),
204 did_show_suggestions_(false), 204 did_show_suggestions_(false),
205 user_did_type_(false), 205 user_did_type_(false),
206 user_did_autofill_(false), 206 user_did_autofill_(false),
207 user_did_edit_autofilled_field_(false), 207 user_did_edit_autofilled_field_(false),
208 user_did_accept_upload_prompt_(false), 208 user_did_accept_upload_prompt_(false),
209 external_delegate_(NULL), 209 external_delegate_(NULL),
210 test_delegate_(NULL), 210 test_delegate_(NULL),
211 #if defined(OS_ANDROID) 211 #if defined(OS_ANDROID) || defined(OS_IOS)
212 autofill_assistant_(this), 212 autofill_assistant_(this),
213 #endif 213 #endif
214 weak_ptr_factory_(this) { 214 weak_ptr_factory_(this) {
215 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) { 215 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) {
216 download_manager_.reset(new AutofillDownloadManager(driver, this)); 216 download_manager_.reset(new AutofillDownloadManager(driver, this));
217 } 217 }
218 CountryNames::SetLocaleString(app_locale_); 218 CountryNames::SetLocaleString(app_locale_);
219 if (personal_data_ && client_) 219 if (personal_data_ && client_)
220 personal_data_->OnSyncServiceInitialized(client_->GetSyncService()); 220 personal_data_->OnSyncServiceInitialized(client_->GetSyncService());
221 } 221 }
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 void AutofillManager::Reset() { 1281 void AutofillManager::Reset() {
1282 // Note that upload_request_ is not reset here because the prompt to 1282 // Note that upload_request_ is not reset here because the prompt to
1283 // save a card is shown after page navigation. 1283 // save a card is shown after page navigation.
1284 ProcessPendingFormForUpload(); 1284 ProcessPendingFormForUpload();
1285 DCHECK(!pending_form_data_); 1285 DCHECK(!pending_form_data_);
1286 form_structures_.clear(); 1286 form_structures_.clear();
1287 address_form_event_logger_.reset( 1287 address_form_event_logger_.reset(
1288 new AutofillMetrics::FormEventLogger(false /* is_for_credit_card */)); 1288 new AutofillMetrics::FormEventLogger(false /* is_for_credit_card */));
1289 credit_card_form_event_logger_.reset( 1289 credit_card_form_event_logger_.reset(
1290 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)); 1290 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */));
1291 #if defined(OS_ANDROID) 1291 #if defined(OS_ANDROID) || defined(OS_IOS)
1292 autofill_assistant_.Reset(); 1292 autofill_assistant_.Reset();
1293 #endif 1293 #endif
1294 has_logged_autofill_enabled_ = false; 1294 has_logged_autofill_enabled_ = false;
1295 has_logged_address_suggestions_count_ = false; 1295 has_logged_address_suggestions_count_ = false;
1296 did_show_suggestions_ = false; 1296 did_show_suggestions_ = false;
1297 user_did_type_ = false; 1297 user_did_type_ = false;
1298 user_did_autofill_ = false; 1298 user_did_autofill_ = false;
1299 user_did_edit_autofilled_field_ = false; 1299 user_did_edit_autofilled_field_ = false;
1300 masked_card_ = CreditCard(); 1300 masked_card_ = CreditCard();
1301 unmasking_query_id_ = -1; 1301 unmasking_query_id_ = -1;
(...skipping 21 matching lines...) Expand all
1323 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)), 1323 new AutofillMetrics::FormEventLogger(true /* is_for_credit_card */)),
1324 has_logged_autofill_enabled_(false), 1324 has_logged_autofill_enabled_(false),
1325 has_logged_address_suggestions_count_(false), 1325 has_logged_address_suggestions_count_(false),
1326 did_show_suggestions_(false), 1326 did_show_suggestions_(false),
1327 user_did_type_(false), 1327 user_did_type_(false),
1328 user_did_autofill_(false), 1328 user_did_autofill_(false),
1329 user_did_edit_autofilled_field_(false), 1329 user_did_edit_autofilled_field_(false),
1330 unmasking_query_id_(-1), 1330 unmasking_query_id_(-1),
1331 external_delegate_(NULL), 1331 external_delegate_(NULL),
1332 test_delegate_(NULL), 1332 test_delegate_(NULL),
1333 #if defined(OS_ANDROID) 1333 #if defined(OS_ANDROID) || defined(OS_IOS)
1334 autofill_assistant_(this), 1334 autofill_assistant_(this),
1335 #endif 1335 #endif
1336 weak_ptr_factory_(this) { 1336 weak_ptr_factory_(this) {
1337 DCHECK(driver_); 1337 DCHECK(driver_);
1338 DCHECK(client_); 1338 DCHECK(client_);
1339 CountryNames::SetLocaleString(app_locale_); 1339 CountryNames::SetLocaleString(app_locale_);
1340 } 1340 }
1341 1341
1342 bool AutofillManager::RefreshDataModels() { 1342 bool AutofillManager::RefreshDataModels() {
1343 if (!IsAutofillEnabled()) 1343 if (!IsAutofillEnabled())
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
1774 if (!queryable_forms.empty() || !non_queryable_forms.empty()) { 1774 if (!queryable_forms.empty() || !non_queryable_forms.empty()) {
1775 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED); 1775 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED);
1776 #if defined(OS_IOS) 1776 #if defined(OS_IOS)
1777 // Log this from same location as AutofillMetrics::FORMS_LOADED to ensure 1777 // Log this from same location as AutofillMetrics::FORMS_LOADED to ensure
1778 // that KeyboardAccessoryButtonsIOS and UserHappiness UMA metrics will be 1778 // that KeyboardAccessoryButtonsIOS and UserHappiness UMA metrics will be
1779 // directly comparable. 1779 // directly comparable.
1780 KeyboardAccessoryMetricsLogger::OnFormsLoaded(); 1780 KeyboardAccessoryMetricsLogger::OnFormsLoaded();
1781 #endif 1781 #endif
1782 } 1782 }
1783 1783
1784 #if defined(OS_ANDROID) 1784 #if defined(OS_ANDROID) || defined(OS_IOS)
1785 // When a credit card form is parsed and conditions are met, show an infobar 1785 // When a credit card form is parsed and conditions are met, show an infobar
1786 // prompt for credit card assisted filling. Upon accepting the infobar, the 1786 // prompt for credit card assisted filling. Upon accepting the infobar, the
1787 // form will automatically be filled with the user's information through this 1787 // form will automatically be filled with the user's information through this
1788 // class' FillCreditCardForm(). 1788 // class' FillCreditCardForm().
1789 if (autofill_assistant_.CanShowCreditCardAssist(form_structures_.get())) { 1789 if (autofill_assistant_.CanShowCreditCardAssist(form_structures_.get())) {
1790 const std::vector<CreditCard*> cards = 1790 const std::vector<CreditCard*> cards =
1791 personal_data_->GetCreditCardsToSuggest(); 1791 personal_data_->GetCreditCardsToSuggest();
1792 // Expired cards are last in the sorted order, so if the first one is 1792 // Expired cards are last in the sorted order, so if the first one is
1793 // expired, they all are. 1793 // expired, they all are.
1794 if (!cards.empty() && !cards.front()->IsExpired(base::Time::Now())) 1794 if (!cards.empty() && !cards.front()->IsExpired(base::Time::Now()))
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 if (i > 0) 2065 if (i > 0)
2066 fputs("Next oldest form:\n", file); 2066 fputs("Next oldest form:\n", file);
2067 } 2067 }
2068 fputs("\n", file); 2068 fputs("\n", file);
2069 2069
2070 fclose(file); 2070 fclose(file);
2071 } 2071 }
2072 #endif // ENABLE_FORM_DEBUG_DUMP 2072 #endif // ENABLE_FORM_DEBUG_DUMP
2073 2073
2074 } // namespace autofill 2074 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_manager.h ('k') | components/autofill/core/browser/credit_card.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698