Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1004)

Unified Diff: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java

Issue 117403003: Add support for closing Android Shell instances from Java. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
diff --git a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
index c1f1e3d685d9db57a9cb9b4989f053653a420c17..6663f31ea9c7e85da9051ff57945668527bb0b56 100644
--- a/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
+++ b/content/shell/android/java/src/org/chromium/content_shell/ShellManager.java
@@ -11,6 +11,7 @@ import android.widget.FrameLayout;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+import org.chromium.base.ThreadUtils;
import org.chromium.content.browser.ContentView;
import org.chromium.content.browser.ContentViewRenderView;
import org.chromium.ui.base.WindowAndroid;
@@ -82,6 +83,7 @@ public class ShellManager extends FrameLayout {
* @param url The URL the shell should load upon creation.
*/
public void launchShell(String url) {
+ ThreadUtils.assertOnUiThread();
nativeLaunchShell(url);
}
@@ -96,14 +98,14 @@ public class ShellManager extends FrameLayout {
@SuppressWarnings("unused")
@CalledByNative
- private Object createShell() {
+ private Object createShell(long nativeShellPtr) {
assert mContentViewRenderView != null;
LayoutInflater inflater =
(LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null);
- shellView.setWindow(mWindow);
+ shellView.initialize(nativeShellPtr, mWindow);
- if (mActiveShell != null) closeShell(mActiveShell);
+ if (mActiveShell != null) mActiveShell.close();
shellView.setContentViewRenderView(mContentViewRenderView);
addView(shellView, new FrameLayout.LayoutParams(
@@ -120,12 +122,11 @@ public class ShellManager extends FrameLayout {
@SuppressWarnings("unused")
@CalledByNative
- private void closeShell(Shell shellView) {
+ private void removeShell(Shell shellView) {
if (shellView == mActiveShell) mActiveShell = null;
ContentView contentView = shellView.getContentView();
if (contentView != null) contentView.onHide();
shellView.setContentViewRenderView(null);
- shellView.setWindow(null);
removeView(shellView);
}

Powered by Google App Engine
This is Rietveld 408576698