Index: mojo/services/html_viewer/webmimeregistry_impl.cc |
diff --git a/mojo/services/html_viewer/webmimeregistry_impl.cc b/mojo/services/html_viewer/webmimeregistry_impl.cc |
index edaed24e39e9cdfb0161e7a34e4aaec720ff2bf0..2faac176dedb38022cd271d0bb910ba795c61754 100644 |
--- a/mojo/services/html_viewer/webmimeregistry_impl.cc |
+++ b/mojo/services/html_viewer/webmimeregistry_impl.cc |
@@ -58,8 +58,32 @@ blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( |
const blink::WebString& mime_type, |
const blink::WebString& codecs, |
const blink::WebString& key_system) { |
- NOTIMPLEMENTED(); |
- return IsNotSupported; |
+ const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
+ // Not supporting the container is a flat-out no. |
+ if (!net::IsSupportedMediaMimeType(mime_type_ascii)) |
+ return IsNotSupported; |
+ |
+ // Mojo does not currently support any key systems. |
+ if (!key_system.isEmpty()) |
+ return IsNotSupported; |
+ |
+ // Check list of strict codecs to see if it is supported. |
+ if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
+ // Check if the codecs are a perfect match. |
+ std::vector<std::string> strict_codecs; |
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
+ return static_cast<WebMimeRegistry::SupportsType>( |
+ net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); |
+ } |
+ |
+ // If we don't recognize the codec, it's possible we support it. |
+ std::vector<std::string> parsed_codecs; |
+ net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
+ if (!net::AreSupportedMediaCodecs(parsed_codecs)) |
+ return MayBeSupported; |
+ |
+ // Otherwise we have a perfect match. |
+ return IsSupported; |
} |
bool WebMimeRegistryImpl::supportsMediaSourceMIMEType( |