Commit 7851214f authored by Jan Lamecki's avatar Jan Lamecki Committed by Commit Bot

Rename CastWebContentsView to CastWebContentsFactories.

View suffix doesn't make sense as it is not an Android view. I'm
planning to introduce view showing CastWebContents, so freeing the name
before makes sense.

Also added @ColorInt to document what is expected encoding of argument.

Bug: None.
Change-Id: Ie8079383180801a37453ed8784085472d48345ad
Reviewed-on: https://chromium-review.googlesource.com/c/1333468Reviewed-by: default avatarSimeon Anfinrud <sanfin@chromium.org>
Commit-Queue: Jan Lamecki <jachor@google.com>
Cr-Commit-Position: refs/heads/master@{#609638}
parent 09c92d7a
......@@ -118,7 +118,7 @@ android_library("cast_shell_java") {
"$java_src_dir/org/chromium/chromecast/shell/CastWebContentsIntentUtils.java",
"$java_src_dir/org/chromium/chromecast/shell/CastWebContentsService.java",
"$java_src_dir/org/chromium/chromecast/shell/CastWebContentsSurfaceHelper.java",
"$java_src_dir/org/chromium/chromecast/shell/CastWebContentsView.java",
"$java_src_dir/org/chromium/chromecast/shell/CastWebContentsScopes.java",
"$java_src_dir/org/chromium/chromecast/shell/LogcatElision.java",
"$java_src_dir/org/chromium/chromecast/shell/ElidedLogcatProvider.java",
]
......
......@@ -87,7 +87,7 @@ public class CastWebContentsActivity extends Activity {
setContentView(R.layout.cast_web_contents_activity);
mSurfaceHelperState.set(new CastWebContentsSurfaceHelper(this /* hostActivity */,
CastWebContentsView.onLayoutActivity(this,
CastWebContentsScopes.onLayoutActivity(this,
(FrameLayout) findViewById(R.id.web_contents_container),
CastSwitches.getSwitchValueColor(
CastSwitches.CAST_APP_BACKGROUND_COLOR, Color.BLACK)),
......
......@@ -87,8 +87,8 @@ public class CastWebContentsFragment extends Fragment {
return;
}
mSurfaceHelper = new CastWebContentsSurfaceHelper(getActivity(), /* hostActivity */
CastWebContentsView.onLayoutFragment(getActivity(),
mSurfaceHelper = new CastWebContentsSurfaceHelper(/* hostActivity= */ getActivity(),
CastWebContentsScopes.onLayoutFragment(getActivity(),
(FrameLayout) getView().findViewById(R.id.web_contents_container),
CastSwitches.getSwitchValueColor(
CastSwitches.CAST_APP_BACKGROUND_COLOR, Color.BLACK)),
......
......@@ -7,6 +7,7 @@ package org.chromium.chromecast.shell;
import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.support.annotation.ColorInt;
import android.widget.FrameLayout;
import org.chromium.chromecast.base.Observer;
......@@ -17,23 +18,23 @@ import org.chromium.ui.base.ActivityWindowAndroid;
import org.chromium.ui.base.ViewAndroidDelegate;
import org.chromium.ui.base.WindowAndroid;
class CastWebContentsView {
class CastWebContentsScopes {
public static Observer<WebContents> onLayoutActivity(
Activity activity, FrameLayout layout, int backgroundColor) {
Activity activity, FrameLayout layout, @ColorInt int backgroundColor) {
layout.setBackgroundColor(backgroundColor);
WindowAndroid window = new ActivityWindowAndroid(activity);
return onLayoutInternal(activity, layout, window, backgroundColor);
}
public static Observer<WebContents> onLayoutFragment(
Activity activity, FrameLayout layout, int backgroundColor) {
Activity activity, FrameLayout layout, @ColorInt int backgroundColor) {
layout.setBackgroundColor(backgroundColor);
WindowAndroid window = new WindowAndroid(activity);
return onLayoutInternal(activity, layout, window, backgroundColor);
}
private static Observer<WebContents> onLayoutInternal(
Activity activity, FrameLayout layout, WindowAndroid window, int backgroundColor) {
private static Observer<WebContents> onLayoutInternal(Activity activity, FrameLayout layout,
WindowAndroid window, @ColorInt int backgroundColor) {
return (WebContents webContents) -> {
ContentViewRenderView contentViewRenderView = new ContentViewRenderView(activity) {
@Override
......
......@@ -40,7 +40,7 @@ public class CastWebContentsService extends Service {
{
// React to web contents by presenting them in a headless view.
mWebContentsState.subscribe(CastWebContentsView.withoutLayout(this));
mWebContentsState.subscribe(CastWebContentsScopes.withoutLayout(this));
mWebContentsState.subscribe(x -> {
// TODO(thoren): Notification.Builder(Context) is deprecated in O. Use the
// (Context, String) constructor when CastWebContentsService starts supporting O.
......
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