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

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

Issue 1547593002: Introducing a net::GenerateMimeMultipartBoundary helper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review. Created 5 years 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
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // 93 //
94 // A Java counterpart will be generated for this enum. 94 // A Java counterpart will be generated for this enum.
95 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net 95 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
96 enum CertificateMimeType { 96 enum CertificateMimeType {
97 CERTIFICATE_MIME_TYPE_UNKNOWN, 97 CERTIFICATE_MIME_TYPE_UNKNOWN,
98 CERTIFICATE_MIME_TYPE_X509_USER_CERT, 98 CERTIFICATE_MIME_TYPE_X509_USER_CERT,
99 CERTIFICATE_MIME_TYPE_X509_CA_CERT, 99 CERTIFICATE_MIME_TYPE_X509_CA_CERT,
100 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE, 100 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE,
101 }; 101 };
102 102
103 // Generates a random MIME multipart boundary.
104 NET_EXPORT std::string GenerateMimeMultipartBoundary();
105
103 // Prepares one value as part of a multi-part upload request. 106 // Prepares one value as part of a multi-part upload request.
104 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name, 107 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name,
105 const std::string& value, 108 const std::string& value,
106 const std::string& mime_boundary, 109 const std::string& mime_boundary,
107 const std::string& content_type, 110 const std::string& content_type,
108 std::string* post_data); 111 std::string* post_data);
109 112
110 // Adds the final delimiter to a multi-part upload request. 113 // Adds the final delimiter to a multi-part upload request.
111 NET_EXPORT void AddMultipartFinalDelimiterForUpload( 114 NET_EXPORT void AddMultipartFinalDelimiterForUpload(
112 const std::string& mime_boundary, 115 const std::string& mime_boundary,
113 std::string* post_data); 116 std::string* post_data);
114 117
115 struct MimeInfo { 118 struct MimeInfo {
116 const char* const mime_type; 119 const char* const mime_type;
117 const char* const extensions; // comma separated list 120 const char* const extensions; // comma separated list
118 }; 121 };
119 122
120 // Finds mime type of |ext| from |mappings|. 123 // Finds mime type of |ext| from |mappings|.
121 const char* FindMimeType(const MimeInfo* mappings, 124 const char* FindMimeType(const MimeInfo* mappings,
122 size_t mappings_len, 125 size_t mappings_len,
123 const std::string& ext); 126 const std::string& ext);
124 127
125 } // namespace net 128 } // namespace net
126 129
127 #endif // NET_BASE_MIME_UTIL_H__ 130 #endif // NET_BASE_MIME_UTIL_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698