Index: chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java |
diff --git a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java |
index 49201cd15c82f6202791c27263ac25d671ed8258..5662f1bd44a367b0bfa1a069558d5a1b069c1de4 100644 |
--- a/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java |
+++ b/chromecast/browser/android/apk/src/org/chromium/chromecast/shell/CastWebContentsActivity.java |
@@ -32,6 +32,7 @@ import org.chromium.content.browser.ContentViewCore; |
import org.chromium.content.browser.ContentViewRenderView; |
import org.chromium.content_public.browser.WebContents; |
import org.chromium.ui.base.ViewAndroidDelegate; |
+import org.chromium.ui.base.ViewRoot; |
import org.chromium.ui.base.WindowAndroid; |
/** |
@@ -56,6 +57,7 @@ public class CastWebContentsActivity extends Activity { |
private ContentViewClient mContentViewClient; |
private ContentViewRenderView mContentViewRenderView; |
private WindowAndroid mWindow; |
+ private ViewRoot mViewRoot; |
private ContentViewCore mContentViewCore; |
private ContentView mContentView; |
@@ -104,13 +106,15 @@ public class CastWebContentsActivity extends Activity { |
setContentView(R.layout.cast_web_contents_activity); |
mWindow = new WindowAndroid(this); |
+ mViewRoot = ViewRoot.create(mWindow); |
+ |
mContentViewRenderView = new ContentViewRenderView(this) { |
@Override |
protected void onReadyToRender() { |
setOverlayVideoMode(true); |
} |
}; |
- mContentViewRenderView.onNativeLibraryLoaded(mWindow); |
+ mContentViewRenderView.onNativeLibraryLoaded(mViewRoot); |
// Setting the background color to black avoids rendering a white splash screen |
// before the players are loaded. See crbug/307113 for details. |
mContentViewRenderView.setSurfaceViewBackgroundColor(Color.BLACK); |
@@ -181,6 +185,8 @@ public class CastWebContentsActivity extends Activity { |
@Override |
protected void onDestroy() { |
if (DEBUG) Log.d(TAG, "onDestroy"); |
+ mViewRoot.destroy(); |
+ mWindow.destroy(); |
super.onDestroy(); |
} |
@@ -314,7 +320,7 @@ public class CastWebContentsActivity extends Activity { |
mContentViewCore = new ContentViewCore(this, ""); |
mContentView = ContentView.createContentView(this, mContentViewCore); |
mContentViewCore.initialize(ViewAndroidDelegate.createBasicDelegate(mContentView), |
- mContentView, webContents, mWindow); |
+ mContentView, webContents, mViewRoot); |
mContentViewClient = new ContentViewClient(); |
mContentViewCore.setContentViewClient(mContentViewClient); |
// Enable display of current webContents. |