From 659b54de61e802560a32d43509023d576633fe66 Mon Sep 17 00:00:00 2001 From: "bulach@chromium.org" Date: Mon, 10 Feb 2014 19:52:42 +0000 Subject: Allows logging the field names used by autofill. BUG=341493 Review URL: https://codereview.chromium.org/150503003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250182 0039d316-1c4b-4281-b951-d872f2087c98 --- .../src/org/chromium/ui/autofill/AutofillPopup.java | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'ui/android') diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java index af6951c..06126a3d 100644 --- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java +++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java @@ -56,6 +56,20 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem private List mSuggestions; /** + * An interface that can be injected to log field names selected by + * the autofill. + */ + public interface AutofillLogger { + public void logSuggestionSelected(String fieldName); + } + + private static AutofillLogger sAutofillLogger = null; + + public static void setAutofillLogger(AutofillLogger autofillLogger) { + sAutofillLogger = autofillLogger; + } + + /** * An interface to handle the touch interaction with an AutofillPopup object. */ public interface AutofillPopupDelegate { @@ -219,8 +233,12 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem @Override public void onItemClick(AdapterView parent, View view, int position, long id) { AutofillListAdapter adapter = (AutofillListAdapter) parent.getAdapter(); - int listIndex = mSuggestions.indexOf(adapter.getItem(position)); + AutofillSuggestion selectedSuggestion = adapter.getItem(position); + int listIndex = mSuggestions.indexOf(selectedSuggestion); assert listIndex > -1; + if (sAutofillLogger != null) { + sAutofillLogger.logSuggestionSelected(selectedSuggestion.mLabel); + } mAutofillCallback.suggestionSelected(listIndex); } -- cgit v1.1