diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-25 01:34:57 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-25 01:34:57 +0000 |
commit | df407eaf9bad2ca4e4d2099904d0a35d11caec3e (patch) | |
tree | f645a4906ee7887995ee8c8df3e8251d00bc9fd9 /webkit/glue/simple_webmimeregistry_impl.cc | |
parent | 29acfb3095a9e484443ffc149d43908ecb17f42f (diff) | |
download | chromium_src-df407eaf9bad2ca4e4d2099904d0a35d11caec3e.zip chromium_src-df407eaf9bad2ca4e4d2099904d0a35d11caec3e.tar.gz chromium_src-df407eaf9bad2ca4e4d2099904d0a35d11caec3e.tar.bz2 |
Implemented rest of webkit api/glue code needed for HTML5 media canPlayType().
BUG=16636
TEST=we should respect the codecs= parameter when provided as a media mime type
Review URL: http://codereview.chromium.org/160073
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/simple_webmimeregistry_impl.cc')
-rw-r--r-- | webkit/glue/simple_webmimeregistry_impl.cc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc index 95c39a1..29296ff 100644 --- a/webkit/glue/simple_webmimeregistry_impl.cc +++ b/webkit/glue/simple_webmimeregistry_impl.cc @@ -12,27 +12,45 @@ #include "webkit/glue/webkit_glue.h" using WebKit::WebString; +using WebKit::WebMimeRegistry; namespace webkit_glue { -bool SimpleWebMimeRegistryImpl::supportsImageMIMEType( +WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsImageMIMEType( const WebString& mime_type) { - return net::IsSupportedImageMimeType(UTF16ToASCII(mime_type).c_str()); + if (!net::IsSupportedImageMimeType(UTF16ToASCII(mime_type).c_str())) + return WebMimeRegistry::IsNotSupported; + return WebMimeRegistry::IsSupported; } -bool SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType( +WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsJavaScriptMIMEType( const WebString& mime_type) { - return net::IsSupportedJavascriptMimeType(UTF16ToASCII(mime_type).c_str()); + if (!net::IsSupportedJavascriptMimeType(UTF16ToASCII(mime_type).c_str())) + return WebMimeRegistry::IsNotSupported; + return WebMimeRegistry::IsSupported; } -bool SimpleWebMimeRegistryImpl::supportsMediaMIMEType( - const WebString& mime_type) { - return net::IsSupportedMediaMimeType(UTF16ToASCII(mime_type).c_str()); +WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMediaMIMEType( + const WebString& mime_type, const WebString& codecs) { + // Not supporting the container is a flat-out no. + if (!net::IsSupportedMediaMimeType(UTF16ToASCII(mime_type).c_str())) + return IsNotSupported; + + // If we don't recognize the codec, it's possible we support it. + std::vector<std::string> parsed_codecs; + net::ParseCodecString(UTF16ToASCII(codecs).c_str(), &parsed_codecs); + if (!net::AreSupportedMediaCodecs(parsed_codecs)) + return MayBeSupported; + + // Otherwise we have a perfect match. + return IsSupported; } -bool SimpleWebMimeRegistryImpl::supportsNonImageMIMEType( +WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsNonImageMIMEType( const WebString& mime_type) { - return net::IsSupportedNonImageMimeType(UTF16ToASCII(mime_type).c_str()); + if (!net::IsSupportedNonImageMimeType(UTF16ToASCII(mime_type).c_str())) + return WebMimeRegistry::IsNotSupported; + return WebMimeRegistry::IsSupported; } WebString SimpleWebMimeRegistryImpl::mimeTypeForExtension( |