OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "mojo/examples/html_viewer/webmimeregistry_impl.h" |
| 6 |
| 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "net/base/mime_util.h" |
| 12 #include "third_party/WebKit/public/platform/WebString.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace examples { |
| 16 namespace { |
| 17 |
| 18 std::string ToASCIIOrEmpty(const blink::WebString& string) { |
| 19 return base::IsStringASCII(string) ? base::UTF16ToASCII(string) |
| 20 : std::string(); |
| 21 } |
| 22 |
| 23 } // namespace |
| 24 |
| 25 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMIMEType( |
| 26 const blink::WebString& mime_type) { |
| 27 return net::IsSupportedMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 28 blink::WebMimeRegistry::IsSupported : |
| 29 blink::WebMimeRegistry::IsNotSupported; |
| 30 } |
| 31 |
| 32 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsImageMIMEType( |
| 33 const blink::WebString& mime_type) { |
| 34 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 35 blink::WebMimeRegistry::IsSupported : |
| 36 blink::WebMimeRegistry::IsNotSupported; |
| 37 } |
| 38 |
| 39 blink::WebMimeRegistry::SupportsType |
| 40 WebMimeRegistryImpl::supportsJavaScriptMIMEType( |
| 41 const blink::WebString& mime_type) { |
| 42 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 43 blink::WebMimeRegistry::IsSupported : |
| 44 blink::WebMimeRegistry::IsNotSupported; |
| 45 } |
| 46 |
| 47 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( |
| 48 const blink::WebString& mime_type, |
| 49 const blink::WebString& codecs, |
| 50 const blink::WebString& key_system) { |
| 51 NOTIMPLEMENTED(); |
| 52 return IsNotSupported; |
| 53 } |
| 54 |
| 55 bool WebMimeRegistryImpl::supportsMediaSourceMIMEType( |
| 56 const blink::WebString& mime_type, |
| 57 const blink::WebString& codecs) { |
| 58 NOTIMPLEMENTED(); |
| 59 return false; |
| 60 } |
| 61 |
| 62 bool WebMimeRegistryImpl::supportsEncryptedMediaMIMEType( |
| 63 const blink::WebString& key_system, |
| 64 const blink::WebString& mime_type, |
| 65 const blink::WebString& codecs) { |
| 66 NOTIMPLEMENTED(); |
| 67 return false; |
| 68 } |
| 69 |
| 70 blink::WebMimeRegistry::SupportsType |
| 71 WebMimeRegistryImpl::supportsNonImageMIMEType( |
| 72 const blink::WebString& mime_type) { |
| 73 return net::IsSupportedNonImageMimeType(ToASCIIOrEmpty(mime_type)) ? |
| 74 blink::WebMimeRegistry::IsSupported : |
| 75 blink::WebMimeRegistry::IsNotSupported; |
| 76 } |
| 77 |
| 78 blink::WebString WebMimeRegistryImpl::mimeTypeForExtension( |
| 79 const blink::WebString& file_extension) { |
| 80 NOTIMPLEMENTED(); |
| 81 return blink::WebString(); |
| 82 } |
| 83 |
| 84 blink::WebString WebMimeRegistryImpl::wellKnownMimeTypeForExtension( |
| 85 const blink::WebString& file_extension) { |
| 86 NOTIMPLEMENTED(); |
| 87 return blink::WebString(); |
| 88 } |
| 89 |
| 90 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( |
| 91 const blink::WebString& file_path) { |
| 92 NOTIMPLEMENTED(); |
| 93 return blink::WebString(); |
| 94 } |
| 95 |
| 96 } // namespace examples |
| 97 } // namespace mojo |
OLD | NEW |