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 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsImageMIMEType( | 31 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsImageMIMEType( |
32 const blink::WebString& mime_type) { | 32 const blink::WebString& mime_type) { |
33 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ? | 33 return net::IsSupportedImageMimeType(ToASCIIOrEmpty(mime_type)) ? |
34 blink::WebMimeRegistry::IsSupported : | 34 blink::WebMimeRegistry::IsSupported : |
35 blink::WebMimeRegistry::IsNotSupported; | 35 blink::WebMimeRegistry::IsNotSupported; |
36 } | 36 } |
37 | 37 |
38 blink::WebMimeRegistry::SupportsType | 38 blink::WebMimeRegistry::SupportsType |
| 39 WebMimeRegistryImpl::supportsImagePrefixedMIMEType( |
| 40 const blink::WebString& mime_type) { |
| 41 std::string ascii_mime_type = ToASCIIOrEmpty(mime_type); |
| 42 return (net::IsSupportedImageMimeType(ascii_mime_type) || |
| 43 (StartsWithASCII(ascii_mime_type, "image/", true) && |
| 44 net::IsSupportedNonImageMimeType(ascii_mime_type))) |
| 45 ? WebMimeRegistry::IsSupported |
| 46 : WebMimeRegistry::IsNotSupported; |
| 47 } |
| 48 |
| 49 blink::WebMimeRegistry::SupportsType |
39 WebMimeRegistryImpl::supportsJavaScriptMIMEType( | 50 WebMimeRegistryImpl::supportsJavaScriptMIMEType( |
40 const blink::WebString& mime_type) { | 51 const blink::WebString& mime_type) { |
41 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? | 52 return net::IsSupportedJavascriptMimeType(ToASCIIOrEmpty(mime_type)) ? |
42 blink::WebMimeRegistry::IsSupported : | 53 blink::WebMimeRegistry::IsSupported : |
43 blink::WebMimeRegistry::IsNotSupported; | 54 blink::WebMimeRegistry::IsNotSupported; |
44 } | 55 } |
45 | 56 |
46 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( | 57 blink::WebMimeRegistry::SupportsType WebMimeRegistryImpl::supportsMediaMIMEType( |
47 const blink::WebString& mime_type, | 58 const blink::WebString& mime_type, |
48 const blink::WebString& codecs, | 59 const blink::WebString& codecs, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return blink::WebString(); | 97 return blink::WebString(); |
87 } | 98 } |
88 | 99 |
89 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( | 100 blink::WebString WebMimeRegistryImpl::mimeTypeFromFile( |
90 const blink::WebString& file_path) { | 101 const blink::WebString& file_path) { |
91 NOTIMPLEMENTED(); | 102 NOTIMPLEMENTED(); |
92 return blink::WebString(); | 103 return blink::WebString(); |
93 } | 104 } |
94 | 105 |
95 } // namespace mojo | 106 } // namespace mojo |
OLD | NEW |