summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2009-12-01 08:47:54 -0500
committerDerek Sollenberger <djsollen@google.com>2009-12-01 08:50:24 -0500
commit51e45ff0d53ce299be316e14e48cdd3e3a51d0b0 (patch)
tree4ed55132f821768e27bbff7161d130e272320bf5
parentc3e20af0b6aed8afe28be5fa08b8d69c6b50f34c (diff)
downloadframeworks_base-51e45ff0d53ce299be316e14e48cdd3e3a51d0b0.zip
frameworks_base-51e45ff0d53ce299be316e14e48cdd3e3a51d0b0.tar.gz
frameworks_base-51e45ff0d53ce299be316e14e48cdd3e3a51d0b0.tar.bz2
Cleanup how a plugin goes full-screen.
The plugin activity now fetches the plugin's existing java class from native code instead of creating a new one.
-rw-r--r--core/java/android/webkit/PluginActivity.java30
-rw-r--r--core/java/android/webkit/WebViewCore.java9
2 files changed, 21 insertions, 18 deletions
diff --git a/core/java/android/webkit/PluginActivity.java b/core/java/android/webkit/PluginActivity.java
index 22d6ccb..c60512b 100644
--- a/core/java/android/webkit/PluginActivity.java
+++ b/core/java/android/webkit/PluginActivity.java
@@ -18,18 +18,19 @@ package android.webkit;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
import android.view.View;
import android.webkit.plugin.SurfaceDrawingModel;
import android.webkit.plugin.WebkitPlugin;
/**
- * This activity is invoked when a plugin elects to go into full screen mode.
+ * This activity is invoked when a plugin elects to go into full screen mode.
* @hide
*/
public class PluginActivity extends Activity {
- /* package */ static final String INTENT_EXTRA_PACKAGE_NAME =
- "android.webkit.plugin.PACKAGE_NAME";
+ private static final String LOGTAG = "PluginActivity";
+
/* package */ static final String INTENT_EXTRA_NPP_INSTANCE =
"android.webkit.plugin.NPP_INSTANCE";
@@ -40,24 +41,30 @@ public class PluginActivity extends Activity {
final Intent intent = getIntent();
if (intent == null) {
- // No intent means no class to lookup.
+ Log.e(LOGTAG, "Unable to retrieve the intent responsible for this activity");
finish();
return;
}
- final String pkgName = intent.getStringExtra(INTENT_EXTRA_PACKAGE_NAME);
+
final int npp = intent.getIntExtra(INTENT_EXTRA_NPP_INSTANCE, -1);
- // XXX retrieve the existing object instead of creating a new one
- WebkitPlugin plugin = PluginManager.getInstance(null).getPluginInstance(pkgName, npp);
+ if (npp == -1) {
+ Log.e(LOGTAG, "The intent did not include the NPP pointer");
+ finish();
+ return;
+ }
+
+ // retrieve the plugin's existing java object instead of creating a new one
+ WebkitPlugin plugin = nativeGetWebkitPlugin(npp);
if (plugin == null) {
- //TODO log error
+ Log.e(LOGTAG, "Unable to retrieve the plugin's java interface");
finish();
return;
}
SurfaceDrawingModel fullScreenSurface = plugin.getFullScreenSurface();
- if(fullScreenSurface == null) {
- //TODO log error
+ if (fullScreenSurface == null) {
+ Log.e(LOGTAG, "The plugin returned a null value for the full-screen interface");
finish();
return;
}
@@ -67,7 +74,10 @@ public class PluginActivity extends Activity {
} else {
// No custom full-sreen view returned by the plugin, odd but
// just in case, finish the activity.
+ Log.e(LOGTAG, "The plugin's full-screen interface returned a null view");
finish();
}
}
+
+ native WebkitPlugin nativeGetWebkitPlugin(int npp);
}
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index be36fe0..1f2e810 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2216,19 +2216,12 @@ final class WebViewCore {
// called by JNI. PluginWidget function to launch an activity and overlays
// the activity with the View provided by the plugin class.
- private void startFullScreenPluginActivity(String libName, int npp) {
+ private void startFullScreenPluginActivity(int npp) {
if (mWebView == null) {
return;
}
- String pkgName = PluginManager.getInstance(null).getPluginsAPKName(libName);
- if (pkgName == null) {
- Log.w(LOGTAG, "Unable to resolve " + libName + " to a plugin APK");
- return;
- }
-
Intent intent = new Intent("android.intent.webkit.PLUGIN");
- intent.putExtra(PluginActivity.INTENT_EXTRA_PACKAGE_NAME, pkgName);
intent.putExtra(PluginActivity.INTENT_EXTRA_NPP_INSTANCE, npp);
mWebView.getContext().startActivity(intent);
}