| Index: content/shell/android/java/src/org/chromium/content_shell/Shell.java
|
| diff --git a/content/shell/android/java/src/org/chromium/content_shell/Shell.java b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
|
| index 1ec5919eae826ce8dd5eb6662cc2e8b2db5c24c6..1010c80df85ca6329d8a3f403cef64093d8d1daa 100644
|
| --- a/content/shell/android/java/src/org/chromium/content_shell/Shell.java
|
| +++ b/content/shell/android/java/src/org/chromium/content_shell/Shell.java
|
| @@ -49,6 +49,7 @@ public class Shell extends LinearLayout {
|
|
|
| private ClipDrawable mProgressDrawable;
|
|
|
| + private long mNativeShell;
|
| private ContentViewRenderView mContentViewRenderView;
|
| private WindowAndroid mWindow;
|
|
|
| @@ -80,13 +81,43 @@ public class Shell extends LinearLayout {
|
| }
|
|
|
| /**
|
| + * Initializes the Shell for use.
|
| + *
|
| + * @param nativeShell The pointer to the native Shell object.
|
| * @param window The owning window for this shell.
|
| */
|
| - public void setWindow(WindowAndroid window) {
|
| + public void initialize(long nativeShell, WindowAndroid window) {
|
| + mNativeShell = nativeShell;
|
| mWindow = window;
|
| }
|
|
|
| /**
|
| + * Closes the shell and cleans up the native instance, which will handle destroying all
|
| + * dependencies.
|
| + */
|
| + public void close() {
|
| + if (mNativeShell == 0) return;
|
| + nativeCloseShell(mNativeShell);
|
| + }
|
| +
|
| + @CalledByNative
|
| + private void onNativeDestroyed() {
|
| + mWindow = null;
|
| + mNativeShell = 0;
|
| + assert !mContentView.isAttachedToWindow()
|
| + : "Attempting to destroy the content view while attached to the view hierarchy.";
|
| + mContentView.destroy();
|
| + }
|
| +
|
| + /**
|
| + * @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() {
|
| @@ -242,4 +273,6 @@ public class Shell extends LinearLayout {
|
| imm.hideSoftInputFromWindow(mUrlTextView.getWindowToken(), 0);
|
| }
|
| }
|
| +
|
| + private static native void nativeCloseShell(long shellPtr);
|
| }
|
|
|