diff options
author | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 12:41:52 +0000 |
---|---|---|
committer | skyostil@chromium.org <skyostil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-29 12:41:52 +0000 |
commit | 91c6e316739c0558672ccd8178638cbcfe5c7903 (patch) | |
tree | d8b52fffdba371a83678775133b06f92235e2df8 | |
parent | 537a42eb0eac0303d8a9ee98b55bc32eb697c71f (diff) | |
download | chromium_src-91c6e316739c0558672ccd8178638cbcfe5c7903.zip chromium_src-91c6e316739c0558672ccd8178638cbcfe5c7903.tar.gz chromium_src-91c6e316739c0558672ccd8178638cbcfe5c7903.tar.bz2 |
Android: implement content::Shell::Close()
This patch implements the Shell::Close() method for Content Shell on Android.
BUG=138226
Review URL: https://chromiumcodereview.appspot.com/14977010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202852 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/shell/android/java/src/org/chromium/content_shell/ShellManager.java | 18 | ||||
-rw-r--r-- | content/shell/android/shell_manager.cc | 6 | ||||
-rw-r--r-- | content/shell/android/shell_manager.h | 3 | ||||
-rw-r--r-- | content/shell/shell_android.cc | 5 |
4 files changed, 24 insertions, 8 deletions
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 b3fd950..2791442 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 @@ -92,12 +92,7 @@ public class ShellManager extends FrameLayout { Shell shellView = (Shell) inflater.inflate(R.layout.shell_view, null); shellView.setWindow(mWindow); - removeAllViews(); - if (mActiveShell != null) { - ContentView contentView = mActiveShell.getContentView(); - if (contentView != null) contentView.onHide(); - mActiveShell.setContentViewRenderView(null); - } + if (mActiveShell != null) closeShell(mActiveShell); shellView.setContentViewRenderView(mContentViewRenderView); addView(shellView, new FrameLayout.LayoutParams( @@ -112,6 +107,17 @@ public class ShellManager extends FrameLayout { return shellView; } + @SuppressWarnings("unused") + @CalledByNative + private void closeShell(Shell shellView) { + if (shellView == mActiveShell) mActiveShell = null; + ContentView contentView = shellView.getContentView(); + if (contentView != null) contentView.onHide(); + shellView.setContentViewRenderView(null); + shellView.setWindow(null); + removeView(shellView); + } + private static native void nativeInit(Object shellManagerInstance); private static native void nativeLaunchShell(String url); } diff --git a/content/shell/android/shell_manager.cc b/content/shell/android/shell_manager.cc index 0b12e1d..5ef54c2 100644 --- a/content/shell/android/shell_manager.cc +++ b/content/shell/android/shell_manager.cc @@ -38,6 +38,12 @@ jobject CreateShellView(Shell* shell) { return Java_ShellManager_createShell(env, j_shell_manager).Release(); } +void CloseShellView(jobject shell_view) { + JNIEnv* env = base::android::AttachCurrentThread(); + jobject j_shell_manager = g_global_state.Get().j_shell_manager.obj(); + Java_ShellManager_closeShell(env, j_shell_manager, shell_view); +} + // Register native methods bool RegisterShellManager(JNIEnv* env) { return RegisterNativesImpl(env); diff --git a/content/shell/android/shell_manager.h b/content/shell/android/shell_manager.h index c79b20f..f5505435 100644 --- a/content/shell/android/shell_manager.h +++ b/content/shell/android/shell_manager.h @@ -24,6 +24,9 @@ namespace content { // object. jobject CreateShellView(Shell* shell); +// Closes a previously created shell view. +void CloseShellView(jobject shell_view); + // Registers the ShellManager native methods. bool RegisterShellManager(JNIEnv* env); diff --git a/content/shell/shell_android.cc b/content/shell/shell_android.cc index d8a6fcb..d12d0d7 100644 --- a/content/shell/shell_android.cc +++ b/content/shell/shell_android.cc @@ -80,8 +80,9 @@ bool Shell::PlatformIsFullscreenForTabOrPending( } void Shell::Close() { - // TODO(tedchoc): Implement Close method for android shell - NOTIMPLEMENTED(); + CloseShellView(java_object_.obj()); + java_object_.Reset(); + delete this; } // static |