Commit 1726d77d authored by Zhiheng Vincent Li's avatar Zhiheng Vincent Li Committed by Commit Bot

Fix NPE when starting CastWebContentsFragment

Bug: b/76458625
Change-Id: I157d04a4b60fb7e206ee6f90d7f344801a7708af
Reviewed-on: https://chromium-review.googlesource.com/982009Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Commit-Queue: Zhiheng(Vincent) Li <vincentli@google.com>
Cr-Commit-Position: refs/heads/master@{#546173}
parent fd94f87e
...@@ -82,12 +82,13 @@ public class CastWebContentsFragment extends Fragment { ...@@ -82,12 +82,13 @@ public class CastWebContentsFragment extends Fragment {
Log.d(TAG, "onStart"); Log.d(TAG, "onStart");
super.onStart(); super.onStart();
sendIntentSync(CastWebContentsIntentUtils.onVisibilityChange(mSurfaceHelper.getInstanceId(),
CastWebContentsIntentUtils.VISIBITY_TYPE_FULL_SCREEN));
if (mSurfaceHelper != null) { if (mSurfaceHelper != null) {
sendIntentSync(
CastWebContentsIntentUtils.onVisibilityChange(mSurfaceHelper.getInstanceId(),
CastWebContentsIntentUtils.VISIBITY_TYPE_FULL_SCREEN));
return; return;
} }
mSurfaceHelper = new CastWebContentsSurfaceHelper(getActivity(), /* hostActivity */ mSurfaceHelper = new CastWebContentsSurfaceHelper(getActivity(), /* hostActivity */
(FrameLayout) getView().findViewById(R.id.web_contents_container), (FrameLayout) getView().findViewById(R.id.web_contents_container),
true /* showInFragment */); true /* showInFragment */);
...@@ -105,6 +106,8 @@ public class CastWebContentsFragment extends Fragment { ...@@ -105,6 +106,8 @@ public class CastWebContentsFragment extends Fragment {
boolean touchInputEnabled = CastWebContentsIntentUtils.isTouchable(bundle); boolean touchInputEnabled = CastWebContentsIntentUtils.isTouchable(bundle);
mSurfaceHelper.onNewWebContents(uri, webContents, touchInputEnabled); mSurfaceHelper.onNewWebContents(uri, webContents, touchInputEnabled);
sendIntentSync(CastWebContentsIntentUtils.onVisibilityChange(mSurfaceHelper.getInstanceId(),
CastWebContentsIntentUtils.VISIBITY_TYPE_FULL_SCREEN));
} }
@Override @Override
......
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