OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "platform/network/mime/MIMETypeRegistry.h" | 5 #include "platform/network/mime/MIMETypeRegistry.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 "components/mime_util/mime_util.h" | 9 #include "components/mime_util/mime_util.h" |
10 #include "media/base/mime_util.h" | 10 #include "media/base/mime_util.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 const String& mime_type) { | 106 const String& mime_type) { |
107 std::string ascii_mime_type = ToLowerASCIIOrEmpty(mime_type); | 107 std::string ascii_mime_type = ToLowerASCIIOrEmpty(mime_type); |
108 return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || | 108 return (mime_util::IsSupportedImageMimeType(ascii_mime_type) || |
109 (base::StartsWith(ascii_mime_type, "image/", | 109 (base::StartsWith(ascii_mime_type, "image/", |
110 base::CompareCase::SENSITIVE) && | 110 base::CompareCase::SENSITIVE) && |
111 mime_util::IsSupportedNonImageMimeType(ascii_mime_type))); | 111 mime_util::IsSupportedNonImageMimeType(ascii_mime_type))); |
112 } | 112 } |
113 | 113 |
114 bool MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding( | 114 bool MIMETypeRegistry::IsSupportedImageMIMETypeForEncoding( |
115 const String& mime_type) { | 115 const String& mime_type) { |
116 if (EqualIgnoringCase(mime_type, "image/jpeg") || | 116 if (DeprecatedEqualIgnoringCase(mime_type, "image/jpeg") || |
117 EqualIgnoringCase(mime_type, "image/png")) | 117 DeprecatedEqualIgnoringCase(mime_type, "image/png")) |
118 return true; | 118 return true; |
119 if (EqualIgnoringCase(mime_type, "image/webp")) | 119 if (DeprecatedEqualIgnoringCase(mime_type, "image/webp")) |
120 return true; | 120 return true; |
121 return false; | 121 return false; |
122 } | 122 } |
123 | 123 |
124 bool MIMETypeRegistry::IsSupportedJavaScriptMIMEType(const String& mime_type) { | 124 bool MIMETypeRegistry::IsSupportedJavaScriptMIMEType(const String& mime_type) { |
125 return mime_util::IsSupportedJavascriptMimeType( | 125 return mime_util::IsSupportedJavascriptMimeType( |
126 ToLowerASCIIOrEmpty(mime_type)); | 126 ToLowerASCIIOrEmpty(mime_type)); |
127 } | 127 } |
128 | 128 |
129 bool MIMETypeRegistry::IsLegacySupportedJavaScriptLanguage( | 129 bool MIMETypeRegistry::IsLegacySupportedJavaScriptLanguage( |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // startsWith() | 190 // startsWith() |
191 return mime_type.StartsWith("application/x-java-applet", | 191 return mime_type.StartsWith("application/x-java-applet", |
192 kTextCaseASCIIInsensitive) || | 192 kTextCaseASCIIInsensitive) || |
193 mime_type.StartsWith("application/x-java-bean", | 193 mime_type.StartsWith("application/x-java-bean", |
194 kTextCaseASCIIInsensitive) || | 194 kTextCaseASCIIInsensitive) || |
195 mime_type.StartsWith("application/x-java-vm", | 195 mime_type.StartsWith("application/x-java-vm", |
196 kTextCaseASCIIInsensitive); | 196 kTextCaseASCIIInsensitive); |
197 } | 197 } |
198 | 198 |
199 bool MIMETypeRegistry::IsSupportedStyleSheetMIMEType(const String& mime_type) { | 199 bool MIMETypeRegistry::IsSupportedStyleSheetMIMEType(const String& mime_type) { |
200 return EqualIgnoringCase(mime_type, "text/css"); | 200 return DeprecatedEqualIgnoringCase(mime_type, "text/css"); |
201 } | 201 } |
202 | 202 |
203 bool MIMETypeRegistry::IsSupportedFontMIMEType(const String& mime_type) { | 203 bool MIMETypeRegistry::IsSupportedFontMIMEType(const String& mime_type) { |
204 static const unsigned kFontLen = 5; | 204 static const unsigned kFontLen = 5; |
205 if (!mime_type.StartsWith("font/", kTextCaseASCIIInsensitive)) | 205 if (!mime_type.StartsWith("font/", kTextCaseASCIIInsensitive)) |
206 return false; | 206 return false; |
207 String sub_type = mime_type.Substring(kFontLen).DeprecatedLower(); | 207 String sub_type = mime_type.Substring(kFontLen).DeprecatedLower(); |
208 return sub_type == "woff" || sub_type == "woff2" || sub_type == "otf" || | 208 return sub_type == "woff" || sub_type == "woff2" || sub_type == "otf" || |
209 sub_type == "ttf" || sub_type == "sfnt"; | 209 sub_type == "ttf" || sub_type == "sfnt"; |
210 } | 210 } |
211 | 211 |
212 bool MIMETypeRegistry::IsSupportedTextTrackMIMEType(const String& mime_type) { | 212 bool MIMETypeRegistry::IsSupportedTextTrackMIMEType(const String& mime_type) { |
213 return EqualIgnoringCase(mime_type, "text/vtt"); | 213 return DeprecatedEqualIgnoringCase(mime_type, "text/vtt"); |
214 } | 214 } |
215 | 215 |
216 } // namespace blink | 216 } // namespace blink |
OLD | NEW |