Commit c95ee19a authored by aurimas@chromium.org's avatar aurimas@chromium.org

Fixing missing password Autofill popup for Android

Adding support for password Autofill popups for Android.

BUG=163619


Review URL: https://chromiumcodereview.appspot.com/11299287

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171102 0039d316-1c4b-4281-b951-d872f2087c98
parent 8a46f5fd
......@@ -30,6 +30,17 @@ import org.chromium.ui.gfx.NativeWindow;
*/
public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItemClickListener {
/**
* Constants defining types of Autofill suggestion entries.
* Has to be kept in sync with enum in WebAutofillClient.h
*
* Not supported: MenuItemIDWarningMessage, MenuItemIDSeparator, MenuItemIDClearForm, and
* MenuItemIDAutofillOptions.
*/
private static final int ITEM_ID_AUTOCOMPLETE_ENTRY = 0;
private static final int ITEM_ID_PASSWORD_ENTRY = -2;
private static final int ITEM_ID_DATA_LIST_ENTRY = -6;
private static final int TEXT_PADDING_DP = 30;
private final AutofillPopupDelegate mAutofillCallback;
......@@ -126,10 +137,14 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem
* @param suggestions Autofill suggestion data.
*/
public void show(AutofillSuggestion[] suggestions) {
// Remove the AutofillSuggestions with IDs that are unsupported by Android
// Remove the AutofillSuggestions with IDs that are not supported by Android
ArrayList<AutofillSuggestion> cleanedData = new ArrayList<AutofillSuggestion>();
for (int i = 0; i < suggestions.length; i++) {
if (suggestions[i].mUniqueId >= 0) cleanedData.add(suggestions[i]);
int itemId = suggestions[i].mUniqueId;
if (itemId > 0 || itemId == ITEM_ID_AUTOCOMPLETE_ENTRY ||
itemId == ITEM_ID_PASSWORD_ENTRY || itemId == ITEM_ID_DATA_LIST_ENTRY) {
cleanedData.add(suggestions[i]);
}
}
mAnchorView.setSize(mAnchorRect, getDesiredWidth(suggestions));
setAnchorView(mAnchorView);
......
......@@ -604,8 +604,12 @@ void PasswordAutofillManager::PerformInlineAutocomplete(
// Show the popup with the list of available usernames.
ShowSuggestionPopup(fill_data, username);
// Fill the user and password field with the most relevant match.
#if !defined(OS_ANDROID)
// Fill the user and password field with the most relevant match. Android
// only fills in the fields after the user clicks on the suggestion popup.
FillUserNameAndPassword(&username, &password, fill_data, false, true);
#endif
}
void PasswordAutofillManager::FrameClosing(const WebKit::WebFrame* frame) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment