diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-22 14:43:58 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-22 14:43:58 +0000 |
commit | a22282ccd0e22cb9882e66e53058c1fadf71219f (patch) | |
tree | 4a6f72ca545af1a8902a0f07678574b8519c9eaa /webkit/glue | |
parent | d1049d07f0cb04b1d1643e74c10122f9e5563ec7 (diff) | |
download | chromium_src-a22282ccd0e22cb9882e66e53058c1fadf71219f.zip chromium_src-a22282ccd0e22cb9882e66e53058c1fadf71219f.tar.gz chromium_src-a22282ccd0e22cb9882e66e53058c1fadf71219f.tar.bz2 |
Shuffle media-related WebMimeRegistry code from webkit/ to content/.
TestShellWebMimeRegistryImpl has been replaced in lieu of content_shell calling net::RemoveProprietaryMediaTypesAndCodecsForTests().
BUG=251306
Review URL: https://chromiumcodereview.appspot.com/17447011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@208045 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/DEPS | 1 | ||||
-rw-r--r-- | webkit/glue/simple_webmimeregistry_impl.cc | 76 | ||||
-rw-r--r-- | webkit/glue/simple_webmimeregistry_impl.h | 12 |
3 files changed, 19 insertions, 70 deletions
diff --git a/webkit/glue/DEPS b/webkit/glue/DEPS index 629d0b4..9520156 100644 --- a/webkit/glue/DEPS +++ b/webkit/glue/DEPS @@ -1,6 +1,5 @@ include_rules = [ "+gpu", - "+media/filters", "+skia/ext", "+skia/include", "+ui", diff --git a/webkit/glue/simple_webmimeregistry_impl.cc b/webkit/glue/simple_webmimeregistry_impl.cc index 67fada6..eb11772 100644 --- a/webkit/glue/simple_webmimeregistry_impl.cc +++ b/webkit/glue/simple_webmimeregistry_impl.cc @@ -7,27 +7,20 @@ #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "media/filters/stream_parser_factory.h" #include "net/base/mime_util.h" #include "third_party/WebKit/public/platform/WebString.h" #include "webkit/base/file_path_string_conversions.h" -#include "webkit/renderer/media/crypto/key_systems.h" using WebKit::WebString; using WebKit::WebMimeRegistry; -namespace { +namespace webkit_glue { -// Convert a WebString to ASCII, falling back on an empty string in the case -// of a non-ASCII string. -std::string ToASCIIOrEmpty(const WebString& string) { +//static +std::string SimpleWebMimeRegistryImpl::ToASCIIOrEmpty(const WebString& string) { return IsStringASCII(string) ? UTF16ToASCII(string) : std::string(); } -} // namespace - -namespace webkit_glue { - WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMIMEType( const WebString& mime_type) { return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? @@ -51,72 +44,23 @@ WebMimeRegistry::SupportsType // see TestShellWebMimeRegistryImpl. WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMediaMIMEType( const WebString& mime_type, const WebString& codecs) { - return supportsMediaMIMEType(mime_type, codecs, WebString()); + // Media features are only supported at the content/ layer. + return IsNotSupported; } WebMimeRegistry::SupportsType SimpleWebMimeRegistryImpl::supportsMediaMIMEType( const WebString& mime_type, const WebString& codecs, const WebString& key_system) { - 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; - - if (!key_system.isEmpty()) { - // Check whether the key system is supported with the mime_type and codecs. - - // Not supporting the key system is a flat-out no. - if (!webkit_media::IsSupportedKeySystem(key_system)) - return IsNotSupported; - - std::vector<std::string> strict_codecs; - bool strip_suffix = !net::IsStrictMediaMimeType(mime_type_ascii); - net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, strip_suffix); - - if (!webkit_media::IsSupportedKeySystemWithMediaMimeType( - mime_type_ascii, strict_codecs, ToASCIIOrEmpty(key_system))) - return IsNotSupported; - - // Continue processing the mime_type and codecs. - } - - // Check list of strict codecs to see if it is supported. - if (net::IsStrictMediaMimeType(mime_type_ascii)) { - // We support the container, but no codecs were specified. - if (codecs.isNull()) - return MayBeSupported; - - // Check if the codecs are a perfect match. - std::vector<std::string> strict_codecs; - net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); - if (!net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)) - return IsNotSupported; - - // Good to go! - return IsSupported; - } - - // 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; + // Media features are only supported at the content/ layer. + return IsNotSupported; } bool SimpleWebMimeRegistryImpl::supportsMediaSourceMIMEType( - const WebKit::WebString& mime_type, + const WebString& mime_type, const WebString& codecs) { - const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); - std::vector<std::string> parsed_codec_ids; - net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codec_ids, false); - if (mime_type_ascii.empty() || parsed_codec_ids.size() == 0) - return false; - return media::StreamParserFactory::IsTypeSupported( - mime_type_ascii, parsed_codec_ids); + // Media features are only supported at the content/ layer. + return IsNotSupported; } WebMimeRegistry::SupportsType diff --git a/webkit/glue/simple_webmimeregistry_impl.h b/webkit/glue/simple_webmimeregistry_impl.h index cdf6232..39972ebe 100644 --- a/webkit/glue/simple_webmimeregistry_impl.h +++ b/webkit/glue/simple_webmimeregistry_impl.h @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef WEBMIMEREGISTRY_IMPL_H_ -#define WEBMIMEREGISTRY_IMPL_H_ +#ifndef WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_ +#define WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_ + +#include <string> #include "base/compiler_specific.h" #include "third_party/WebKit/public/platform/WebMimeRegistry.h" @@ -17,6 +19,10 @@ class WEBKIT_GLUE_EXPORT SimpleWebMimeRegistryImpl : SimpleWebMimeRegistryImpl() {} virtual ~SimpleWebMimeRegistryImpl() {} + // Convert a WebString to ASCII, falling back on an empty string in the case + // of a non-ASCII string. + static std::string ToASCIIOrEmpty(const WebKit::WebString& string); + // WebMimeRegistry methods: virtual WebKit::WebMimeRegistry::SupportsType supportsMIMEType( const WebKit::WebString&); @@ -45,4 +51,4 @@ class WEBKIT_GLUE_EXPORT SimpleWebMimeRegistryImpl : } // namespace webkit_glue -#endif // WEBMIMEREGISTRY_IMPL_H_ +#endif // WEBKIT_GLUE_SIMPLE_WEBMIMEREGISTRY_IMPL_H_ |