Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,6 @@ protected void onWindowVisibilityChanged(int visibility) {
}
}

/**

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the plan for rebase Cobalt shell, these are mostly the functions from upstream Content shell, if we remove them, it will increase the difficulty while rebasing Cobalt shell.

We should clearly check with browser team to see if there is any plan to rebase Cobalt shell.

* Sets the background color of the surface view. This method is necessary because the
* background color of ContentViewRenderView itself is covered by the background of
* SurfaceView.
* @param color The color of the background.
*/
public void setSurfaceViewBackgroundColor(int color) {
if (getSurfaceView() != null) {
getSurfaceView().setBackgroundColor(color);
}
}

/**
* Gets the SurfaceView for this ContentViewRenderView
*/
Expand Down Expand Up @@ -195,13 +183,6 @@ protected SurfaceView createSurfaceView(Context context) {
return new SurfaceView(context);
}

/**
* @return whether the surface view is initialized and ready to render.
*/
public boolean isInitialized() {
return getSurfaceView().getHolder().getSurface() != null;
}

/**
* Enter or leave overlay video mode.
* @param enabled Whether overlay mode is enabled.
Expand Down
81 changes: 0 additions & 81 deletions cobalt/shell/android/java/src/dev/cobalt/shell/Shell.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,7 @@

import android.app.Activity;
import android.content.Context;
import android.graphics.Rect;
import android.text.TextUtils;
import android.view.ActionMode;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import dev.cobalt.shell.ContentViewRenderView;
Expand All @@ -33,13 +28,10 @@
import org.chromium.build.annotations.Initializer;
import org.chromium.build.annotations.NullMarked;
import org.chromium.build.annotations.Nullable;
import org.chromium.content_public.browser.ActionModeCallbackHelper;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.NavigationController;
import org.chromium.content_public.browser.SelectionPopupController;
import org.chromium.content_public.browser.Visibility;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.ViewAndroidDelegate;
import org.chromium.ui.base.WindowAndroid;
import org.jni_zero.CalledByNative;
import org.jni_zero.JNINamespace;
Expand All @@ -61,14 +53,6 @@ public interface OnWebContentsReadyListener {
}

private static final String TAG = "cobalt";
private static final long COMPLETED_PROGRESS_TIMEOUT_MS = 200;

// Stylus handwriting: Setting this ime option instructs stylus writing service to restrict
// capturing writing events slightly outside the Url bar area. This is needed to prevent stylus
// handwriting in inputs in web content area that are very close to url bar area, from being
// committed to Url bar's Edit text. Ex: google.com search field.
private static final String IME_OPTION_RESTRICT_STYLUS_WRITING_AREA =
"restrictDirectWritingArea=true";

private WebContents mWebContents;
private WebContents mSplashScreenWebContents;
Expand Down Expand Up @@ -157,21 +141,6 @@ private void onNativeDestroyed() {
mWebContents = null;
}

/**
* @return Whether the Shell has been destroyed.
* @see #onNativeDestroyed()
*/
public boolean isDestroyed() {
return mNativeShell == 0;
}

/**
* @return Whether or not the Shell is loading content.
*/
public boolean isLoading() {
return mLoading;
}

/**
* Loads an URL. This will perform minimal amounts of sanitizing of the URL to attempt to
* make it valid.
Expand Down Expand Up @@ -219,10 +188,6 @@ private void setIsLoading(boolean loading) {
mLoading = loading;
}

public @Nullable ShellViewAndroidDelegate getViewAndroidDelegate() {
return mViewAndroidDelegate;
}

/**
* Initializes the ContentView based on the native tab contents pointer passed in.
* @param webContents A {@link WebContents} object.
Expand Down Expand Up @@ -291,44 +256,6 @@ public void onActivityVisible(boolean visible) {
}
}

/**
* {link @ActionMode.Callback} that uses the default implementation in
* {@link SelectionPopupController}.
*/
private ActionMode.Callback2 defaultActionCallback() {
final ActionModeCallbackHelper helper =
SelectionPopupController.fromWebContents(mWebContents)
.getActionModeCallbackHelper();

return new ActionMode.Callback2() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
helper.onCreateActionMode(mode, menu);
return true;
}

@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return helper.onPrepareActionMode(mode, menu);
}

@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return helper.onActionItemClicked(mode, item);
}

@Override
public void onDestroyActionMode(ActionMode mode) {
helper.onDestroyActionMode();
}

@Override
public void onGetContentRect(ActionMode mode, View view, Rect outRect) {
helper.onGetContentRect(mode, view, outRect);
}
};
}

@CalledByNative
public void setOverlayMode(boolean useOverlayMode) {
assumeNonNull(mContentViewRenderView).setOverlayVideoMode(useOverlayMode);
Expand All @@ -351,14 +278,6 @@ public void setOverayModeChangedCallbackForTesting(Callback<Boolean> callback) {
@CalledByNative
private void enableUiControl(int controlId, boolean enabled) {}

/**
* @return The {@link View} currently shown by this Shell.
*/
public @Nullable View getContentView() {
ViewAndroidDelegate viewDelegate = mWebContents.getViewAndroidDelegate();
return viewDelegate != null ? viewDelegate.getContainerView() : null;
}

/**
* @return The {@link WebContents} currently managing the content shown by this Shell.
*/
Expand Down
16 changes: 0 additions & 16 deletions cobalt/shell/android/java/src/dev/cobalt/shell/ShellManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ public void setWindow(WindowAndroid window) {
mContentViewRenderView.onNativeLibraryLoaded(window);
}

/**
* @return The window used to generate all shells.
*/
public WindowAndroid getWindow() {
return mWindow;
}

/**
* Get the ContentViewRenderView.
*/
Expand All @@ -102,15 +95,6 @@ public WindowAndroid getWindow() {
return mActiveShell;
}

/**
* Creates a new shell pointing to the specified URL.
* @param url The URL the shell should load upon creation.
*/
public void launchShell(String url) {
// Calls the overloaded method with a null listener.
launchShell(url, /* deepLinkUrl= */ "", /* listener= */ null);
}

/**
* Creates a new shell pointing to the specified URL.
* @param url The URL the shell should load upon creation.
Expand Down
Loading