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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: tests Created 3 years, 12 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: chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
index 699d62ed8f1c24ab7666633e9e6b27b154d95428..44e799b3f0cf5cc36755183970814e79cf77db41 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java
@@ -107,6 +107,7 @@ import org.chromium.printing.PrintingControllerImpl;
import org.chromium.ui.base.LocalizationUtils;
import org.chromium.ui.base.PageTransition;
import org.chromium.ui.base.ViewAndroidDelegate;
+import org.chromium.ui.base.ViewRoot;
import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.mojom.WindowOpenDisposition;
@@ -187,6 +188,9 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
/** {@link ContentViewCore} showing the current page, or {@code null} if the tab is frozen. */
private ContentViewCore mContentViewCore;
+ /** {@link ViewRoot} used to forward input/view events down to native. */
+ private ViewRoot mViewRoot;
+
/** Listens to gesture events fired by the ContentViewCore. */
private GestureStateListener mGestureStateListener;
@@ -1625,6 +1629,13 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
}
/**
+ * @return {@link ViewRoot} instance used to forward view/input events.
+ */
+ public ViewRoot getViewRoot() {
+ return mViewRoot;
+ }
+
+ /**
* Called when a navigation begins and no navigation was in progress
* @param toDifferentDocument Whether this navigation will transition between
* documents (i.e., not a fragment navigation or JS History API call).
@@ -1724,6 +1735,8 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
ChromeActionModeCallback actionModeCallback = new ChromeActionModeCallback(
mThemedApplicationContext, this, cvc.getActionModeCallbackHelper());
cvc.setActionModeCallback(actionModeCallback);
+ mViewRoot = ViewRoot.create(mWindowAndroid);
+ webContents.initViewRoot(mViewRoot);
return cvc;
}
@@ -2459,8 +2472,7 @@ public class Tab implements ViewGroup.OnHierarchyChangeListener,
// (see http://crbug.com/340987).
newContentViewCore.onSizeChanged(originalWidth, originalHeight, 0, 0);
if (!bounds.isEmpty()) {
- newContentViewCore.getWindowAndroid().getViewRoot().onPhysicalBackingSizeChanged(
- bounds.right, bounds.bottom);
+ getViewRoot().onPhysicalBackingSizeChanged(bounds.right, bounds.bottom);
}
newContentViewCore.onShow();
setContentViewCore(newContentViewCore);

Powered by Google App Engine
This is Rietveld 408576698