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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. | 69 // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. |
70 // See http://www.ietf.org/rfc/rfc4281.txt. | 70 // See http://www.ietf.org/rfc/rfc4281.txt. |
71 NET_EXPORT void ParseCodecString(const std::string& codecs, | 71 NET_EXPORT void ParseCodecString(const std::string& codecs, |
72 std::vector<std::string>* codecs_out, | 72 std::vector<std::string>* codecs_out, |
73 bool strip); | 73 bool strip); |
74 | 74 |
75 // Check to see if a particular MIME type is in our list which only supports a | 75 // Check to see if a particular MIME type is in our list which only supports a |
76 // certain subset of codecs. | 76 // certain subset of codecs. |
77 NET_EXPORT bool IsStrictMediaMimeType(const std::string& mime_type); | 77 NET_EXPORT bool IsStrictMediaMimeType(const std::string& mime_type); |
78 | 78 |
| 79 enum CanPlayType { IsNotSupported, IsSupported, MayBeSupported }; |
| 80 |
79 // Check to see if a particular MIME type is in our list which only supports a | 81 // Check to see if a particular MIME type is in our list which only supports a |
80 // certain subset of codecs. Returns true if and only if all codecs are | 82 // certain subset of codecs. |
81 // supported for that specific MIME type, false otherwise. If this returns | 83 // * Returns IsSupported if and only if all the codecs are supported for that |
82 // false you will still need to check if the media MIME tpyes and codecs are | 84 // specific MIME type. |
83 // supported. | 85 // * Returns MayBeSupported if codecs paramter is empty or has a profile |
84 NET_EXPORT bool IsSupportedStrictMediaMimeType( | 86 // parameter which can't be decided whether it is supported or not. |
| 87 // * Returns IsNotSupported if none of the aforementioned conditions are met. |
| 88 NET_EXPORT CanPlayType IsSupportedStrictMediaMimeType( |
85 const std::string& mime_type, | 89 const std::string& mime_type, |
86 const std::vector<std::string>& codecs); | 90 const std::vector<std::string>& codecs); |
87 | 91 |
88 // Get the extensions associated with the given mime type. This should be passed | 92 // Get the extensions associated with the given mime type. This should be passed |
89 // in lower case. There could be multiple extensions for a given mime type, like | 93 // in lower case. There could be multiple extensions for a given mime type, like |
90 // "html,htm" for "text/html", or "txt,text,html,..." for "text/*". | 94 // "html,htm" for "text/html", or "txt,text,html,..." for "text/*". |
91 // Note that we do not erase the existing elements in the the provided vector. | 95 // Note that we do not erase the existing elements in the the provided vector. |
92 // Instead, we append the result to it. | 96 // Instead, we append the result to it. |
93 NET_EXPORT void GetExtensionsForMimeType( | 97 NET_EXPORT void GetExtensionsForMimeType( |
94 const std::string& mime_type, | 98 const std::string& mime_type, |
(...skipping 29 matching lines...) Expand all Loading... |
124 std::string* post_data); | 128 std::string* post_data); |
125 | 129 |
126 // Adds the final delimiter to a multi-part upload request. | 130 // Adds the final delimiter to a multi-part upload request. |
127 NET_EXPORT void AddMultipartFinalDelimiterForUpload( | 131 NET_EXPORT void AddMultipartFinalDelimiterForUpload( |
128 const std::string& mime_boundary, | 132 const std::string& mime_boundary, |
129 std::string* post_data); | 133 std::string* post_data); |
130 | 134 |
131 } // namespace net | 135 } // namespace net |
132 | 136 |
133 #endif // NET_BASE_MIME_UTIL_H__ | 137 #endif // NET_BASE_MIME_UTIL_H__ |
OLD | NEW |