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 #ifndef NET_BASE_MIME_UTIL_H__ | 5 #ifndef NET_BASE_MIME_UTIL_H__ |
6 #define NET_BASE_MIME_UTIL_H__ | 6 #define NET_BASE_MIME_UTIL_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 // Convenience function. | 52 // Convenience function. |
53 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); | 53 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); |
54 | 54 |
55 // Returns true if this the mime_type_pattern matches a given mime-type. | 55 // Returns true if this the mime_type_pattern matches a given mime-type. |
56 // Checks for absolute matching and wildcards. mime-types should be in | 56 // Checks for absolute matching and wildcards. mime-types should be in |
57 // lower case. | 57 // lower case. |
58 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern, | 58 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern, |
59 const std::string& mime_type); | 59 const std::string& mime_type); |
60 | 60 |
| 61 // Returns true if the |type_string| is a correctly-formed mime type specifier. |
| 62 // Allows strings of the form x/y[;params], where "x" is a legal mime type name. |
| 63 // Also allows wildcard types -- "x/*", "*/*", and "*". |
| 64 NET_EXPORT bool IsMimeType(const std::string& type_string); |
| 65 |
61 // Returns true if and only if all codecs are supported, false otherwise. | 66 // Returns true if and only if all codecs are supported, false otherwise. |
62 NET_EXPORT bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); | 67 NET_EXPORT bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); |
63 | 68 |
64 // Parses a codec string, populating |codecs_out| with the prefix of each codec | 69 // Parses a codec string, populating |codecs_out| with the prefix of each codec |
65 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if | 70 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if |
66 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false | 71 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false |
67 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. | 72 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. |
68 // See http://www.ietf.org/rfc/rfc4281.txt. | 73 // See http://www.ietf.org/rfc/rfc4281.txt. |
69 NET_EXPORT void ParseCodecString(const std::string& codecs, | 74 NET_EXPORT void ParseCodecString(const std::string& codecs, |
70 std::vector<std::string>* codecs_out, | 75 std::vector<std::string>* codecs_out, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // These types and codecs must be blacklisted to ensure consistent layout test | 120 // These types and codecs must be blacklisted to ensure consistent layout test |
116 // results across all Chromium variations. | 121 // results across all Chromium variations. |
117 NET_EXPORT void GetMediaTypesBlacklistedForTests( | 122 NET_EXPORT void GetMediaTypesBlacklistedForTests( |
118 std::vector<std::string>* types); | 123 std::vector<std::string>* types); |
119 NET_EXPORT void GetMediaCodecsBlacklistedForTests( | 124 NET_EXPORT void GetMediaCodecsBlacklistedForTests( |
120 std::vector<std::string>* codecs); | 125 std::vector<std::string>* codecs); |
121 | 126 |
122 } // namespace net | 127 } // namespace net |
123 | 128 |
124 #endif // NET_BASE_MIME_UTIL_H__ | 129 #endif // NET_BASE_MIME_UTIL_H__ |
OLD | NEW |