Commit 71c6fdf9 authored by Zhiheng Vincent Li's avatar Zhiheng Vincent Li Committed by Commit Bot

Revert to use WindowAndroid for CastWebContentsFragment

Bug: b/111566470

Test: tested on Android Things device

Change-Id: I17f09973a3ac9ed5498efb6f21ffc6f87e6c878a
Reviewed-on: https://chromium-review.googlesource.com/1142896
Commit-Queue: Zhiheng(Vincent) Li <vincentli@google.com>
Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577347}
parent 7774b357
......@@ -86,7 +86,7 @@ public class CastWebContentsActivity extends Activity {
setContentView(R.layout.cast_web_contents_activity);
mSurfaceHelper = new CastWebContentsSurfaceHelper(this, /* hostActivity */
CastWebContentsView.onLayout(this,
CastWebContentsView.onLayoutActivity(this,
(FrameLayout) findViewById(R.id.web_contents_container),
CastSwitches.getSwitchValueColor(
CastSwitches.CAST_APP_BACKGROUND_COLOR, Color.BLACK)),
......
......@@ -88,7 +88,7 @@ public class CastWebContentsFragment extends Fragment {
}
mSurfaceHelper = new CastWebContentsSurfaceHelper(getActivity(), /* hostActivity */
CastWebContentsView.onLayout(getActivity(),
CastWebContentsView.onLayoutFragment(getContext(),
(FrameLayout) getView().findViewById(R.id.web_contents_container),
CastSwitches.getSwitchValueColor(
CastSwitches.CAST_APP_BACKGROUND_COLOR, Color.BLACK)),
......
......@@ -4,6 +4,7 @@
package org.chromium.chromecast.shell;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.widget.FrameLayout;
......@@ -17,11 +18,23 @@ import org.chromium.ui.base.ViewAndroidDelegate;
import org.chromium.ui.base.WindowAndroid;
class CastWebContentsView {
public static ScopeFactory<WebContents> onLayout(
public static ScopeFactory<WebContents> onLayoutActivity(
Activity activity, FrameLayout layout, int backgroundColor) {
layout.setBackgroundColor(backgroundColor);
WindowAndroid window = new ActivityWindowAndroid(activity);
return onLayoutInternal(activity, layout, window, backgroundColor);
}
public static ScopeFactory<WebContents> onLayoutFragment(
Context context, FrameLayout layout, int backgroundColor) {
layout.setBackgroundColor(backgroundColor);
WindowAndroid window = new WindowAndroid(context);
return onLayoutInternal(context, layout, window, backgroundColor);
}
private static ScopeFactory<WebContents> onLayoutInternal(
Context context, FrameLayout layout, WindowAndroid window, int backgroundColor) {
return (WebContents webContents) -> {
WindowAndroid window = new ActivityWindowAndroid(context);
ContentViewRenderView contentViewRenderView = new ContentViewRenderView(context) {
@Override
protected void onReadyToRender() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment