Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SNIFFER_H__ | 5 #ifndef NET_BASE_MIME_SNIFFER_H__ |
| 6 #define NET_BASE_MIME_SNIFFER_H__ | 6 #define NET_BASE_MIME_SNIFFER_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 34 // @param content A buffer containing the bytes to sniff. | 34 // @param content A buffer containing the bytes to sniff. |
| 35 // @param content_size The number of bytes in the |content| buffer. | 35 // @param content_size The number of bytes in the |content| buffer. |
| 36 // @param url The URL from which we obtained this content. | 36 // @param url The URL from which we obtained this content. |
| 37 // @param type_hint The current mime type, e.g. from the Content-Type header. | 37 // @param type_hint The current mime type, e.g. from the Content-Type header. |
| 38 // @param result Address at which to place the sniffed mime type. | 38 // @param result Address at which to place the sniffed mime type. |
| 39 // @return Returns true if we have enough content to guess the mime type. | 39 // @return Returns true if we have enough content to guess the mime type. |
| 40 NET_EXPORT bool SniffMimeType(const char* content, size_t content_size, | 40 NET_EXPORT bool SniffMimeType(const char* content, size_t content_size, |
| 41 const GURL& url, const std::string& type_hint, | 41 const GURL& url, const std::string& type_hint, |
| 42 std::string* result); | 42 std::string* result); |
| 43 | 43 |
| 44 // Guess a MIME type from the first few bytes of content only. | |
| 45 // Uses a bigger set of media file searches than |SniffMimeType()|. | |
| 46 // If finds a match, fills in |result| and returns true, | |
| 47 // otherwise returns false. | |
| 48 // | |
| 49 // @param content A buffer containing the bytes to sniff. | |
| 50 // @param content_size The number of bytes in the |content| buffer. | |
| 51 // @param result Address at which to place the sniffed mime type. | |
| 52 // @return Returns true if we have enough content to guess the mime type. | |
|
vandebo (ex-Chrome)
2013/05/02 21:58:24
Returns true if a mime-type match was found.
Kevin Bailey
2013/05/03 16:52:55
Done.
| |
| 53 NET_EXPORT bool IdentifyExtraMimeType(const char* content, | |
| 54 size_t content_size, | |
| 55 std::string* result); | |
| 56 | |
| 44 } // namespace net | 57 } // namespace net |
| 45 | 58 |
| 46 #endif // NET_BASE_MIME_SNIFFER_H__ | 59 #endif // NET_BASE_MIME_SNIFFER_H__ |
| OLD | NEW |