From 2bd10411624467d8b53e2879719c20816017fb27 Mon Sep 17 00:00:00 2001 From: bondd Date: Thu, 20 Aug 2015 22:41:14 -0700 Subject: iOS Autofill: Copy attributes for select-one elements to fix UMA stats. Port one line form_autofill_util.cc change from https://crrev.com/1245623003 to iOS. This fixes wrong metrics for select fields in FormStructure::LogQualityMetrics. Add a comment for AutofillManager::OnWillSubmitForm() as requested for downstream iOS CL here: https://chromereviews.googleplex.com/247607013/#msg11 BUG= Review URL: https://codereview.chromium.org/1307733003 Cr-Commit-Position: refs/heads/master@{#344686} --- components/autofill/core/browser/autofill_manager.h | 5 +++++ components/autofill/ios/browser/resources/autofill_controller.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/components/autofill/core/browser/autofill_manager.h b/components/autofill/core/browser/autofill_manager.h index e97adf7..50db8e2 100644 --- a/components/autofill/core/browser/autofill_manager.h +++ b/components/autofill/core/browser/autofill_manager.h @@ -169,6 +169,11 @@ class AutofillManager : public AutofillDownloadManager::Observer, void OnFormsSeen(const std::vector& forms, const base::TimeTicks& timestamp); + // IMPORTANT: On iOS, this method is called when the form is submitted, + // immediately before OnFormSubmitted() is called. Do not assume that + // OnWillSubmitForm() will run before the form submits. + // TODO(mathp): Revisit this and use a single method to track form submission. + // // Processes the about-to-be-submitted |form|, uploading the possible field // types for the submitted fields to the crowdsourcing server. Returns false // if this form is not relevant for Autofill. diff --git a/components/autofill/ios/browser/resources/autofill_controller.js b/components/autofill/ios/browser/resources/autofill_controller.js index 72ee604..3ddd035 100644 --- a/components/autofill/ios/browser/resources/autofill_controller.js +++ b/components/autofill/ios/browser/resources/autofill_controller.js @@ -1620,7 +1620,8 @@ __gCrWeb.autofill.webFormControlElementToFormField = function( } if (__gCrWeb.autofill.isAutofillableInputElement(element) || - __gCrWeb.autofill.isTextAreaElement(element)) { + __gCrWeb.autofill.isTextAreaElement(element) || + __gCrWeb.autofill.isSelectElement(element)) { field['is_autofilled'] = element.isAutofilled; field['should_autocomplete'] = __gCrWeb.common.autoComplete(element); field['is_focusable'] = !element.disabled && !element.readOnly && -- cgit v1.1