summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-22 14:43:58 +0000
committerscherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-22 14:43:58 +0000
commita22282ccd0e22cb9882e66e53058c1fadf71219f (patch)
tree4a6f72ca545af1a8902a0f07678574b8519c9eaa
parentd1049d07f0cb04b1d1643e74c10122f9e5563ec7 (diff)
downloadchromium_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
-rw-r--r--content/public/renderer/content_renderer_client.cc4
-rw-r--r--content/public/renderer/content_renderer_client.h5
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc100
-rw-r--r--content/shell/app/shell_main_delegate.cc7
-rw-r--r--content/shell/renderer/shell_content_renderer_client.cc10
-rw-r--r--content/shell/renderer/shell_content_renderer_client.h3
-rw-r--r--net/base/mime_util.cc39
-rw-r--r--net/base/mime_util.h13
-rw-r--r--net/net.gyp5
-rw-r--r--webkit/glue/DEPS1
-rw-r--r--webkit/glue/simple_webmimeregistry_impl.cc76
-rw-r--r--webkit/glue/simple_webmimeregistry_impl.h12
-rw-r--r--webkit/support/test_shell_webmimeregistry_impl.cc70
-rw-r--r--webkit/support/test_shell_webmimeregistry_impl.h45
-rw-r--r--webkit/support/test_webkit_platform_support.h4
-rw-r--r--webkit/support/webkit_support.gypi2
-rw-r--r--webkit/tools/DEPS1
17 files changed, 141 insertions, 256 deletions
diff --git a/content/public/renderer/content_renderer_client.cc b/content/public/renderer/content_renderer_client.cc
index 255b89f..bd12385 100644
--- a/content/public/renderer/content_renderer_client.cc
+++ b/content/public/renderer/content_renderer_client.cc
@@ -63,10 +63,6 @@ WebKit::WebClipboard* ContentRendererClient::OverrideWebClipboard() {
return NULL;
}
-WebKit::WebMimeRegistry* ContentRendererClient::OverrideWebMimeRegistry() {
- return NULL;
-}
-
WebKit::WebHyphenator* ContentRendererClient::OverrideWebHyphenator() {
return NULL;
}
diff --git a/content/public/renderer/content_renderer_client.h b/content/public/renderer/content_renderer_client.h
index 31dd791..b7984ce 100644
--- a/content/public/renderer/content_renderer_client.h
+++ b/content/public/renderer/content_renderer_client.h
@@ -32,7 +32,6 @@ class WebHyphenator;
class WebMediaPlayerClient;
class WebMediaStreamCenter;
class WebMediaStreamCenterClient;
-class WebMimeRegistry;
class WebPlugin;
class WebPluginContainer;
class WebPrescientNetworking;
@@ -149,10 +148,6 @@ class CONTENT_EXPORT ContentRendererClient {
// returns NULL the content layer will handle clipboard interactions.
virtual WebKit::WebClipboard* OverrideWebClipboard();
- // Allows the embedder to override the WebKit::WebMimeRegistry used. If it
- // returns NULL the content layer will provide its own mime registry.
- virtual WebKit::WebMimeRegistry* OverrideWebMimeRegistry();
-
// Allows the embedder to override the WebKit::WebHyphenator used. If it
// returns NULL the content layer will handle hyphenation.
virtual WebKit::WebHyphenator* OverrideWebHyphenator();
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 8e8ac08..8888867 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -42,6 +42,8 @@
#include "ipc/ipc_sync_message_filter.h"
#include "media/audio/audio_output_device.h"
#include "media/base/audio_hardware_config.h"
+#include "media/filters/stream_parser_factory.h"
+#include "net/base/mime_util.h"
#include "net/base/net_util.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
@@ -59,6 +61,7 @@
#include "webkit/glue/webfileutilities_impl.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/renderer/media/audio_decoder.h"
+#include "webkit/renderer/media/crypto/key_systems.h"
#if defined(OS_WIN)
#include "content/common/child_process_messages.h"
@@ -100,6 +103,7 @@ using WebKit::WebMIDIAccessor;
using WebKit::Platform;
using WebKit::WebMediaStreamCenter;
using WebKit::WebMediaStreamCenterClient;
+using WebKit::WebMimeRegistry;
using WebKit::WebRTCPeerConnectionHandler;
using WebKit::WebRTCPeerConnectionHandlerClient;
using WebKit::WebStorageNamespace;
@@ -118,10 +122,22 @@ base::LazyInstance<WebGamepads>::Leaky g_test_gamepads =
class RendererWebKitPlatformSupportImpl::MimeRegistry
: public webkit_glue::SimpleWebMimeRegistryImpl {
public:
- virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
- virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
+ // TODO(ddorwin): Remove after http://webk.it/82983 lands.
+ virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
+ const WebKit::WebString& mime_type,
+ const WebKit::WebString& codecs);
+ virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
+ const WebKit::WebString& mime_type,
+ const WebKit::WebString& codecs,
+ const WebKit::WebString& key_system);
+ virtual bool supportsMediaSourceMIMEType(const WebKit::WebString& mime_type,
+ const WebKit::WebString& codecs);
+ virtual WebKit::WebString mimeTypeForExtension(
+ const WebKit::WebString& file_extension);
+ virtual WebKit::WebString mimeTypeFromFile(
+ const WebKit::WebString& file_path);
virtual WebKit::WebString preferredExtensionForMIMEType(
- const WebKit::WebString&);
+ const WebKit::WebString& mime_type);
};
class RendererWebKitPlatformSupportImpl::FileUtilities
@@ -229,10 +245,6 @@ WebKit::WebClipboard* RendererWebKitPlatformSupportImpl::clipboard() {
}
WebKit::WebMimeRegistry* RendererWebKitPlatformSupportImpl::mimeRegistry() {
- WebKit::WebMimeRegistry* mime_registry =
- GetContentClient()->renderer()->OverrideWebMimeRegistry();
- if (mime_registry)
- return mime_registry;
return mime_registry_.get();
}
@@ -386,6 +398,80 @@ WebFileSystem* RendererWebKitPlatformSupportImpl::fileSystem() {
//------------------------------------------------------------------------------
+WebMimeRegistry::SupportsType
+RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaMIMEType(
+ const WebString& mime_type,
+ const WebString& codecs) {
+ return supportsMediaMIMEType(mime_type, codecs, WebString());
+}
+
+WebMimeRegistry::SupportsType
+RendererWebKitPlatformSupportImpl::MimeRegistry::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;
+}
+
+bool
+RendererWebKitPlatformSupportImpl::MimeRegistry::supportsMediaSourceMIMEType(
+ const WebKit::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);
+}
+
WebString
RendererWebKitPlatformSupportImpl::MimeRegistry::mimeTypeForExtension(
const WebString& file_extension) {
diff --git a/content/shell/app/shell_main_delegate.cc b/content/shell/app/shell_main_delegate.cc
index e594107..2dbc7ef 100644
--- a/content/shell/app/shell_main_delegate.cc
+++ b/content/shell/app/shell_main_delegate.cc
@@ -141,6 +141,13 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
command_line.AppendSwitch(switches::kEnableSoftwareCompositingGLAdapter);
net::CookieMonster::EnableFileScheme();
+
+ // Unless/until WebM files are added to the media layout tests, we need to
+ // avoid removing MP4/H264/AAC so that layout tests can run on Android.
+#if !defined(OS_ANDROID)
+ net::RemoveProprietaryMediaTypesAndCodecsForTests();
+#endif
+
if (!WebKitTestPlatformInitialize()) {
if (exit_code)
*exit_code = 1;
diff --git a/content/shell/renderer/shell_content_renderer_client.cc b/content/shell/renderer/shell_content_renderer_client.cc
index e1cd50e..0cb8bfc 100644
--- a/content/shell/renderer/shell_content_renderer_client.cc
+++ b/content/shell/renderer/shell_content_renderer_client.cc
@@ -23,14 +23,12 @@
#include "v8/include/v8.h"
#include "webkit/mocks/mock_webhyphenator.h"
#include "webkit/support/mock_webclipboard_impl.h"
-#include "webkit/support/test_shell_webmimeregistry_impl.h"
using WebKit::WebClipboard;
using WebKit::WebFrame;
using WebKit::WebHyphenator;
using WebKit::WebMediaStreamCenter;
using WebKit::WebMediaStreamCenterClient;
-using WebKit::WebMimeRegistry;
using WebKit::WebPlugin;
using WebKit::WebPluginParams;
using WebKit::WebRTCPeerConnectionHandler;
@@ -150,14 +148,6 @@ WebClipboard* ShellContentRendererClient::OverrideWebClipboard() {
return clipboard_.get();
}
-WebMimeRegistry* ShellContentRendererClient::OverrideWebMimeRegistry() {
- if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
- return NULL;
- if (!mime_registry_)
- mime_registry_.reset(new TestShellWebMimeRegistryImpl);
- return mime_registry_.get();
-}
-
WebHyphenator* ShellContentRendererClient::OverrideWebHyphenator() {
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
return NULL;
diff --git a/content/shell/renderer/shell_content_renderer_client.h b/content/shell/renderer/shell_content_renderer_client.h
index 857b5c9..7d5d69f 100644
--- a/content/shell/renderer/shell_content_renderer_client.h
+++ b/content/shell/renderer/shell_content_renderer_client.h
@@ -25,7 +25,6 @@ class MockWebHyphenator;
}
class MockWebClipboardImpl;
-class TestShellWebMimeRegistryImpl;
namespace content {
@@ -54,7 +53,6 @@ class ShellContentRendererClient : public ContentRendererClient {
OverrideCreateWebRTCPeerConnectionHandler(
WebKit::WebRTCPeerConnectionHandlerClient* client) OVERRIDE;
virtual WebKit::WebClipboard* OverrideWebClipboard() OVERRIDE;
- virtual WebKit::WebMimeRegistry* OverrideWebMimeRegistry() OVERRIDE;
virtual WebKit::WebHyphenator* OverrideWebHyphenator() OVERRIDE;
virtual WebKit::WebThemeEngine* OverrideThemeEngine() OVERRIDE;
virtual bool AllowBrowserPlugin(
@@ -66,7 +64,6 @@ class ShellContentRendererClient : public ContentRendererClient {
scoped_ptr<ShellRenderProcessObserver> shell_observer_;
scoped_ptr<MockWebClipboardImpl> clipboard_;
- scoped_ptr<TestShellWebMimeRegistryImpl> mime_registry_;
scoped_ptr<webkit_glue::MockWebHyphenator> hyphenator_;
};
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 500cdba..da3a4c9 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -77,6 +77,8 @@ class MimeUtil : public PlatformMimeUtil {
const std::string& mime_type,
const std::vector<std::string>& codecs) const;
+ void RemoveProprietaryMediaTypesAndCodecsForTests();
+
private:
friend struct base::DefaultLazyInstanceTraits<MimeUtil>;
@@ -264,7 +266,7 @@ static const char* const common_media_types[] = {
// Ogg.
"audio/ogg",
"application/ogg",
-#if defined(ENABLE_MEDIA_CODEC_THEORA)
+#if !defined(OS_ANDROID) // Android doesn't support Ogg Theora.
"video/ogg",
#endif
@@ -300,7 +302,7 @@ static const char* const proprietary_media_types[] = {
// The codecs for WAV are integers as defined in Appendix A of RFC2361:
// http://tools.ietf.org/html/rfc2361
static const char* const common_media_codecs[] = {
-#if defined(ENABLE_MEDIA_CODEC_THEORA)
+#if !defined(OS_ANDROID) // Android doesn't support Ogg Theora.
"theora",
#endif
"vorbis",
@@ -675,6 +677,15 @@ bool MimeUtil::IsSupportedStrictMediaMimeType(
AreSupportedCodecs(it->second, codecs);
}
+void MimeUtil::RemoveProprietaryMediaTypesAndCodecsForTests() {
+ for (size_t i = 0; i < arraysize(proprietary_media_types); ++i) {
+ non_image_map_.erase(proprietary_media_types[i]);
+ media_map_.erase(proprietary_media_types[i]);
+ }
+ for (size_t i = 0; i < arraysize(proprietary_media_codecs); ++i)
+ codecs_map_.erase(proprietary_media_codecs[i]);
+}
+
//----------------------------------------------------------------------------
// Wrappers for the singleton
//----------------------------------------------------------------------------
@@ -934,28 +945,8 @@ void GetExtensionsForMimeType(
HashSetToVector(&unique_extensions, extensions);
}
-void GetMediaTypesBlacklistedForTests(std::vector<std::string>* types) {
- types->clear();
-
-// Unless/until WebM files are added to the media layout tests, we need to avoid
-// blacklisting mp4 and H.264 when Theora is not supported (and proprietary
-// codecs are) so that the media tests can still run.
-#if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS)
- for (size_t i = 0; i < arraysize(proprietary_media_types); ++i)
- types->push_back(proprietary_media_types[i]);
-#endif
-}
-
-void GetMediaCodecsBlacklistedForTests(std::vector<std::string>* codecs) {
- codecs->clear();
-
-// Unless/until WebM files are added to the media layout tests, we need to avoid
-// blacklisting mp4 and H.264 when Theora is not supported (and proprietary
-// codecs are) so that the media tests can still run.
-#if defined(ENABLE_MEDIA_CODEC_THEORA) || !defined(USE_PROPRIETARY_CODECS)
- for (size_t i = 0; i < arraysize(proprietary_media_codecs); ++i)
- codecs->push_back(proprietary_media_codecs[i]);
-#endif
+void RemoveProprietaryMediaTypesAndCodecsForTests() {
+ g_mime_util.Get().RemoveProprietaryMediaTypesAndCodecsForTests();
}
const std::string GetIANAMediaType(const std::string& mime_type) {
diff --git a/net/base/mime_util.h b/net/base/mime_util.h
index fc0999b..9662e96 100644
--- a/net/base/mime_util.h
+++ b/net/base/mime_util.h
@@ -94,14 +94,11 @@ NET_EXPORT void GetExtensionsForMimeType(
const std::string& mime_type,
std::vector<base::FilePath::StringType>* extensions);
-// Test only methods that return lists of proprietary media types and codecs
-// that are not supported by all variations of Chromium.
-// These types and codecs must be blacklisted to ensure consistent layout test
-// results across all Chromium variations.
-NET_EXPORT void GetMediaTypesBlacklistedForTests(
- std::vector<std::string>* types);
-NET_EXPORT void GetMediaCodecsBlacklistedForTests(
- std::vector<std::string>* codecs);
+// Test only method that removes proprietary media types and codecs from the
+// list of supported MIME types and codecs. These types and codecs must be
+// removed to ensure consistent layout test results across all Chromium
+// variations.
+NET_EXPORT void RemoveProprietaryMediaTypesAndCodecsForTests();
// Returns the IANA media type contained in |mime_type|, or an empty
// string if |mime_type| does not specifify a known media type.
diff --git a/net/net.gyp b/net/net.gyp
index 758419e..1d6d0d0 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -1414,11 +1414,6 @@
'include_dirs': [
'../third_party/openssl',
],
- }, { # else OS != "android"
- 'defines': [
- # These are the features Android doesn't support.
- 'ENABLE_MEDIA_CODEC_THEORA',
- ],
},
],
],
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_
diff --git a/webkit/support/test_shell_webmimeregistry_impl.cc b/webkit/support/test_shell_webmimeregistry_impl.cc
deleted file mode 100644
index 50253c6..0000000
--- a/webkit/support/test_shell_webmimeregistry_impl.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "webkit/support/test_shell_webmimeregistry_impl.h"
-
-#include "base/basictypes.h"
-#include "base/strings/string_util.h"
-#include "net/base/mime_util.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-using WebKit::WebString;
-using WebKit::WebMimeRegistry;
-
-namespace {
-
-// 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) {
- return IsStringASCII(string) ? UTF16ToASCII(string) : std::string();
-}
-
-} // namespace
-
-TestShellWebMimeRegistryImpl::TestShellWebMimeRegistryImpl() {
- net::GetMediaTypesBlacklistedForTests(&blacklisted_media_types_);
-
- net::GetMediaCodecsBlacklistedForTests(&blacklisted_media_codecs_);
-}
-
-TestShellWebMimeRegistryImpl::~TestShellWebMimeRegistryImpl() {}
-
-// Returns IsNotSupported if mime_type or any of the codecs are not supported.
-// Otherwse, defers to the real registry.
-WebMimeRegistry::SupportsType
-TestShellWebMimeRegistryImpl::supportsMediaMIMEType(
- const WebString& mime_type,
- const WebString& codecs,
- const WebKit::WebString& key_system) {
- if (IsBlacklistedMediaMimeType(ToASCIIOrEmpty(mime_type)))
- return IsNotSupported;
-
- std::vector<std::string> parsed_codecs;
- net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true);
- if (HasBlacklistedMediaCodecs(parsed_codecs))
- return IsNotSupported;
-
- return SimpleWebMimeRegistryImpl::supportsMediaMIMEType(
- mime_type, codecs, key_system);
-}
-
-bool TestShellWebMimeRegistryImpl::IsBlacklistedMediaMimeType(
- const std::string& mime_type) {
- for (size_t i = 0; i < blacklisted_media_types_.size(); ++i) {
- if (blacklisted_media_types_[i] == mime_type)
- return true;
- }
- return false;
-}
-
-bool TestShellWebMimeRegistryImpl::HasBlacklistedMediaCodecs(
- const std::vector<std::string>& codecs) {
- for (size_t i = 0; i < codecs.size(); ++i) {
- for (size_t j = 0; j < blacklisted_media_codecs_.size(); ++j) {
- if (blacklisted_media_codecs_[j] == codecs[i])
- return true;
- }
- }
- return false;
-}
diff --git a/webkit/support/test_shell_webmimeregistry_impl.h b/webkit/support/test_shell_webmimeregistry_impl.h
deleted file mode 100644
index 4ca8263..0000000
--- a/webkit/support/test_shell_webmimeregistry_impl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_SUPPORT_TEST_SHELL_WEBMIMEREGISTRY_IMPL_H_
-#define WEBKIT_SUPPORT_TEST_SHELL_WEBMIMEREGISTRY_IMPL_H_
-
-#include <string>
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/containers/hash_tables.h"
-#include "webkit/glue/simple_webmimeregistry_impl.h"
-
-class TestShellWebMimeRegistryImpl
- : public webkit_glue::SimpleWebMimeRegistryImpl {
- public:
- TestShellWebMimeRegistryImpl();
- virtual ~TestShellWebMimeRegistryImpl();
-
- // Override to force that we only support types and codecs that are supported
- // by all variations of Chromium.
- //
- // Media layout tests use canPlayType() to determine the test input files.
- // Different flavours of Chromium support different codecs, which has an
- // impact on how canPlayType() behaves. Since Chromium's baselines and
- // expectations are generated against the common set of types, we need to
- // prevent canPlayType() from indicating it supports other types when running
- // layout tests.
- virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
- const WebKit::WebString&,
- const WebKit::WebString&,
- const WebKit::WebString&) OVERRIDE;
-
- private:
- bool IsBlacklistedMediaMimeType(const std::string& mime_type);
- bool HasBlacklistedMediaCodecs(const std::vector<std::string>& codecs);
-
- std::vector<std::string> blacklisted_media_types_;
- std::vector<std::string> blacklisted_media_codecs_;
-
- DISALLOW_COPY_AND_ASSIGN(TestShellWebMimeRegistryImpl);
-};
-
-#endif // WEBKIT_SUPPORT_TEST_SHELL_WEBMIMEREGISTRY_IMPL_H_
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index df36c5e..65ad33f 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -10,6 +10,7 @@
#include "third_party/WebKit/public/platform/WebGraphicsContext3D.h"
#include "third_party/WebKit/public/platform/WebUnitTestSupport.h"
#include "webkit/child/webkitplatformsupport_child_impl.h"
+#include "webkit/glue/simple_webmimeregistry_impl.h"
#include "webkit/glue/webfileutilities_impl.h"
#include "webkit/mocks/mock_webhyphenator.h"
#include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
@@ -19,7 +20,6 @@
#include "webkit/support/simple_dom_storage_system.h"
#include "webkit/support/simple_file_system.h"
#include "webkit/support/simple_webcookiejar_impl.h"
-#include "webkit/support/test_shell_webmimeregistry_impl.h"
#include "webkit/support/weburl_loader_mock_factory.h"
class TestShellWebBlobRegistryImpl;
@@ -163,7 +163,7 @@ class TestWebKitPlatformSupport :
TestViewType type);
private:
- TestShellWebMimeRegistryImpl mime_registry_;
+ webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
MockWebClipboardImpl mock_clipboard_;
webkit_glue::WebFileUtilitiesImpl file_utilities_;
base::ScopedTempDir appcache_dir_;
diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi
index 9644594..de712f35f 100644
--- a/webkit/support/webkit_support.gypi
+++ b/webkit/support/webkit_support.gypi
@@ -151,8 +151,6 @@
'<(DEPTH)/webkit/support/test_shell_request_context.h',
'<(DEPTH)/webkit/support/test_shell_webblobregistry_impl.cc',
'<(DEPTH)/webkit/support/test_shell_webblobregistry_impl.h',
- '<(DEPTH)/webkit/support/test_shell_webmimeregistry_impl.cc',
- '<(DEPTH)/webkit/support/test_shell_webmimeregistry_impl.h',
'<(DEPTH)/webkit/mocks/mock_webhyphenator.cc',
'<(DEPTH)/webkit/mocks/mock_webhyphenator.h',
'simple_database_system.cc',
diff --git a/webkit/tools/DEPS b/webkit/tools/DEPS
index df7a50a..696f3ec 100644
--- a/webkit/tools/DEPS
+++ b/webkit/tools/DEPS
@@ -1,5 +1,4 @@
include_rules = [
"+content/common",
- "+media",
"+skia/ext",
]