| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mime_util/mime_util.h" | 5 #include "components/mime_util/mime_util.h" |
| 6 | 6 |
| 7 #include "base/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 unsupported_text_types_.insert(kUnsupportedTextTypes[i]); | 144 unsupported_text_types_.insert(kUnsupportedTextTypes[i]); |
| 145 for (size_t i = 0; i < arraysize(kSupportedJavascriptTypes); ++i) { | 145 for (size_t i = 0; i < arraysize(kSupportedJavascriptTypes); ++i) { |
| 146 javascript_types_.insert(kSupportedJavascriptTypes[i]); | 146 javascript_types_.insert(kSupportedJavascriptTypes[i]); |
| 147 non_image_types_.insert(kSupportedJavascriptTypes[i]); | 147 non_image_types_.insert(kSupportedJavascriptTypes[i]); |
| 148 } | 148 } |
| 149 for (size_t i = 0; i < arraysize(kSupportedCertificateTypes); ++i) | 149 for (size_t i = 0; i < arraysize(kSupportedCertificateTypes); ++i) |
| 150 non_image_types_.insert(kSupportedCertificateTypes[i].mime_type); | 150 non_image_types_.insert(kSupportedCertificateTypes[i].mime_type); |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const { | 153 bool MimeUtil::IsSupportedImageMimeType(const std::string& mime_type) const { |
| 154 return image_types_.find(base::StringToLowerASCII(mime_type)) != | 154 return image_types_.find(base::ToLowerASCII(mime_type)) != image_types_.end(); |
| 155 image_types_.end(); | |
| 156 } | 155 } |
| 157 | 156 |
| 158 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { | 157 bool MimeUtil::IsSupportedNonImageMimeType(const std::string& mime_type) const { |
| 159 return non_image_types_.find(base::StringToLowerASCII(mime_type)) != | 158 return non_image_types_.find(base::StringToLowerASCII(mime_type)) != |
| 160 non_image_types_.end() || | 159 non_image_types_.end() || |
| 161 #if !defined(OS_IOS) | 160 #if !defined(OS_IOS) |
| 162 media::IsSupportedMediaMimeType(mime_type) || | 161 media::IsSupportedMediaMimeType(mime_type) || |
| 163 #endif | 162 #endif |
| 164 (base::StartsWith(mime_type, "text/", | 163 (base::StartsWith(mime_type, "text/", |
| 165 base::CompareCase::INSENSITIVE_ASCII) && | 164 base::CompareCase::INSENSITIVE_ASCII) && |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 if (base::EqualsCaseInsensitiveASCII( | 225 if (base::EqualsCaseInsensitiveASCII( |
| 227 mime_type, kSupportedCertificateTypes[i].mime_type)) { | 226 mime_type, kSupportedCertificateTypes[i].mime_type)) { |
| 228 return kSupportedCertificateTypes[i].cert_type; | 227 return kSupportedCertificateTypes[i].cert_type; |
| 229 } | 228 } |
| 230 } | 229 } |
| 231 | 230 |
| 232 return net::CERTIFICATE_MIME_TYPE_UNKNOWN; | 231 return net::CERTIFICATE_MIME_TYPE_UNKNOWN; |
| 233 } | 232 } |
| 234 | 233 |
| 235 } // namespace mime_util | 234 } // namespace mime_util |
| OLD | NEW |