summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2010-09-16 15:03:07 -0700
committerShimeng (Simon) Wang <swang@google.com>2010-10-15 16:08:22 -0700
commitf6b396da7ac510af40b99ef1f2b0d9063cb8577c (patch)
tree94555458927cbc7ee6a3da8244649b42bf15dae5
parente228a64d32a6c1f9d88cf43529f69792207585dd (diff)
downloadexternal_webkit-f6b396da7ac510af40b99ef1f2b0d9063cb8577c.zip
external_webkit-f6b396da7ac510af40b99ef1f2b0d9063cb8577c.tar.gz
external_webkit-f6b396da7ac510af40b99ef1f2b0d9063cb8577c.tar.bz2
DO NOT MERGE
For cherry-picking to GB. Implement supportsType in MediaPlayerPrivateAndroid. Use Java API to obtain this info. issue: 3101402 Change-Id: I2baaf8ad861bec9b9b6f92fe753cbd879b33497c
-rw-r--r--WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp2
-rw-r--r--WebKit/android/jni/WebViewCore.cpp23
-rw-r--r--WebKit/android/jni/WebViewCore.h3
3 files changed, 28 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
index bfb5305..3767516 100644
--- a/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/MediaPlayerPrivateAndroid.cpp
@@ -273,6 +273,8 @@ void MediaPlayerPrivate::getSupportedTypes(HashSet<String>&)
MediaPlayer::SupportsType MediaPlayerPrivate::supportsType(const String& type, const String& codecs)
{
+ if (WebViewCore::supportsMimeType(type))
+ return MediaPlayer::MayBeSupported;
return MediaPlayer::IsNotSupported;
}
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 1562775..3f3eb42 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -189,6 +189,24 @@ jobject WebViewCore::getApplicationContext() {
return result;
}
+
+struct WebViewCoreStaticMethods {
+ jmethodID m_supportsMimeType;
+} gWebViewCoreStaticMethods;
+
+// Check whether a media mimeType is supported in Android media framework.
+bool WebViewCore::supportsMimeType(const WebCore::String& mimeType) {
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jstring jMimeType = env->NewString(mimeType.characters(), mimeType.length());
+ jclass webViewCore = env->FindClass("android/webkit/WebViewCore");
+ bool val = env->CallStaticBooleanMethod(webViewCore,
+ gWebViewCoreStaticMethods.m_supportsMimeType, jMimeType);
+ checkException(env);
+ env->DeleteLocalRef(jMimeType);
+
+ return val;
+}
+
// ----------------------------------------------------------------------------
#define GET_NATIVE_VIEW(env, obj) ((WebViewCore*)env->GetIntField(obj, gWebViewCoreFields.m_nativeClass))
@@ -3295,6 +3313,11 @@ int register_webviewcore(JNIEnv* env)
LOG_ASSERT(gWebViewCoreFields.m_webView,
"Unable to find android/webkit/WebViewCore.mWebView");
+ gWebViewCoreStaticMethods.m_supportsMimeType =
+ env->GetStaticMethodID(widget, "supportsMimeType", "(Ljava/lang/String;)Z");
+ LOG_ASSERT(gWebViewCoreStaticMethods.m_supportsMimeType == NULL,
+ "Could not find static method supportsMimeType from WebViewCore");
+
return jniRegisterNativeMethods(env, "android/webkit/WebViewCore",
gJavaWebViewCoreMethods, NELEM(gJavaWebViewCoreMethods));
}
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 056dba1..2944599 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -578,6 +578,9 @@ namespace android {
// if there exists at least on WebViewCore instance then we return the
// application context, otherwise NULL is returned.
static jobject getApplicationContext();
+
+ // Check whether a media mimeType is supported in Android media framework.
+ static bool supportsMimeType(const WebCore::String& mimeType);
};
} // namespace android