| Index: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| index 475cfae2b80b329775035bc50320df3df6425c21..4604d45fe3b88766eac81fc7ae42f6f324d1c319 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| @@ -25,10 +25,10 @@ public class SelectPopupDropdown implements SelectPopup {
|
|
|
| private final ContentViewCore mContentViewCore;
|
| private final Context mContext;
|
| + private final DropdownPopupWindow mDropdownPopupWindow;
|
|
|
| - private DropdownPopupWindow mDropdownPopupWindow;
|
| private int mInitialSelection = -1;
|
| - private boolean mAlreadySelectedItems = false;
|
| + private boolean mSelectionNotified;
|
|
|
| public SelectPopupDropdown(ContentViewCore contentViewCore, List<SelectPopupItem> items,
|
| Rect bounds, int[] selected) {
|
| @@ -39,9 +39,7 @@ public class SelectPopupDropdown implements SelectPopup {
|
| mDropdownPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
| @Override
|
| public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
| - int[] selectedIndices = {position};
|
| - mContentViewCore.selectPopupMenuItems(selectedIndices);
|
| - mAlreadySelectedItems = true;
|
| + notifySelection(new int[] {position});
|
| hide();
|
| }
|
| });
|
| @@ -64,13 +62,17 @@ public class SelectPopupDropdown implements SelectPopup {
|
| new PopupWindow.OnDismissListener() {
|
| @Override
|
| public void onDismiss() {
|
| - if (!mAlreadySelectedItems) {
|
| - mContentViewCore.selectPopupMenuItems(null);
|
| - }
|
| + notifySelection(null);
|
| }
|
| });
|
| }
|
|
|
| + private void notifySelection(int[] indicies) {
|
| + if (mSelectionNotified) return;
|
| + mContentViewCore.selectPopupMenuItems(indicies);
|
| + mSelectionNotified = true;
|
| + }
|
| +
|
| @Override
|
| public void show() {
|
| mDropdownPopupWindow.show();
|
| @@ -82,5 +84,6 @@ public class SelectPopupDropdown implements SelectPopup {
|
| @Override
|
| public void hide() {
|
| mDropdownPopupWindow.dismiss();
|
| + notifySelection(null);
|
| }
|
| }
|
|
|