Chromium Code Reviews| 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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 // Convenience function. | 49 // Convenience function. |
| 50 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); | 50 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); |
| 51 | 51 |
| 52 // Returns true if this the mime_type_pattern matches a given mime-type. | 52 // Returns true if this the mime_type_pattern matches a given mime-type. |
| 53 // Checks for absolute matching and wildcards. mime-types should be in | 53 // Checks for absolute matching and wildcards. mime-types should be in |
| 54 // lower case. | 54 // lower case. |
| 55 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern, | 55 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern, |
| 56 const std::string& mime_type); | 56 const std::string& mime_type); |
| 57 | 57 |
| 58 // Returns true if the |type_string| is a correctly-formed mime type specifier. | 58 // Returns true if the |type_string| is a correctly-formed mime type specifier |
| 59 // Allows strings of the form x/y[;params], where "x" is a legal mime type name. | 59 // with no parameter, i.e. string that matches the following ABNF. |
| 60 // Also allows wildcard types -- "x/*", "*/*", and "*". | 60 // |
| 61 NET_EXPORT bool IsMimeType(const std::string& type_string); | 61 // token "/" token |
| 62 // | |
| 63 // If |top_level_type| is non-NULL, sets it to parsed top-level type string. | |
| 64 // If |subtype| is non-NULL, sets it to parsed subtype string. | |
|
asanka
2014/03/27 18:59:52
nit: Can you add a comment pointing to the RFC tha
tyoshino (SeeGerritForStatus)
2014/03/31 13:02:45
Done.
| |
| 65 NET_EXPORT bool ParseMimeTypeWithoutParameter(const std::string& type_string, | |
| 66 std::string* top_level_type, | |
| 67 std::string* subtype); | |
| 68 | |
| 69 // Returns true if the |type_string| is a top-level type of any media type | |
| 70 // registered with IANA media types registry at | |
| 71 // http://www.iana.org/assignments/media-types/media-types.xhtml or an | |
| 72 // experimental type (type with x- prefix). | |
| 73 // | |
| 74 // This method doesn't check that the input conforms to token ABNF, so if input | |
| 75 // is experimental type strings, you need to check check that before using | |
| 76 // this method. | |
| 77 NET_EXPORT bool IsValidTopLevelMimeType(const std::string& type_string); | |
|
asanka
2014/03/27 18:59:52
Nit: I wouldn't object if this was removed if no-
tyoshino (SeeGerritForStatus)
2014/03/31 13:02:45
OK. For now, I'd like to keep this not to make any
| |
| 62 | 78 |
| 63 // Returns true if and only if all codecs are supported, false otherwise. | 79 // Returns true if and only if all codecs are supported, false otherwise. |
| 64 NET_EXPORT bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); | 80 NET_EXPORT bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); |
| 65 | 81 |
| 66 // Parses a codec string, populating |codecs_out| with the prefix of each codec | 82 // Parses a codec string, populating |codecs_out| with the prefix of each codec |
| 67 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if | 83 // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if |
| 68 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false | 84 // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false |
| 69 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. | 85 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. |
| 70 // See http://www.ietf.org/rfc/rfc4281.txt. | 86 // See http://www.ietf.org/rfc/rfc4281.txt. |
| 71 NET_EXPORT void ParseCodecString(const std::string& codecs, | 87 NET_EXPORT void ParseCodecString(const std::string& codecs, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 std::string* post_data); | 140 std::string* post_data); |
| 125 | 141 |
| 126 // Adds the final delimiter to a multi-part upload request. | 142 // Adds the final delimiter to a multi-part upload request. |
| 127 NET_EXPORT void AddMultipartFinalDelimiterForUpload( | 143 NET_EXPORT void AddMultipartFinalDelimiterForUpload( |
| 128 const std::string& mime_boundary, | 144 const std::string& mime_boundary, |
| 129 std::string* post_data); | 145 std::string* post_data); |
| 130 | 146 |
| 131 } // namespace net | 147 } // namespace net |
| 132 | 148 |
| 133 #endif // NET_BASE_MIME_UTIL_H__ | 149 #endif // NET_BASE_MIME_UTIL_H__ |
| OLD | NEW |