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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. | 87 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. |
| 88 // See http://www.ietf.org/rfc/rfc4281.txt. | 88 // See http://www.ietf.org/rfc/rfc4281.txt. |
| 89 NET_EXPORT void ParseCodecString(const std::string& codecs, | 89 NET_EXPORT void ParseCodecString(const std::string& codecs, |
| 90 std::vector<std::string>* codecs_out, | 90 std::vector<std::string>* codecs_out, |
| 91 bool strip); | 91 bool strip); |
| 92 | 92 |
| 93 // Check to see if a particular MIME type is in our list which only supports a | 93 // Check to see if a particular MIME type is in our list which only supports a |
| 94 // certain subset of codecs. | 94 // certain subset of codecs. |
| 95 NET_EXPORT bool IsStrictMediaMimeType(const std::string& mime_type); | 95 NET_EXPORT bool IsStrictMediaMimeType(const std::string& mime_type); |
| 96 | 96 |
| 97 // Check to see if a particular MIME type is in our list which only supports a | 97 // Indicates that the MIME type and (possible codec string) are supported by the |
| 98 // certain subset of codecs. Returns true if and only if all codecs are | 98 // underlying platform. |
| 99 // supported for that specific MIME type, false otherwise. If this returns | 99 // IsNotSupported - The underlying platform is known not to support the given |
| 100 // false you will still need to check if the media MIME tpyes and codecs are | 100 // MIME type and codec combination. |
| 101 // supported. | 101 // IsSuported - The underlying platform is known to support the given MIME |
| 102 NET_EXPORT bool IsSupportedStrictMediaMimeType( | 102 // type and codec combination. |
| 103 // MayBeSupported - The underlying platform is unsure whether the given MIME | |
| 104 // type and codec combination can be rendered or not before | |
| 105 // actually trying to play it. | |
|
Ryan Sleevi
2014/06/12 19:03:53
Document these inline, as suggested
// Comment de
| |
| 106 enum SupportsType { | |
| 107 IsNotSupported, | |
| 108 IsSupported, | |
| 109 MayBeSupported | |
| 110 }; | |
| 111 | |
| 112 // Checks the |mime_type| and |codecs| against the MIME types known to support | |
| 113 // only a particular subset of codecs. | |
| 114 // * Returns IsSupported if the |mime_type| is supported and all the codecs | |
| 115 // within the |codecs| are supported for the |mime_type|. | |
| 116 // * Returns MayBeSupported if the |mime_type| is supported and is known to | |
| 117 // support only a subset of codecs, but |codecs| was empty. Also returned if a | |
| 118 // codec is supported, but additional codec parameters were supplied (such as | |
| 119 // profile) for which the support cannot be decided. | |
|
Ryan Sleevi
2014/06/12 19:03:53
Still doesn't document what happens in the case of
| |
| 120 // * Returns IsNotSupported if either the |mime_type| is not supported or the | |
| 121 // |mime_type| is supported but atleast one of the codecs within |codecs| is | |
|
Ryan Sleevi
2014/06/12 19:03:53
s/atleast/at least/
| |
| 122 // not supported for the |mime_type|. | |
| 123 NET_EXPORT SupportsType IsSupportedStrictMediaMimeType( | |
| 103 const std::string& mime_type, | 124 const std::string& mime_type, |
| 104 const std::vector<std::string>& codecs); | 125 const std::vector<std::string>& codecs); |
| 105 | 126 |
| 106 // Get the extensions associated with the given mime type. This should be passed | 127 // Get the extensions associated with the given mime type. This should be passed |
| 107 // in lower case. There could be multiple extensions for a given mime type, like | 128 // in lower case. There could be multiple extensions for a given mime type, like |
| 108 // "html,htm" for "text/html", or "txt,text,html,..." for "text/*". | 129 // "html,htm" for "text/html", or "txt,text,html,..." for "text/*". |
| 109 // Note that we do not erase the existing elements in the the provided vector. | 130 // Note that we do not erase the existing elements in the the provided vector. |
| 110 // Instead, we append the result to it. | 131 // Instead, we append the result to it. |
| 111 NET_EXPORT void GetExtensionsForMimeType( | 132 NET_EXPORT void GetExtensionsForMimeType( |
| 112 const std::string& mime_type, | 133 const std::string& mime_type, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 142 std::string* post_data); | 163 std::string* post_data); |
| 143 | 164 |
| 144 // Adds the final delimiter to a multi-part upload request. | 165 // Adds the final delimiter to a multi-part upload request. |
| 145 NET_EXPORT void AddMultipartFinalDelimiterForUpload( | 166 NET_EXPORT void AddMultipartFinalDelimiterForUpload( |
| 146 const std::string& mime_boundary, | 167 const std::string& mime_boundary, |
| 147 std::string* post_data); | 168 std::string* post_data); |
| 148 | 169 |
| 149 } // namespace net | 170 } // namespace net |
| 150 | 171 |
| 151 #endif // NET_BASE_MIME_UTIL_H__ | 172 #endif // NET_BASE_MIME_UTIL_H__ |
| OLD | NEW |