From 22317f423d71cce75c689fcd184e58d4169188d5 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 26 Aug 2014 14:08:38 -0700 Subject: [PATCH] Update mojo's WebMimeRegistry for supportsImagePrefixed This is a new pure virtual on WebMimeRegistry. The implementations of WebMimeRegistry appear to bind only to net, so they could go somewhere and be shared by both content/ and mojo/ instead of duplicated. But this fixes a pending compile error so should probably happen first. R=darin@chromium.org Review URL: https://codereview.chromium.org/511583002 Cr-Commit-Position: refs/heads/master@{#291981} --- mojo/services/html_viewer/webmimeregistry_impl.cc | 11 +++++++++++ mojo/services/html_viewer/webmimeregistry_impl.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/mojo/services/html_viewer/webmimeregistry_impl.cc b/mojo/services/html_viewer/webmimeregistry_impl.cc index 73a97accd0de..edaed24e39e9 100644 --- a/mojo/services/html_viewer/webmimeregistry_impl.cc +++ b/mojo/services/html_viewer/webmimeregistry_impl.cc @@ -36,6 +36,17 @@ blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsImageMIMEType( } blink::WebMimeRegistry::SupportsType +WebMimeRegistryImpl::supportsImagePrefixedMIMEType( + const blink::WebString& mime_type) { + std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); + return (net::IsSupportedImageMimeType(ascii_mime_type) || + (StartsWithASCII(ascii_mime_type, "image/", true) && + net::IsSupportedNonImageMimeType(ascii_mime_type))) + ? WebMimeRegistry::IsSupported + : WebMimeRegistry::IsNotSupported; +} + +blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsJavaScriptMIMEType( const blink::WebString& mime_type) { return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? diff --git a/mojo/services/html_viewer/webmimeregistry_impl.h b/mojo/services/html_viewer/webmimeregistry_impl.h index 53e88a121c87..ba25ec91e681 100644 --- a/mojo/services/html_viewer/webmimeregistry_impl.h +++ b/mojo/services/html_viewer/webmimeregistry_impl.h @@ -20,6 +20,8 @@ class WebMimeRegistryImpl : public blink::WebMimeRegistry { const blink::WebString& mime_type); virtual blink::WebMimeRegistry::SupportsType supportsImageMIMEType( const blink::WebString& mime_type); + virtual blink::WebMimeRegistry::SupportsType supportsImagePrefixedMIMEType( + const blink::WebString& mime_type); virtual blink::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType( const blink::WebString& mime_type); virtual blink::WebMimeRegistry::SupportsType supportsMediaMIMEType( -- 2.11.4.GIT