| 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 40661f1caf9c7d53fcc92e2032619dec8ccb6767..50059f92393b3544880f05ea2b2686ede4afcd02 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
|
| @@ -64,7 +64,9 @@ import org.chromium.content.browser.input.ImeAdapter;
|
| import org.chromium.content.browser.input.ImeAdapter.AdapterInputConnectionFactory;
|
| import org.chromium.content.browser.input.InputMethodManagerWrapper;
|
| import org.chromium.content.browser.input.InsertionHandleController;
|
| +import org.chromium.content.browser.input.SelectPopup;
|
| import org.chromium.content.browser.input.SelectPopupDialog;
|
| +import org.chromium.content.browser.input.SelectPopupDropdown;
|
| import org.chromium.content.browser.input.SelectPopupItem;
|
| import org.chromium.content.browser.input.SelectionHandleController;
|
| import org.chromium.content.common.ContentSwitches;
|
| @@ -227,7 +229,7 @@ public class ContentViewCore
|
| private ZoomControlsDelegate mZoomControlsDelegate;
|
|
|
| private PopupZoomer mPopupZoomer;
|
| - private SelectPopupDialog mSelectPopupDialog;
|
| + private SelectPopup mSelectPopup;
|
|
|
| private Runnable mFakeMouseMoveRunnable = null;
|
|
|
| @@ -627,14 +629,14 @@ public class ContentViewCore
|
| public void didNavigateMainFrame(String url, String baseUrl,
|
| boolean isNavigationToDifferentPage, boolean isNavigationInPage) {
|
| if (!isNavigationToDifferentPage) return;
|
| - hidePopupDialog();
|
| + hidePopups();
|
| resetScrollInProgress();
|
| resetGestureDetection();
|
| }
|
|
|
| @Override
|
| public void renderProcessGone(boolean wasOomProtected) {
|
| - hidePopupDialog();
|
| + hidePopups();
|
| resetScrollInProgress();
|
| // No need to reset gesture detection as the detector will have
|
| // been destroyed in the RenderWidgetHostView.
|
| @@ -1346,7 +1348,7 @@ public class ContentViewCore
|
| */
|
| public void onHide() {
|
| assert mNativeContentViewCore != 0;
|
| - hidePopupDialog();
|
| + hidePopups();
|
| setInjectedAccessibility(false);
|
| nativeOnHide(mNativeContentViewCore);
|
| }
|
| @@ -1361,7 +1363,7 @@ public class ContentViewCore
|
| return mContentSettings;
|
| }
|
|
|
| - private void hidePopupDialog() {
|
| + private void hidePopups() {
|
| hideSelectPopup();
|
| hideHandles();
|
| hideSelectActionBar();
|
| @@ -1400,7 +1402,7 @@ public class ContentViewCore
|
| @SuppressLint("MissingSuperCall")
|
| public void onDetachedFromWindow() {
|
| setInjectedAccessibility(false);
|
| - hidePopupDialog();
|
| + hidePopups();
|
| mZoomControlsDelegate.dismissZoomPicker();
|
| unregisterAccessibilityContentObserver();
|
|
|
| @@ -1851,7 +1853,7 @@ public class ContentViewCore
|
| if (mNativeContentViewCore != 0) {
|
| nativeSelectPopupMenuItems(mNativeContentViewCore, indices);
|
| }
|
| - mSelectPopupDialog = null;
|
| + mSelectPopup = null;
|
| }
|
|
|
| /**
|
| @@ -2314,20 +2316,25 @@ 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);
|
| + hidePopups();
|
| + if (DeviceUtils.isTablet(mContext) && !multiple) {
|
| + mSelectPopup = new SelectPopupDropdown(this, popupItems, bounds, selectedIndices);
|
| + } else {
|
| + mSelectPopup = new SelectPopupDialog(this, popupItems, multiple, selectedIndices);
|
| + }
|
| + mSelectPopup.show();
|
| }
|
|
|
| /**
|
| @@ -2335,17 +2342,14 @@ public class ContentViewCore
|
| */
|
| @CalledByNative
|
| private void hideSelectPopup() {
|
| - if (mSelectPopupDialog != null) {
|
| - mSelectPopupDialog.hide();
|
| - mSelectPopupDialog = null;
|
| - }
|
| + if (mSelectPopup != null) mSelectPopup.hide();
|
| }
|
|
|
| /**
|
| - * @return The visible select popup dialog being shown.
|
| + * @return The visible select popup being shown.
|
| */
|
| - public SelectPopupDialog getSelectPopupForTest() {
|
| - return mSelectPopupDialog;
|
| + public SelectPopup getSelectPopupForTest() {
|
| + return mSelectPopup;
|
| }
|
|
|
| @SuppressWarnings("unused")
|
|
|