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

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

Issue 2363653002: Cleanup unreachable cert adding code (Closed)
Patch Set: Rebased Created 4 years, 2 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 | « net/android/network_library.cc ('k') | net/cert/caching_cert_verifier.h » ('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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 // Get the extensions associated with the given mime type. There could be 83 // Get the extensions associated with the given mime type. There could be
84 // multiple extensions for a given mime type, like "html,htm" for "text/html", 84 // multiple extensions for a given mime type, like "html,htm" for "text/html",
85 // or "txt,text,html,..." for "text/*". 85 // or "txt,text,html,..." for "text/*".
86 // Note that we do not erase the existing elements in the the provided vector. 86 // Note that we do not erase the existing elements in the the provided vector.
87 // Instead, we append the result to it. 87 // Instead, we append the result to it.
88 NET_EXPORT void GetExtensionsForMimeType( 88 NET_EXPORT void GetExtensionsForMimeType(
89 const std::string& mime_type, 89 const std::string& mime_type,
90 std::vector<base::FilePath::StringType>* extensions); 90 std::vector<base::FilePath::StringType>* extensions);
91 91
92 // A list of supported certificate-related mime types.
93 //
94 // A Java counterpart will be generated for this enum.
95 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net
96 enum CertificateMimeType {
97 CERTIFICATE_MIME_TYPE_UNKNOWN,
98 CERTIFICATE_MIME_TYPE_X509_USER_CERT,
99 CERTIFICATE_MIME_TYPE_X509_CA_CERT,
100 CERTIFICATE_MIME_TYPE_PKCS12_ARCHIVE,
101 };
102
103 // Generates a random MIME multipart boundary. 92 // Generates a random MIME multipart boundary.
104 // The returned string is guaranteed to be at most 70 characters long. 93 // The returned string is guaranteed to be at most 70 characters long.
105 NET_EXPORT std::string GenerateMimeMultipartBoundary(); 94 NET_EXPORT std::string GenerateMimeMultipartBoundary();
106 95
107 // Prepares one value as part of a multi-part upload request. 96 // Prepares one value as part of a multi-part upload request.
108 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name, 97 NET_EXPORT void AddMultipartValueForUpload(const std::string& value_name,
109 const std::string& value, 98 const std::string& value,
110 const std::string& mime_boundary, 99 const std::string& mime_boundary,
111 const std::string& content_type, 100 const std::string& content_type,
112 std::string* post_data); 101 std::string* post_data);
113 102
114 // Adds the final delimiter to a multi-part upload request. 103 // Adds the final delimiter to a multi-part upload request.
115 NET_EXPORT void AddMultipartFinalDelimiterForUpload( 104 NET_EXPORT void AddMultipartFinalDelimiterForUpload(
116 const std::string& mime_boundary, 105 const std::string& mime_boundary,
117 std::string* post_data); 106 std::string* post_data);
118 107
119 struct MimeInfo { 108 struct MimeInfo {
120 const char* const mime_type; 109 const char* const mime_type;
121 const char* const extensions; // comma separated list 110 const char* const extensions; // comma separated list
122 }; 111 };
123 112
124 // Finds mime type of |ext| from |mappings|. 113 // Finds mime type of |ext| from |mappings|.
125 const char* FindMimeType(const MimeInfo* mappings, 114 const char* FindMimeType(const MimeInfo* mappings,
126 size_t mappings_len, 115 size_t mappings_len,
127 const std::string& ext); 116 const std::string& ext);
128 117
129 } // namespace net 118 } // namespace net
130 119
131 #endif // NET_BASE_MIME_UTIL_H__ 120 #endif // NET_BASE_MIME_UTIL_H__
OLDNEW
« no previous file with comments | « net/android/network_library.cc ('k') | net/cert/caching_cert_verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698