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

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

Issue 2839023003: WebView autofill implementation (Closed)
Patch Set: fix coordinates Created 3 years, 7 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 24 matching lines...) Expand all
35 #include "build/build_config.h" 35 #include "build/build_config.h"
36 #include "components/autofill/core/browser/autocomplete_history_manager.h" 36 #include "components/autofill/core/browser/autocomplete_history_manager.h"
37 #include "components/autofill/core/browser/autofill_client.h" 37 #include "components/autofill/core/browser/autofill_client.h"
38 #include "components/autofill/core/browser/autofill_data_model.h" 38 #include "components/autofill/core/browser/autofill_data_model.h"
39 #include "components/autofill/core/browser/autofill_experiments.h" 39 #include "components/autofill/core/browser/autofill_experiments.h"
40 #include "components/autofill/core/browser/autofill_external_delegate.h" 40 #include "components/autofill/core/browser/autofill_external_delegate.h"
41 #include "components/autofill/core/browser/autofill_field.h" 41 #include "components/autofill/core/browser/autofill_field.h"
42 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" 42 #include "components/autofill/core/browser/autofill_manager_test_delegate.h"
43 #include "components/autofill/core/browser/autofill_metrics.h" 43 #include "components/autofill/core/browser/autofill_metrics.h"
44 #include "components/autofill/core/browser/autofill_profile.h" 44 #include "components/autofill/core/browser/autofill_profile.h"
45 #include "components/autofill/core/browser/autofill_provider.h"
45 #include "components/autofill/core/browser/autofill_type.h" 46 #include "components/autofill/core/browser/autofill_type.h"
46 #include "components/autofill/core/browser/country_names.h" 47 #include "components/autofill/core/browser/country_names.h"
47 #include "components/autofill/core/browser/credit_card.h" 48 #include "components/autofill/core/browser/credit_card.h"
48 #include "components/autofill/core/browser/field_types.h" 49 #include "components/autofill/core/browser/field_types.h"
49 #include "components/autofill/core/browser/form_structure.h" 50 #include "components/autofill/core/browser/form_structure.h"
50 #include "components/autofill/core/browser/personal_data_manager.h" 51 #include "components/autofill/core/browser/personal_data_manager.h"
51 #include "components/autofill/core/browser/phone_number.h" 52 #include "components/autofill/core/browser/phone_number.h"
52 #include "components/autofill/core/browser/phone_number_i18n.h" 53 #include "components/autofill/core/browser/phone_number_i18n.h"
53 #include "components/autofill/core/browser/popup_item_ids.h" 54 #include "components/autofill/core/browser/popup_item_ids.h"
54 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h" 55 #include "components/autofill/core/browser/ui/save_card_bubble_controller.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 209
209 return cc_field_http_warning_suggestion; 210 return cc_field_http_warning_suggestion;
210 } 211 }
211 212
212 } // namespace 213 } // namespace
213 214
214 AutofillManager::AutofillManager( 215 AutofillManager::AutofillManager(
215 AutofillDriver* driver, 216 AutofillDriver* driver,
216 AutofillClient* client, 217 AutofillClient* client,
217 const std::string& app_locale, 218 const std::string& app_locale,
218 AutofillDownloadManagerState enable_download_manager) 219 AutofillDownloadManagerState enable_download_manager,
220 AutofillProvider* provider)
219 : driver_(driver), 221 : driver_(driver),
220 client_(client), 222 client_(client),
221 payments_client_(base::MakeUnique<payments::PaymentsClient>( 223 payments_client_(base::MakeUnique<payments::PaymentsClient>(
222 driver->GetURLRequestContext(), 224 driver->GetURLRequestContext(),
223 this)), 225 this)),
224 app_locale_(app_locale), 226 app_locale_(app_locale),
225 personal_data_(client->GetPersonalDataManager()), 227 personal_data_(client->GetPersonalDataManager()),
226 autocomplete_history_manager_( 228 autocomplete_history_manager_(
227 base::MakeUnique<AutocompleteHistoryManager>(driver, client)), 229 base::MakeUnique<AutocompleteHistoryManager>(driver, client)),
228 form_interactions_ukm_logger_( 230 form_interactions_ukm_logger_(
(...skipping 13 matching lines...) Expand all
242 user_did_type_(false), 244 user_did_type_(false),
243 user_did_autofill_(false), 245 user_did_autofill_(false),
244 user_did_edit_autofilled_field_(false), 246 user_did_edit_autofilled_field_(false),
245 user_did_accept_upload_prompt_(false), 247 user_did_accept_upload_prompt_(false),
246 should_cvc_be_requested_(false), 248 should_cvc_be_requested_(false),
247 external_delegate_(NULL), 249 external_delegate_(NULL),
248 test_delegate_(NULL), 250 test_delegate_(NULL),
249 #if defined(OS_ANDROID) || defined(OS_IOS) 251 #if defined(OS_ANDROID) || defined(OS_IOS)
250 autofill_assistant_(this), 252 autofill_assistant_(this),
251 #endif 253 #endif
254 provider_(provider),
252 weak_ptr_factory_(this) { 255 weak_ptr_factory_(this) {
253 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) { 256 if (enable_download_manager == ENABLE_AUTOFILL_DOWNLOAD_MANAGER) {
254 download_manager_.reset(new AutofillDownloadManager(driver, this)); 257 download_manager_.reset(new AutofillDownloadManager(driver, this));
255 } 258 }
256 CountryNames::SetLocaleString(app_locale_); 259 CountryNames::SetLocaleString(app_locale_);
257 if (personal_data_ && client_) 260 if (personal_data_ && client_)
258 personal_data_->OnSyncServiceInitialized(client_->GetSyncService()); 261 personal_data_->OnSyncServiceInitialized(client_->GetSyncService());
259 262
260 if (personal_data_ && driver_) 263 if (personal_data_ && driver_)
261 personal_data_->SetURLRequestContextGetter(driver_->GetURLRequestContext()); 264 personal_data_->SetURLRequestContextGetter(driver_->GetURLRequestContext());
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 363 }
361 364
362 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms, 365 void AutofillManager::OnFormsSeen(const std::vector<FormData>& forms,
363 const TimeTicks& timestamp) { 366 const TimeTicks& timestamp) {
364 if (!IsValidFormDataVector(forms)) 367 if (!IsValidFormDataVector(forms))
365 return; 368 return;
366 369
367 if (!driver_->RendererIsAvailable()) 370 if (!driver_->RendererIsAvailable())
368 return; 371 return;
369 372
373 if (provider_)
374 return;
375
370 bool enabled = IsAutofillEnabled(); 376 bool enabled = IsAutofillEnabled();
371 if (!has_logged_autofill_enabled_) { 377 if (!has_logged_autofill_enabled_) {
372 AutofillMetrics::LogIsAutofillEnabledAtPageLoad(enabled); 378 AutofillMetrics::LogIsAutofillEnabledAtPageLoad(enabled);
373 has_logged_autofill_enabled_ = true; 379 has_logged_autofill_enabled_ = true;
374 } 380 }
375 381
376 if (!enabled) 382 if (!enabled)
377 return; 383 return;
378 384
379 for (const FormData& form : forms) { 385 for (const FormData& form : forms) {
380 forms_loaded_timestamps_[form] = timestamp; 386 forms_loaded_timestamps_[form] = timestamp;
381 } 387 }
382 388
383 ParseForms(forms); 389 ParseForms(forms);
384 } 390 }
385 391
386 bool AutofillManager::OnWillSubmitForm(const FormData& form, 392 bool AutofillManager::OnWillSubmitForm(const FormData& form,
387 const TimeTicks& timestamp) { 393 const TimeTicks& timestamp) {
388 if (!IsValidFormData(form)) 394 if (!IsValidFormData(form))
389 return false; 395 return false;
390 396
397 if (provider_) {
398 provider_->OnWillSubmitForm(this, form, timestamp);
399 return true;
400 }
401
391 // We will always give Autocomplete a chance to save the data. 402 // We will always give Autocomplete a chance to save the data.
392 std::unique_ptr<FormStructure> submitted_form = ValidateSubmittedForm(form); 403 std::unique_ptr<FormStructure> submitted_form = ValidateSubmittedForm(form);
393 if (!submitted_form) { 404 if (!submitted_form) {
394 autocomplete_history_manager_->OnWillSubmitForm(form); 405 autocomplete_history_manager_->OnWillSubmitForm(form);
395 return false; 406 return false;
396 } 407 }
397 408
398 // However, if Autofill has recognized a field as CVC, that shouldn't be 409 // However, if Autofill has recognized a field as CVC, that shouldn't be
399 // saved. 410 // saved.
400 FormData form_for_autocomplete = submitted_form->ToFormData(); 411 FormData form_for_autocomplete = submitted_form->ToFormData();
(...skipping 10 matching lines...) Expand all
411 422
412 StartUploadProcess(std::move(submitted_form), timestamp, true); 423 StartUploadProcess(std::move(submitted_form), timestamp, true);
413 424
414 return true; 425 return true;
415 } 426 }
416 427
417 bool AutofillManager::OnFormSubmitted(const FormData& form) { 428 bool AutofillManager::OnFormSubmitted(const FormData& form) {
418 if (!IsValidFormData(form)) 429 if (!IsValidFormData(form))
419 return false; 430 return false;
420 431
432 if (provider_)
433 return true;
434
421 // We will always give Autocomplete a chance to save the data. 435 // We will always give Autocomplete a chance to save the data.
422 std::unique_ptr<FormStructure> submitted_form = ValidateSubmittedForm(form); 436 std::unique_ptr<FormStructure> submitted_form = ValidateSubmittedForm(form);
423 if (!submitted_form) { 437 if (!submitted_form) {
424 return false; 438 return false;
425 } 439 }
426 440
427 address_form_event_logger_->OnFormSubmitted(); 441 address_form_event_logger_->OnFormSubmitted();
428 credit_card_form_event_logger_->OnFormSubmitted(); 442 credit_card_form_event_logger_->OnFormSubmitted();
429 443
430 // Update Personal Data with the form's submitted data. 444 // Update Personal Data with the form's submitted data.
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 519
506 StartUploadProcess(std::move(upload_form), TimeTicks::Now(), false); 520 StartUploadProcess(std::move(upload_form), TimeTicks::Now(), false);
507 } 521 }
508 522
509 void AutofillManager::OnTextFieldDidChange(const FormData& form, 523 void AutofillManager::OnTextFieldDidChange(const FormData& form,
510 const FormFieldData& field, 524 const FormFieldData& field,
511 const TimeTicks& timestamp) { 525 const TimeTicks& timestamp) {
512 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) 526 if (!IsValidFormData(form) || !IsValidFormFieldData(field))
513 return; 527 return;
514 528
529 if (provider_) {
530 provider_->OnTextFieldDidChange(this, form, field, timestamp);
sebsg 2017/05/08 15:38:17 I notice there are a lot of if statements like thi
michaelbai 2017/05/09 00:27:03 We were planing to cherry-pick this patch to M59,
Roger McFarlane (Chromium) 2017/05/10 02:31:54 That generally seems like a good approach. But, y
531 return;
532 }
533
515 if (test_delegate_) 534 if (test_delegate_)
516 test_delegate_->OnTextFieldChanged(); 535 test_delegate_->OnTextFieldChanged();
517 536
518 FormStructure* form_structure = NULL; 537 FormStructure* form_structure = NULL;
519 AutofillField* autofill_field = NULL; 538 AutofillField* autofill_field = NULL;
520 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field)) 539 if (!GetCachedFormAndField(form, field, &form_structure, &autofill_field))
521 return; 540 return;
522 541
523 UpdatePendingForm(form); 542 UpdatePendingForm(form);
524 543
(...skipping 29 matching lines...) Expand all
554 void AutofillManager::OnQueryFormFieldAutofill(int query_id, 573 void AutofillManager::OnQueryFormFieldAutofill(int query_id,
555 const FormData& form, 574 const FormData& form,
556 const FormFieldData& field, 575 const FormFieldData& field,
557 const gfx::RectF& bounding_box) { 576 const gfx::RectF& bounding_box) {
558 if (!IsValidFormData(form) || !IsValidFormFieldData(field)) 577 if (!IsValidFormData(form) || !IsValidFormFieldData(field))
559 return; 578 return;
560 579
561 gfx::RectF transformed_box = 580 gfx::RectF transformed_box =
562 driver_->TransformBoundingBoxToViewportCoordinates(bounding_box); 581 driver_->TransformBoundingBoxToViewportCoordinates(bounding_box);
563 582
583 if (provider_) {
584 provider_->OnQueryFormFieldAutofill(this, query_id, form, field,
585 transformed_box);
586 return;
587 }
588
564 external_delegate_->OnQuery(query_id, form, field, transformed_box); 589 external_delegate_->OnQuery(query_id, form, field, transformed_box);
565 590
566 // Need to refresh models before using the form_event_loggers. 591 // Need to refresh models before using the form_event_loggers.
567 bool is_autofill_possible = RefreshDataModels(); 592 bool is_autofill_possible = RefreshDataModels();
568 593
569 FormStructure* form_structure = NULL; 594 FormStructure* form_structure = NULL;
570 AutofillField* autofill_field = NULL; 595 AutofillField* autofill_field = NULL;
571 bool got_autofillable_form = 596 bool got_autofillable_form =
572 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && 597 GetCachedFormAndField(form, field, &form_structure, &autofill_field) &&
573 // Don't send suggestions or track forms that should not be parsed. 598 // Don't send suggestions or track forms that should not be parsed.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 if (!IsValidFormData(form) || !IsValidFormFieldData(field) || 828 if (!IsValidFormData(form) || !IsValidFormFieldData(field) ||
804 !driver_->RendererIsAvailable()) { 829 !driver_->RendererIsAvailable()) {
805 return; 830 return;
806 } 831 }
807 832
808 FillOrPreviewDataModelForm(AutofillDriver::FORM_DATA_ACTION_FILL, query_id, 833 FillOrPreviewDataModelForm(AutofillDriver::FORM_DATA_ACTION_FILL, query_id,
809 form, field, credit_card, true, cvc); 834 form, field, credit_card, true, cvc);
810 } 835 }
811 836
812 void AutofillManager::OnFocusNoLongerOnForm() { 837 void AutofillManager::OnFocusNoLongerOnForm() {
838 if (provider_) {
839 provider_->OnFocusNoLongerOnForm(this);
840 return;
841 }
813 ProcessPendingFormForUpload(); 842 ProcessPendingFormForUpload();
814 } 843 }
815 844
816 void AutofillManager::OnDidPreviewAutofillFormData() { 845 void AutofillManager::OnDidPreviewAutofillFormData() {
817 if (test_delegate_) 846 if (test_delegate_)
818 test_delegate_->DidPreviewFormData(); 847 test_delegate_->DidPreviewFormData();
819 } 848 }
820 849
821 void AutofillManager::OnDidFillAutofillFormData(const FormData& form, 850 void AutofillManager::OnDidFillAutofillFormData(const FormData& form,
822 const TimeTicks& timestamp) { 851 const TimeTicks& timestamp) {
852 if (provider_) {
853 provider_->OnDidFillAutofillFormData(this, form, timestamp);
854 return;
855 }
856
823 if (test_delegate_) 857 if (test_delegate_)
824 test_delegate_->DidFillFormData(); 858 test_delegate_->DidFillFormData();
825 859
826 UpdatePendingForm(form); 860 UpdatePendingForm(form);
827 861
828 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL); 862 AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL);
829 if (!user_did_autofill_) { 863 if (!user_did_autofill_) {
830 user_did_autofill_ = true; 864 user_did_autofill_ = true;
831 AutofillMetrics::LogUserHappinessMetric( 865 AutofillMetrics::LogUserHappinessMetric(
832 AutofillMetrics::USER_DID_AUTOFILL_ONCE); 866 AutofillMetrics::USER_DID_AUTOFILL_ONCE);
(...skipping 23 matching lines...) Expand all
856 890
857 if (autofill_field->Type().group() == CREDIT_CARD) { 891 if (autofill_field->Type().group() == CREDIT_CARD) {
858 credit_card_form_event_logger_->OnDidShowSuggestions(); 892 credit_card_form_event_logger_->OnDidShowSuggestions();
859 } else { 893 } else {
860 address_form_event_logger_->OnDidShowSuggestions(); 894 address_form_event_logger_->OnDidShowSuggestions();
861 } 895 }
862 } 896 }
863 } 897 }
864 898
865 void AutofillManager::OnHidePopup() { 899 void AutofillManager::OnHidePopup() {
866 if (!IsAutofillEnabled()) 900 if (!IsAutofillEnabled() || provider_)
867 return; 901 return;
868 902
869 autocomplete_history_manager_->CancelPendingQuery(); 903 autocomplete_history_manager_->CancelPendingQuery();
870 client_->HideAutofillPopup(); 904 client_->HideAutofillPopup();
871 } 905 }
872 906
873 bool AutofillManager::GetDeletionConfirmationText(const base::string16& value, 907 bool AutofillManager::GetDeletionConfirmationText(const base::string16& value,
874 int identifier, 908 int identifier,
875 base::string16* title, 909 base::string16* title,
876 base::string16* body) { 910 base::string16* body) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 1004
971 return full_card_request_.get(); 1005 return full_card_request_.get();
972 } 1006 }
973 1007
974 void AutofillManager::SetTestDelegate(AutofillManagerTestDelegate* delegate) { 1008 void AutofillManager::SetTestDelegate(AutofillManagerTestDelegate* delegate) {
975 test_delegate_ = delegate; 1009 test_delegate_ = delegate;
976 } 1010 }
977 1011
978 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values, 1012 void AutofillManager::OnSetDataList(const std::vector<base::string16>& values,
979 const std::vector<base::string16>& labels) { 1013 const std::vector<base::string16>& labels) {
1014 if (provider_)
1015 return;
1016
980 if (!IsValidString16Vector(values) || 1017 if (!IsValidString16Vector(values) ||
981 !IsValidString16Vector(labels) || 1018 !IsValidString16Vector(labels) ||
982 values.size() != labels.size()) 1019 values.size() != labels.size())
983 return; 1020 return;
984 1021
985 external_delegate_->SetCurrentDataListValues(values, labels); 1022 external_delegate_->SetCurrentDataListValues(values, labels);
986 } 1023 }
987 1024
988 void AutofillManager::OnLoadedServerPredictions( 1025 void AutofillManager::OnLoadedServerPredictions(
989 std::string response, 1026 std::string response,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 if (upload_request_.cvc.empty()) { 1172 if (upload_request_.cvc.empty()) {
1136 DCHECK(client_->GetSaveCardBubbleController()); 1173 DCHECK(client_->GetSaveCardBubbleController());
1137 upload_request_.cvc = 1174 upload_request_.cvc =
1138 client_->GetSaveCardBubbleController()->GetCvcEnteredByUser(); 1175 client_->GetSaveCardBubbleController()->GetCvcEnteredByUser();
1139 } 1176 }
1140 payments_client_->UploadCard(upload_request_); 1177 payments_client_->UploadCard(upload_request_);
1141 } 1178 }
1142 } 1179 }
1143 1180
1144 void AutofillManager::OnDidEndTextFieldEditing() { 1181 void AutofillManager::OnDidEndTextFieldEditing() {
1182 if (provider_)
1183 return;
1145 external_delegate_->DidEndTextFieldEditing(); 1184 external_delegate_->DidEndTextFieldEditing();
1146 } 1185 }
1147 1186
1148 bool AutofillManager::IsAutofillEnabled() const { 1187 bool AutofillManager::IsAutofillEnabled() const {
1149 return ::autofill::IsAutofillEnabled(client_->GetPrefs()); 1188 return ::autofill::IsAutofillEnabled(client_->GetPrefs());
1150 } 1189 }
1151 1190
1152 bool AutofillManager::IsCreditCardUploadEnabled() { 1191 bool AutofillManager::IsCreditCardUploadEnabled() {
1153 return ::autofill::IsCreditCardUploadEnabled( 1192 return ::autofill::IsCreditCardUploadEnabled(
1154 client_->GetPrefs(), client_->GetSyncService(), 1193 client_->GetPrefs(), client_->GetSyncService(),
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1454 form_structures_.clear(); 1493 form_structures_.clear();
1455 form_interactions_ukm_logger_.reset( 1494 form_interactions_ukm_logger_.reset(
1456 new AutofillMetrics::FormInteractionsUkmLogger(client_->GetUkmService())); 1495 new AutofillMetrics::FormInteractionsUkmLogger(client_->GetUkmService()));
1457 address_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( 1496 address_form_event_logger_.reset(new AutofillMetrics::FormEventLogger(
1458 false /* is_for_credit_card */, form_interactions_ukm_logger_.get())); 1497 false /* is_for_credit_card */, form_interactions_ukm_logger_.get()));
1459 credit_card_form_event_logger_.reset(new AutofillMetrics::FormEventLogger( 1498 credit_card_form_event_logger_.reset(new AutofillMetrics::FormEventLogger(
1460 true /* is_for_credit_card */, form_interactions_ukm_logger_.get())); 1499 true /* is_for_credit_card */, form_interactions_ukm_logger_.get()));
1461 #if defined(OS_ANDROID) || defined(OS_IOS) 1500 #if defined(OS_ANDROID) || defined(OS_IOS)
1462 autofill_assistant_.Reset(); 1501 autofill_assistant_.Reset();
1463 #endif 1502 #endif
1503 if (provider_)
1504 provider_->Reset(this);
1464 has_logged_autofill_enabled_ = false; 1505 has_logged_autofill_enabled_ = false;
1465 has_logged_address_suggestions_count_ = false; 1506 has_logged_address_suggestions_count_ = false;
1466 did_show_suggestions_ = false; 1507 did_show_suggestions_ = false;
1467 user_did_type_ = false; 1508 user_did_type_ = false;
1468 user_did_autofill_ = false; 1509 user_did_autofill_ = false;
1469 user_did_edit_autofilled_field_ = false; 1510 user_did_edit_autofilled_field_ = false;
1470 masked_card_ = CreditCard(); 1511 masked_card_ = CreditCard();
1471 unmasking_query_id_ = -1; 1512 unmasking_query_id_ = -1;
1472 unmasking_form_ = FormData(); 1513 unmasking_form_ = FormData();
1473 unmasking_field_ = FormFieldData(); 1514 unmasking_field_ = FormFieldData();
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 autofilled_form_signatures_.pop_back(); 1757 autofilled_form_signatures_.pop_back();
1717 1758
1718 // Note that this may invalidate |data_model|, particularly if it is a Mac 1759 // Note that this may invalidate |data_model|, particularly if it is a Mac
1719 // address book entry. 1760 // address book entry.
1720 if (action == AutofillDriver::FORM_DATA_ACTION_FILL) 1761 if (action == AutofillDriver::FORM_DATA_ACTION_FILL)
1721 personal_data_->RecordUseOf(data_model); 1762 personal_data_->RecordUseOf(data_model);
1722 1763
1723 driver_->SendFormDataToRenderer(query_id, action, result); 1764 driver_->SendFormDataToRenderer(query_id, action, result);
1724 } 1765 }
1725 1766
1767 void AutofillManager::SendFormDataToRenderer(
1768 int query_id,
1769 AutofillDriver::RendererFormDataAction action,
1770 const FormData& data) {
1771 driver_->SendFormDataToRenderer(query_id, action, data);
1772 }
1773
1726 std::unique_ptr<FormStructure> AutofillManager::ValidateSubmittedForm( 1774 std::unique_ptr<FormStructure> AutofillManager::ValidateSubmittedForm(
1727 const FormData& form) { 1775 const FormData& form) {
1728 std::unique_ptr<FormStructure> submitted_form( 1776 std::unique_ptr<FormStructure> submitted_form(
1729 base::MakeUnique<FormStructure>(form)); 1777 base::MakeUnique<FormStructure>(form));
1730 if (!ShouldUploadForm(*submitted_form)) 1778 if (!ShouldUploadForm(*submitted_form))
1731 return std::unique_ptr<FormStructure>(); 1779 return std::unique_ptr<FormStructure>();
1732 1780
1733 // Ignore forms not present in our cache. These are typically forms with 1781 // Ignore forms not present in our cache. These are typically forms with
1734 // wonky JavaScript that also makes them not auto-fillable. 1782 // wonky JavaScript that also makes them not auto-fillable.
1735 FormStructure* cached_submitted_form; 1783 FormStructure* cached_submitted_form;
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 } 2296 }
2249 #endif // ENABLE_FORM_DEBUG_DUMP 2297 #endif // ENABLE_FORM_DEBUG_DUMP
2250 2298
2251 void AutofillManager::LogCardUploadDecisionUkm( 2299 void AutofillManager::LogCardUploadDecisionUkm(
2252 AutofillMetrics::CardUploadDecisionMetric upload_decision) { 2300 AutofillMetrics::CardUploadDecisionMetric upload_decision) {
2253 AutofillMetrics::LogCardUploadDecisionUkm( 2301 AutofillMetrics::LogCardUploadDecisionUkm(
2254 client_->GetUkmService(), pending_upload_request_url_, upload_decision); 2302 client_->GetUkmService(), pending_upload_request_url_, upload_decision);
2255 } 2303 }
2256 2304
2257 } // namespace autofill 2305 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698