Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: net/base/mime_util.h

Issue 1110833003: Move the IsSupported* mime functions out of //net and into //components/mime_util (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/content_child.gypi ('k') | net/base/mime_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file defines MIME utility functions. All of them assume the MIME type 8 // This file defines MIME utility functions. All of them assume the MIME type
9 // to be of the format specified by rfc2045. According to it, MIME types are 9 // to be of the format specified by rfc2045. According to it, MIME types are
10 // case strongly insensitive except parameter values, which may or may not be 10 // case strongly insensitive except parameter values, which may or may not be
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 std::string* mime_type); 44 std::string* mime_type);
45 45
46 // Get the preferred extension (if any) associated with the given mime type. 46 // Get the preferred extension (if any) associated with the given mime type.
47 // Returns true if a corresponding file extension exists. The extension is 47 // Returns true if a corresponding file extension exists. The extension is
48 // returned without a prefixed dot, ex "html". 48 // returned without a prefixed dot, ex "html".
49 NET_EXPORT bool GetPreferredExtensionForMimeType( 49 NET_EXPORT bool GetPreferredExtensionForMimeType(
50 const std::string& mime_type, 50 const std::string& mime_type,
51 base::FilePath::StringType* extension); 51 base::FilePath::StringType* extension);
52 52
53 // Check to see if a particular MIME type is in our list. 53 // Check to see if a particular MIME type is in our list.
54 NET_EXPORT bool IsSupportedImageMimeType(const std::string& mime_type);
55 NET_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); 54 NET_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type);
56 NET_EXPORT bool IsSupportedNonImageMimeType(const std::string& mime_type);
57 NET_EXPORT bool IsUnsupportedTextMimeType(const std::string& mime_type);
58 NET_EXPORT bool IsSupportedJavascriptMimeType(const std::string& mime_type);
59 NET_EXPORT bool IsSupportedCertificateMimeType(const std::string& mime_type);
60
61 // Convenience function.
62 NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type);
63 55
64 // 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.
65 // Checks for absolute matching and wildcards. MIME types are case insensitive. 57 // Checks for absolute matching and wildcards. MIME types are case insensitive.
66 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern, 58 NET_EXPORT bool MatchesMimeType(const std::string& mime_type_pattern,
67 const std::string& mime_type); 59 const std::string& mime_type);
68 60
69 // Returns true if the |type_string| is a correctly-formed mime type specifier 61 // Returns true if the |type_string| is a correctly-formed mime type specifier
70 // with no parameter, i.e. string that matches the following ABNF (see the 62 // with no parameter, i.e. string that matches the following ABNF (see the
71 // definition of content ABNF in RFC2045 and media-type ABNF httpbis p2 63 // definition of content ABNF in RFC2045 and media-type ABNF httpbis p2
72 // semantics). 64 // semantics).
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // 147 //
156 // A Java counterpart will be generated for this enum. 148 // A Java counterpart will be generated for this enum.
157 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net 149 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
158 enum CertificateMimeType { 150 enum CertificateMimeType {
159 CERTIFICATE_MIME_TYPE_UNKNOWN, 151 CERTIFICATE_MIME_TYPE_UNKNOWN,
160 CERTIFICATE_MIME_TYPE_X509_USER_CERT, 152 CERTIFICATE_MIME_TYPE_X509_USER_CERT,
161 CERTIFICATE_MIME_TYPE_X509_CA_CERT, 153 CERTIFICATE_MIME_TYPE_X509_CA_CERT,
162 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE, 154 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE,
163 }; 155 };
164 156
165 NET_EXPORT CertificateMimeType GetCertificateMimeTypeForMimeType(
166 const std::string& mime_type);
167
168 // Prepares one value as part of a multi-part upload request. 157 // Prepares one value as part of a multi-part upload request.
169 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name, 158 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name,
170 const std::string& value, 159 const std::string& value,
171 const std::string& mime_boundary, 160 const std::string& mime_boundary,
172 const std::string& content_type, 161 const std::string& content_type,
173 std::string* post_data); 162 std::string* post_data);
174 163
175 // Adds the final delimiter to a multi-part upload request. 164 // Adds the final delimiter to a multi-part upload request.
176 NET_EXPORT void AddMultipartFinalDelimiterForUpload( 165 NET_EXPORT void AddMultipartFinalDelimiterForUpload(
177 const std::string& mime_boundary, 166 const std::string& mime_boundary,
178 std::string* post_data); 167 std::string* post_data);
179 168
180 } // namespace net 169 } // namespace net
181 170
182 #endif // NET_BASE_MIME_UTIL_H__ 171 #endif // NET_BASE_MIME_UTIL_H__
OLDNEW
« no previous file with comments | « content/content_child.gypi ('k') | net/base/mime_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698