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 26 matching lines...) Expand all Loading... | |
37 NET_EXPORT bool GetPreferredExtensionForMimeType( | 37 NET_EXPORT bool GetPreferredExtensionForMimeType( |
38 const std::string& mime_type, | 38 const std::string& mime_type, |
39 FilePath::StringType* extension); | 39 FilePath::StringType* extension); |
40 | 40 |
41 // Check to see if a particular MIME type is in our list. | 41 // Check to see if a particular MIME type is in our list. |
42 NET_EXPORT bool IsSupportedImageMimeType(const std::string& mime_type); | 42 NET_EXPORT bool IsSupportedImageMimeType(const std::string& mime_type); |
43 NET_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); | 43 NET_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); |
44 NET_EXPORT bool IsSupportedNonImageMimeType(const std::string& mime_type); | 44 NET_EXPORT bool IsSupportedNonImageMimeType(const std::string& mime_type); |
45 NET_EXPORT bool IsUnsupportedTextMimeType(const std::string& mime_type); | 45 NET_EXPORT bool IsUnsupportedTextMimeType(const std::string& mime_type); |
46 NET_EXPORT bool IsSupportedJavascriptMimeType(const std::string& mime_type); | 46 NET_EXPORT bool IsSupportedJavascriptMimeType(const std::string& mime_type); |
47 NET_EXPORT bool IsSupportedCertificateMimeType(const std::string& mime_type); | |
47 | 48 |
48 // Get whether this mime type should be displayed in view-source mode. | 49 // Get whether this mime type should be displayed in view-source mode. |
49 // (For example, XML.) | 50 // (For example, XML.) |
50 NET_EXPORT bool IsViewSourceMimeType(const std::string& mime_type); | 51 NET_EXPORT bool IsViewSourceMimeType(const std::string& mime_type); |
51 | 52 |
52 // Convenience function. | 53 // Convenience function. |
53 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); | 54 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type); |
54 | 55 |
55 // Returns true if this the mime_type_pattern matches a given mime-type. | 56 // 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 | 57 // Checks for absolute matching and wildcards. mime-types should be in |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 NET_EXPORT void GetMediaTypesBlacklistedForTests( | 105 NET_EXPORT void GetMediaTypesBlacklistedForTests( |
105 std::vector<std::string>* types); | 106 std::vector<std::string>* types); |
106 NET_EXPORT void GetMediaCodecsBlacklistedForTests( | 107 NET_EXPORT void GetMediaCodecsBlacklistedForTests( |
107 std::vector<std::string>* codecs); | 108 std::vector<std::string>* codecs); |
108 | 109 |
109 // Returns the IANA media type contained in |mime_type|, or an empty | 110 // Returns the IANA media type contained in |mime_type|, or an empty |
110 // string if |mime_type| does not specifify a known media type. | 111 // string if |mime_type| does not specifify a known media type. |
111 // Supported media types are defined at: | 112 // Supported media types are defined at: |
112 // http://www.iana.org/assignments/media-types/index.html | 113 // http://www.iana.org/assignments/media-types/index.html |
113 NET_EXPORT const std::string GetIANAMediaType(const std::string& mime_type); | 114 NET_EXPORT const std::string GetIANAMediaType(const std::string& mime_type); |
115 | |
116 // A list of supported certificate-related mime types. | |
117 // | |
118 // IMPORTANT: These values *must* match the ones found in: | |
119 // net/android/java/src/org/chromium/net/AndroidNetworkLibrary.java | |
darin (slow to review)
2012/11/27 05:24:34
Instead of writing this comment, is it possible to
digit1
2012/11/27 10:19:48
This has been discussed on chromium-dev and actual
| |
120 // | |
121 enum CertificateMimeType { | |
122 CERTIFICATE_MIME_TYPE_UNKNOWN = 0, | |
123 CERTIFICATE_MIME_TYPE_X509_USER_CERT = 1, | |
124 CERTIFICATE_MIME_TYPE_X509_CA_CERT = 2, | |
125 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE = 3, | |
126 }; | |
127 | |
128 NET_EXPORT CertificateMimeType GetCertificateMimeTypeForMimeType( | |
129 const std::string& mime_type); | |
130 | |
114 } // namespace net | 131 } // namespace net |
115 | 132 |
116 #endif // NET_BASE_MIME_UTIL_H__ | 133 #endif // NET_BASE_MIME_UTIL_H__ |
OLD | NEW |