| 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 d0c951da7c477f2ad72424b826e488c551975a40..21d744edd81177c2c7ecb274aadb87da31abc42e 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
|
| @@ -133,7 +133,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // the purpose of migrating injected objects from one instance of CVC to another, which
|
| // is used by Android WebView to support WebChromeClient.onCreateWindow scenario.
|
| private final Map<String, Pair<Object, Class>> mJavaScriptInterfaces =
|
| - new HashMap<String, Pair<Object, Class>>();
|
| + new HashMap<>();
|
|
|
| // Additionally, we keep track of all Java bound JS objects that are in use on the
|
| // current page to ensure that they are not garbage collected until the page is
|
| @@ -141,7 +141,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // via the removeJavaScriptInterface API and transient objects returned from methods
|
| // on the interface object. Note we use HashSet rather than Set as the native side
|
| // expects HashSet (no bindings for interfaces).
|
| - private final HashSet<Object> mRetainedJavaScriptObjects = new HashSet<Object>();
|
| + private final HashSet<Object> mRetainedJavaScriptObjects = new HashSet<>();
|
|
|
| /**
|
| * A {@link WebContentsObserver} that listens to frame navigation events.
|
| @@ -152,7 +152,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
|
|
| ContentViewWebContentsObserver(ContentViewCore contentViewCore) {
|
| super(contentViewCore.getWebContents());
|
| - mWeakContentViewCore = new WeakReference<ContentViewCore>(contentViewCore);
|
| + mWeakContentViewCore = new WeakReference<>(contentViewCore);
|
| }
|
|
|
| @Override
|
| @@ -461,6 +461,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| // The list of observers that are notified when ContentViewCore changes its WindowAndroid.
|
| private final ObserverList<WindowAndroidChangedObserver> mWindowAndroidChangedObservers;
|
|
|
| + // Whether or not this ContentViewCore should ignore input.
|
| + private boolean mIgnoreInput = false;
|
| +
|
| /**
|
| * @param webContents The {@link WebContents} to find a {@link ContentViewCore} of.
|
| * @return A {@link ContentViewCore} that is connected to {@code webContents} or
|
| @@ -483,11 +486,11 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| mAccessibilityManager = (AccessibilityManager)
|
| getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);
|
| mSystemCaptioningBridge = CaptioningBridgeFactory.getSystemCaptioningBridge(mContext);
|
| - mGestureStateListeners = new ObserverList<GestureStateListener>();
|
| + mGestureStateListeners = new ObserverList<>();
|
| mGestureStateListenersIterator = mGestureStateListeners.rewindableIterator();
|
|
|
| - mContainerViewObservers = new ObserverList<ContainerViewObserver>();
|
| - mWindowAndroidChangedObservers = new ObserverList<WindowAndroidChangedObserver>();
|
| + mContainerViewObservers = new ObserverList<>();
|
| + mWindowAndroidChangedObservers = new ObserverList<>();
|
| }
|
|
|
| /**
|
| @@ -689,6 +692,11 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| }
|
| }
|
|
|
| + public void updateNativeWindowAndroid(WindowAndroid windowAndroid) {
|
| + long windowNativePointer = windowAndroid == null ? 0 : windowAndroid.getNativePointer();
|
| + nativeUpdateWindowAndroid(mNativeContentViewCore, windowNativePointer);
|
| + }
|
| +
|
| /**
|
| * Sets a new container view for this {@link ContentViewCore}.
|
| *
|
| @@ -1013,6 +1021,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| * @see View#onTouchEvent(MotionEvent)
|
| */
|
| public boolean onTouchEvent(MotionEvent event) {
|
| + if (mIgnoreInput) return false;
|
| final boolean isTouchHandleEvent = false;
|
| return onTouchEventImpl(event, isTouchHandleEvent);
|
| }
|
| @@ -1536,6 +1545,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| * @see View#onKeyUp(int, KeyEvent)
|
| */
|
| public boolean onKeyUp(int keyCode, KeyEvent event) {
|
| + if (mIgnoreInput) return false;
|
| if (mPopupZoomer.isShowing() && keyCode == KeyEvent.KEYCODE_BACK) {
|
| mPopupZoomer.hide(true);
|
| return true;
|
| @@ -1564,6 +1574,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| * move and hover exit.
|
| */
|
| public boolean onHoverEvent(MotionEvent event) {
|
| + if (mIgnoreInput) return false;
|
| TraceEvent.begin("onHoverEvent");
|
|
|
| MotionEvent offset = createOffsetMotionEvent(event);
|
| @@ -2385,7 +2396,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| assert mNativeSelectPopupSourceFrame == 0 : "Zombie popup did not clear the frame source";
|
|
|
| assert items.length == enabled.length;
|
| - List<SelectPopupItem> popupItems = new ArrayList<SelectPopupItem>();
|
| + List<SelectPopupItem> popupItems = new ArrayList<>();
|
| for (int i = 0; i < items.length; i++) {
|
| popupItems.add(new SelectPopupItem(items[i], enabled[i]));
|
| }
|
| @@ -3297,6 +3308,14 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
|
| return mShowKeyboardResultReceiver;
|
| }
|
|
|
| + public void disableInput() {
|
| + mIgnoreInput = true;
|
| + }
|
| +
|
| + public void enableInput() {
|
| + mIgnoreInput = false;
|
| + }
|
| +
|
| private native long nativeInit(WebContents webContents, ViewAndroidDelegate viewAndroidDelegate,
|
| long windowAndroidPtr, HashSet<Object> retainedObjectSet);
|
| private static native ContentViewCore nativeFromWebContentsAndroid(WebContents webContents);
|
|
|