Commit 031410fa authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Revert "Reland "[xsurface]: Update SurfaceAdapter to SurfaceRenderer and spec""

This reverts commit 3d6d790e.

Reason for revert: crbug.com/1056978

Original change's description:
> Reland "[xsurface]: Update SurfaceAdapter to SurfaceRenderer and spec"
> 
> This is a reland of 21245a70
> 
> TBR=twellington@chromium.org
> 
> Original change's description:
> > [xsurface]: Update SurfaceAdapter to SurfaceRenderer and spec
> >
> > Change-Id: Ib77234174ece4facb35596808fd964a18db04311
> > Bug: 1054944
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2048409
> > Commit-Queue: Cathy Li <chili@chromium.org>
> > Reviewed-by: Justin DeWitt <dewittj@chromium.org>
> > Reviewed-by: Theresa  <twellington@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#744352}
> 
> Bug: 1054944
> Change-Id: I5f6c81e1740e418307c3365bd13969769d99472a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078794
> Commit-Queue: Cathy Li <chili@chromium.org>
> Reviewed-by: Cathy Li <chili@chromium.org>
> Reviewed-by: Sky Malice <skym@chromium.org>
> Reviewed-by: Justin DeWitt <dewittj@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#745237}

TBR=dewittj@chromium.org,twellington@chromium.org,skym@chromium.org,chili@chromium.org

Change-Id: I3e5cdad1b8d83f60f1c95edaf30b4f3c66c828b0
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1054944
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079843Reviewed-by: default avatarWei-Yin Chen (陳威尹) <wychen@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745336}
parent 68e44432
...@@ -53,8 +53,7 @@ import org.chromium.chrome.browser.ui.ImmersiveModeManager; ...@@ -53,8 +53,7 @@ import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient; import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient;
import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate; import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate;
import org.chromium.chrome.browser.webauth.Fido2ApiHandler; import org.chromium.chrome.browser.webauth.Fido2ApiHandler;
import org.chromium.chrome.browser.xsurface.SurfaceDependencyProvider; import org.chromium.chrome.browser.xsurface.SurfaceAdapterFactory;
import org.chromium.chrome.browser.xsurface.SurfaceRenderer;
import org.chromium.components.browser_ui.widget.FeatureHighlightProvider; import org.chromium.components.browser_ui.widget.FeatureHighlightProvider;
import org.chromium.components.download.DownloadCollectionBridge; import org.chromium.components.download.DownloadCollectionBridge;
import org.chromium.components.signin.AccountManagerDelegate; import org.chromium.components.signin.AccountManagerDelegate;
...@@ -381,11 +380,10 @@ public abstract class AppHooks { ...@@ -381,11 +380,10 @@ public abstract class AppHooks {
} }
/** /**
* Returns a new {@link SurfaceRenderer} if the xsurface implementation is included in the * Returns a new {@link SurfaceAdapterFactory} if the xsurface implementation is included in the
* apk. Otherwise null is returned. * apk. Otherwise null is returned.
*/ */
public @Nullable SurfaceRenderer createExternalSurfaceRenderer( public @Nullable SurfaceAdapterFactory createExternalSurfaceAdapterFactory() {
SurfaceDependencyProvider dependencies) {
return null; return null;
} }
} }
...@@ -6,13 +6,7 @@ import("//build/config/android/rules.gni") ...@@ -6,13 +6,7 @@ import("//build/config/android/rules.gni")
android_library("java") { android_library("java") {
sources = [ sources = [
"android/java/src/org/chromium/chrome/browser/xsurface/HybridListRenderer.java", "android/java/src/org/chromium/chrome/browser/xsurface/SurfaceAdapter.java",
"android/java/src/org/chromium/chrome/browser/xsurface/ListContentManager.java", "android/java/src/org/chromium/chrome/browser/xsurface/SurfaceAdapterFactory.java",
"android/java/src/org/chromium/chrome/browser/xsurface/ListContentManagerObserver.java",
"android/java/src/org/chromium/chrome/browser/xsurface/SurfaceActionsHandler.java",
"android/java/src/org/chromium/chrome/browser/xsurface/SurfaceDependencyProvider.java",
"android/java/src/org/chromium/chrome/browser/xsurface/SurfaceRenderer.java",
] ]
deps =
[ "//third_party/android_deps:androidx_recyclerview_recyclerview_java" ]
} }
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.xsurface;
import androidx.recyclerview.widget.RecyclerView;
/**
* A renderer that can handle mixing externally-provided views with native Android views
* in a RecyclerView.
*/
public interface HybridListRenderer {
/** Binds a RecyclerView and contentmanager with this renderer. */
void bind(RecyclerView view, ListContentManager manager);
/**
* Unbinds a previously attached recyclerview and contentmanager.
*
* Does nothing if nothing was previously bound.
*/
void unbind();
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.xsurface;
import android.view.View;
import android.view.ViewGroup;
import java.util.Map;
/**
* Interface to provide native views to incorporate in an external surface-controlled
* RecyclerView.
*
* Models after a RecyclerView.Adapter.
*/
public interface ListContentManager {
/** Returns whether the item at index is a native view or not. */
boolean isNativeView(int index);
/** Gets the bytes needed to render an external view. */
byte[] getExternalViewBytes(int index);
/** Returns map of values which should go in the context of an external view. */
Map<String, Object> getContextValues(int index);
/**
* Returns the inflated native view.
*
* View should not be attached to parent. {@link bindNativeView} will
* be called later to attach more information to the view.
*/
View getNativeView(int index, ViewGroup parent);
/**
* Binds the data at the specified location.
*/
void bindNativeView(int index, View v);
/** Returns number of items to show. */
int getItemCount();
/** Adds an observer to be notified when the list content changes. */
void addObserver(ListContentManagerObserver o);
/** Removes the observer so it's no longer notified of content changes. */
void removeObserver(ListContentManagerObserver o);
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.xsurface;
/** Interface to observe a list. */
public interface ListContentManagerObserver {
/** Called when range from startIndex to startIndex+count has been inserted. */
default void onItemRangeInserted(int startIndex, int count) {}
/** Called when range from startIndex to startIndex+count has been removed. */
default void onItemRangeRemoved(int startIndex, int count) {}
/** Called when range from startIndex to startIndex+count has been changed/updated. */
default void onItemRangeChanged(int startIndex, int count) {}
/** Called when item at curIndex has been moved to newIndex. */
default void onItemMoved(int curIndex, int newIndex) {}
}
...@@ -4,19 +4,21 @@ ...@@ -4,19 +4,21 @@
package org.chromium.chrome.browser.xsurface; package org.chromium.chrome.browser.xsurface;
import android.view.View;
/** /**
* Interface to provide chromium calling points for an external surface. * Creates, owns, and manages an exposed view. Can be rebound to a given implementation specific
* payload.
*/ */
public interface SurfaceActionsHandler { public interface SurfaceAdapter {
String KEY = "GeneralActions";
/** /**
* Navigates the current tab to a particular URL. * Rebinds the associated view to the given payload.
* @param protoPayload The payload that should describe what the view should do.
*/ */
void navigateTab(String url); void bind(byte[] protoPayload);
/** /**
* Navigates a new tab to a particular URL. * Returns the single associated view.
*/ */
void navigateNewTab(String url); View getView();
} }
...@@ -7,15 +7,13 @@ package org.chromium.chrome.browser.xsurface; ...@@ -7,15 +7,13 @@ package org.chromium.chrome.browser.xsurface;
import android.content.Context; import android.content.Context;
/** /**
* Provides logging and context for an external surface. * Creates SurfaceAdapters on demand.
*/ */
public interface SurfaceDependencyProvider { public interface SurfaceAdapterFactory {
/** @return the context associated with the application. */ /**
Context getContext(); * Creates a new adapter backed by a shared set of dependencies with other adapters.
* @param context The context that any new Android UI objects should be created within.
/** @see {Log.e} */ * @return A new wrapper capable of making view objects.
void logError(String tag, String messageTemplate, Object... args); */
SurfaceAdapter createSurfaceAdapter(Context context);
/** @see {Log.w} */
void logWarning(String tag, String messageTemplate, Object... args);
} }
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.xsurface;
import android.view.View;
import java.util.Map;
/**
* Interface to call a rendering service to render a View sent by a server.
*/
public interface SurfaceRenderer {
/** Update the card renderer with shared data bytes. */
void update(byte[] data);
/**
* Turns a stream of externally-provided bytes into an Android View.
*
* @param renderData externally-provided bytes to be rendered.
* @param contextValues additional context to be incorporated into the view.
*/
View render(byte[] renderData, Map<String, Object> contextValues);
}
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