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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: unittest Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 6e40ae76fc1aafd9a6c84cd6c160741cbf707c44..28788ca906e62fb185e9c3b36f237f764c6254d0 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -77,6 +77,7 @@ import org.chromium.net.NetworkChangeNotifier;
import org.chromium.ui.base.ActivityWindowAndroid;
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.display.DisplayAndroid.DisplayAndroidObserver;
@@ -361,21 +362,26 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
private static String sCurrentLocales = "";
+ private ViewRoot mViewRoot;
+
private static final class AwContentsDestroyRunnable implements Runnable {
private final long mNativeAwContents;
// Hold onto a reference to the window (via its wrapper), so that it is not destroyed
// until we are done here.
private final WindowAndroidWrapper mWindowAndroid;
+ private final ViewRoot mViewRoot;
private AwContentsDestroyRunnable(
- long nativeAwContents, WindowAndroidWrapper windowAndroid) {
+ long nativeAwContents, WindowAndroidWrapper windowAndroid, ViewRoot viewRoot) {
mNativeAwContents = nativeAwContents;
mWindowAndroid = windowAndroid;
+ mViewRoot = viewRoot;
}
@Override
public void run() {
nativeDestroy(mNativeAwContents);
+ mViewRoot.destroy();
}
}
@@ -807,8 +813,8 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
Context context, ViewAndroidDelegate viewDelegate,
InternalAccessDelegate internalDispatcher, WebContents webContents,
GestureStateListener gestureStateListener, ContentViewClient contentViewClient,
- WindowAndroid windowAndroid) {
- contentViewCore.initialize(viewDelegate, internalDispatcher, webContents, windowAndroid);
+ ViewRoot viewRoot) {
+ contentViewCore.initialize(viewDelegate, internalDispatcher, webContents, viewRoot);
contentViewCore.setActionModeCallback(
new AwActionModeCallback(mContext, this,
contentViewCore.getActionModeCallbackHelper()));
@@ -1051,9 +1057,10 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
mContentViewCore = new ContentViewCore(mContext, PRODUCT_VERSION);
mViewAndroidDelegate = new AwViewAndroidDelegate(mContainerView,
mContentViewCore.getRenderCoordinates());
+ mViewRoot = ViewRoot.create(mWindowAndroid.getWindowAndroid());
initializeContentViewCore(mContentViewCore, mContext, mViewAndroidDelegate,
mInternalAccessAdapter, webContents, new AwGestureStateListener(),
- mContentViewClient, mWindowAndroid.getWindowAndroid());
+ mContentViewClient, mViewRoot);
nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge,
mIoThreadClient, mInterceptNavigationDelegate);
mWebContents = mContentViewCore.getWebContents();
@@ -1069,7 +1076,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
// The native side object has been bound to this java instance, so now is the time to
// bind all the native->java relationships.
mCleanupReference = new CleanupReference(
- this, new AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid));
+ this, new AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid, mViewRoot));
}
private void installWebContentsObserver() {
@@ -1210,6 +1217,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
mNativeAwContents = 0;
mWebContents = null;
mNavigationController = null;
+ mViewRoot = null;
mCleanupReference.cleanupNow();
mCleanupReference = null;
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698