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

Unified Diff: ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java

Issue 490193003: Hook up autofill popup control elements (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix ChromeNativeTestApplication Created 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
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 c599c01903c0cd3035588cf15d405ecf122770ea..24334260e18a48178d52af9c5535ece5735d9e3e 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java
@@ -31,16 +31,10 @@ public class AutofillPopup extends DropdownPopupWindow implements AdapterView.On
PopupWindow.OnDismissListener {
/**
- * Constants defining types of Autofill suggestion entries.
+ * The constant used to specify a separator in a list of Autofill suggestions.
* Has to be kept in sync with enum in WebAutofillClient.h
- *
- * Not supported: MenuItemIDWarningMessage, 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_SEPARATOR_ENTRY = -3;
- private static final int ITEM_ID_DATA_LIST_ENTRY = -6;
private final Context mContext;
private final AutofillPopupDelegate mAutofillCallback;
@@ -90,14 +84,14 @@ public class AutofillPopup extends DropdownPopupWindow implements AdapterView.On
ArrayList<DropdownItem> cleanedData = new ArrayList<DropdownItem>();
HashSet<Integer> separators = new HashSet<Integer>();
for (int i = 0; i < suggestions.length; i++) {
- int itemId = suggestions[i].getUniqueId();
- if (itemId > 0 || itemId == ITEM_ID_AUTOCOMPLETE_ENTRY ||
- itemId == ITEM_ID_PASSWORD_ENTRY || itemId == ITEM_ID_DATA_LIST_ENTRY) {
- cleanedData.add(suggestions[i]);
- } else if (itemId == ITEM_ID_SEPARATOR_ENTRY) {
+ int itemId = suggestions[i].getSuggestionId();
+ if (itemId == ITEM_ID_SEPARATOR_ENTRY) {
separators.add(cleanedData.size());
+ } else {
+ cleanedData.add(suggestions[i]);
}
}
+
setAdapter(new DropdownAdapter(mContext, cleanedData, separators));
show();
ApiCompatibilityUtils.setLayoutDirection(getListView(),

Powered by Google App Engine
This is Rietveld 408576698