Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index b5068b0eec0471e4408badf0edd6072d8d6e6ba9..2b158236b848c14f863d1712220c92ea7aebc453 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -67,6 +67,7 @@ import org.chromium.content.browser.input.InsertionHandleController; |
import org.chromium.content.browser.input.SelectPopupDialog; |
import org.chromium.content.browser.input.SelectPopupItem; |
import org.chromium.content.browser.input.SelectionHandleController; |
+import org.chromium.content.browser.input.SingleSelectPopup; |
import org.chromium.content.common.ContentSwitches; |
import org.chromium.content_public.browser.GestureStateListener; |
import org.chromium.content_public.browser.WebContents; |
@@ -320,6 +321,7 @@ public class ContentViewCore |
private PopupZoomer mPopupZoomer; |
private SelectPopupDialog mSelectPopupDialog; |
+ private SingleSelectPopup mSingleSelectPopup; |
private Runnable mFakeMouseMoveRunnable = null; |
@@ -1551,7 +1553,6 @@ public class ContentViewCore |
mInputMethodManagerWrapper.restartInput(mContainerView); |
} |
mContainerViewInternals.super_onConfigurationChanged(newConfig); |
- |
// To request layout has side effect, but it seems OK as it only happen in |
// onConfigurationChange and layout has to be changed in most case. |
mContainerView.requestLayout(); |
@@ -2388,20 +2389,34 @@ public class ContentViewCore |
*/ |
@SuppressWarnings("unused") |
@CalledByNative |
- private void showSelectPopup(String[] items, int[] enabled, boolean multiple, |
+ private void showSelectPopup(Rect bounds, String[] items, int[] enabled, boolean multiple, |
int[] selectedIndices) { |
if (mContainerView.getParent() == null || mContainerView.getVisibility() != View.VISIBLE) { |
selectPopupMenuItems(null); |
return; |
} |
- |
- hideSelectPopup(); |
assert items.length == enabled.length; |
List<SelectPopupItem> popupItems = new ArrayList<SelectPopupItem>(); |
for (int i = 0; i < items.length; i++) { |
popupItems.add(new SelectPopupItem(items[i], enabled[i])); |
} |
- mSelectPopupDialog = SelectPopupDialog.show(this, popupItems, multiple, selectedIndices); |
+ |
+ hidePopupDialog(); |
+ if (DeviceUtils.isTablet(mContext) && !multiple) { |
+ mSingleSelectPopup = new SingleSelectPopup(this, |
+ new SingleSelectPopup.SingleSelectPopupDelegate() { |
+ @Override |
+ public void optionSelected(int index) { |
+ int[] indices = {index}; |
+ selectPopupMenuItems(indices); |
+ hideSelectPopup(); |
+ } |
+ }); |
+ mSingleSelectPopup.show(popupItems, bounds); |
+ } else { |
+ mSelectPopupDialog = |
+ SelectPopupDialog.show(this, popupItems, multiple, selectedIndices); |
+ } |
} |
/** |
@@ -2413,6 +2428,10 @@ public class ContentViewCore |
mSelectPopupDialog.hide(); |
mSelectPopupDialog = null; |
} |
+ if (mSingleSelectPopup != null) { |
+ mSingleSelectPopup.hide(); |
+ mSingleSelectPopup = null; |
+ } |
} |
/** |