| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <iterator> | 6 #include <iterator> |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/mime_util.h" | 10 #include "net/base/mime_util.h" |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 codecs->push_back(proprietary_media_codecs[i]); | 960 codecs->push_back(proprietary_media_codecs[i]); |
| 961 #endif | 961 #endif |
| 962 } | 962 } |
| 963 | 963 |
| 964 const std::string GetIANAMediaType(const std::string& mime_type) { | 964 const std::string GetIANAMediaType(const std::string& mime_type) { |
| 965 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { | 965 for (size_t i = 0; i < arraysize(kIanaMediaTypes); ++i) { |
| 966 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { | 966 if (StartsWithASCII(mime_type, kIanaMediaTypes[i].matcher, true)) { |
| 967 return kIanaMediaTypes[i].name; | 967 return kIanaMediaTypes[i].name; |
| 968 } | 968 } |
| 969 } | 969 } |
| 970 return ""; | 970 return std::string(); |
| 971 } | 971 } |
| 972 | 972 |
| 973 CertificateMimeType GetCertificateMimeTypeForMimeType( | 973 CertificateMimeType GetCertificateMimeTypeForMimeType( |
| 974 const std::string& mime_type) { | 974 const std::string& mime_type) { |
| 975 // Don't create a map, there is only one entry in the table, | 975 // Don't create a map, there is only one entry in the table, |
| 976 // except on Android. | 976 // except on Android. |
| 977 for (size_t i = 0; i < arraysize(supported_certificate_types); ++i) { | 977 for (size_t i = 0; i < arraysize(supported_certificate_types); ++i) { |
| 978 if (mime_type == net::supported_certificate_types[i].mime_type) | 978 if (mime_type == net::supported_certificate_types[i].mime_type) |
| 979 return net::supported_certificate_types[i].cert_type; | 979 return net::supported_certificate_types[i].cert_type; |
| 980 } | 980 } |
| 981 return CERTIFICATE_MIME_TYPE_UNKNOWN; | 981 return CERTIFICATE_MIME_TYPE_UNKNOWN; |
| 982 } | 982 } |
| 983 | 983 |
| 984 bool IsSupportedCertificateMimeType(const std::string& mime_type) { | 984 bool IsSupportedCertificateMimeType(const std::string& mime_type) { |
| 985 CertificateMimeType file_type = | 985 CertificateMimeType file_type = |
| 986 GetCertificateMimeTypeForMimeType(mime_type); | 986 GetCertificateMimeTypeForMimeType(mime_type); |
| 987 return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN; | 987 return file_type != CERTIFICATE_MIME_TYPE_UNKNOWN; |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace net | 990 } // namespace net |
| OLD | NEW |