Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: webkit/glue/simple_webmimeregistry_impl.cc

Issue 160073: Implemented rest of webkit api/glue code needed for HTML5 media canPlayType(). (Closed)
Patch Set: SupportsType... it's everywhere! Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/simple_webmimeregistry_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/simple_webmimeregistry_impl.cc
diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc
index 95c39a1650e7b0295441af43612a794645921325..29296ff13151539c3e3bf3ee0874c8f802d24237 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(
« no previous file with comments | « webkit/glue/simple_webmimeregistry_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698