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

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

Issue 12703012: Have media gallery (through native media file util) use MIME sniffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Indentation fix. Created 7 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 | Annotate | Revision Log
OLDNEW
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
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 // Attempt to identify 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 // The caller should understand the security ramifications of trusting
50 // uncontrolled data before accepting the results of this function.
51 //
52 // @param content A buffer containing the bytes to sniff.
53 // @param content_size The number of bytes in the |content| buffer.
54 // @param result Address at which to place the sniffed mime type.
55 // @return Returns true if a MIME type match was found.
56 NET_EXPORT bool SniffMimeTypeFromLocalData(const char* content,
57 size_t content_size,
58 std::string* result);
59
44 } // namespace net 60 } // namespace net
45 61
46 #endif // NET_BASE_MIME_SNIFFER_H__ 62 #endif // NET_BASE_MIME_SNIFFER_H__
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/native_media_file_util_unittest.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698