OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/services/html_viewer/webmimeregistry_impl.h" | 5 #include "mojo/services/html_viewer/webmimeregistry_impl.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 const blink::WebString& mime_type) { | 51 const blink::WebString& mime_type) { |
52 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? | 52 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? |
53 blink::WebMimeRegistry::IsSupported : | 53 blink::WebMimeRegistry::IsSupported : |
54 blink::WebMimeRegistry::IsNotSupported; | 54 blink::WebMimeRegistry::IsNotSupported; |
55 } | 55 } |
56 | 56 |
57 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( | 57 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( |
58 const blink::WebString& mime_type, | 58 const blink::WebString& mime_type, |
59 const blink::WebString& codecs, | 59 const blink::WebString& codecs, |
60 const blink::WebString& key_system) { | 60 const blink::WebString& key_system) { |
61 NOTIMPLEMENTED(); | 61 const std::string mime_type_ascii = ToASCIIOrEmpty(mime_type); |
62 return IsNotSupported; | 62 // Not supporting the container is a flat-out no. |
| 63 if (!net::IsSupportedMediaMimeType(mime_type_ascii)) |
| 64 return IsNotSupported; |
| 65 |
| 66 // Mojo does not currently support any key systems. |
| 67 if (!key_system.isEmpty()) |
| 68 return IsNotSupported; |
| 69 |
| 70 // Check list of strict codecs to see if it is supported. |
| 71 if (net::IsStrictMediaMimeType(mime_type_ascii)) { |
| 72 // Check if the codecs are a perfect match. |
| 73 std::vector<std::string> strict_codecs; |
| 74 net::ParseCodecString(ToASCIIOrEmpty(codecs), &strict_codecs, false); |
| 75 return static_cast<WebMimeRegistry::SupportsType>( |
| 76 net::IsSupportedStrictMediaMimeType(mime_type_ascii, strict_codecs)); |
| 77 } |
| 78 |
| 79 // If we don't recognize the codec, it's possible we support it. |
| 80 std::vector<std::string> parsed_codecs; |
| 81 net::ParseCodecString(ToASCIIOrEmpty(codecs), &parsed_codecs, true); |
| 82 if (!net::AreSupportedMediaCodecs(parsed_codecs)) |
| 83 return MayBeSupported; |
| 84 |
| 85 // Otherwise we have a perfect match. |
| 86 return IsSupported; |
63 } | 87 } |
64 | 88 |
65 bool WebMimeRegistryImpl::supportsMediaSourceMIMEType( | 89 bool WebMimeRegistryImpl::supportsMediaSourceMIMEType( |
66 const blink::WebString& mime_type, | 90 const blink::WebString& mime_type, |
67 const blink::WebString& codecs) { | 91 const blink::WebString& codecs) { |
68 NOTIMPLEMENTED(); | 92 NOTIMPLEMENTED(); |
69 return false; | 93 return false; |
70 } | 94 } |
71 | 95 |
72 bool WebMimeRegistryImpl::supportsEncryptedMediaMIMEType( | 96 bool WebMimeRegistryImpl::supportsEncryptedMediaMIMEType( |
(...skipping 24 matching lines...) Expand all Loading... |
97 return blink::WebString(); | 121 return blink::WebString(); |
98 } | 122 } |
99 | 123 |
100 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( | 124 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( |
101 const blink::WebString& file_path) { | 125 const blink::WebString& file_path) { |
102 NOTIMPLEMENTED(); | 126 NOTIMPLEMENTED(); |
103 return blink::WebString(); | 127 return blink::WebString(); |
104 } | 128 } |
105 | 129 |
106 } // namespace mojo | 130 } // namespace mojo |
OLD | NEW |