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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 19 matching lines...) Expand all
30 30
31 // Guess a mime type from the first few bytes of content an its URL. Always 31 // Guess a mime type from the first few bytes of content an its URL. Always
32 // assigns |result| with its best guess of a mime type. 32 // assigns |result| with its best guess of a mime type.
33 // 33 //
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,
41 const GURL& url, const std::string& type_hint, 41 size_t content_size,
42 const GURL& url,
43 const std::string& type_hint,
42 std::string* result); 44 std::string* result);
43 45
44 // Attempt to identify a MIME type from the first few bytes of content only. 46 // 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()|. 47 // Uses a bigger set of media file searches than |SniffMimeType()|.
46 // If finds a match, fills in |result| and returns true, 48 // If finds a match, fills in |result| and returns true,
47 // otherwise returns false. 49 // otherwise returns false.
48 // 50 //
49 // The caller should understand the security ramifications of trusting 51 // The caller should understand the security ramifications of trusting
50 // uncontrolled data before accepting the results of this function. 52 // uncontrolled data before accepting the results of this function.
51 // 53 //
52 // @param content A buffer containing the bytes to sniff. 54 // @param content A buffer containing the bytes to sniff.
53 // @param content_size The number of bytes in the |content| buffer. 55 // @param content_size The number of bytes in the |content| buffer.
54 // @param result Address at which to place the sniffed mime type. 56 // @param result Address at which to place the sniffed mime type.
55 // @return Returns true if a MIME type match was found. 57 // @return Returns true if a MIME type match was found.
56 NET_EXPORT bool SniffMimeTypeFromLocalData(const char* content, 58 NET_EXPORT bool SniffMimeTypeFromLocalData(const char* content,
57 size_t content_size, 59 size_t content_size,
58 std::string* result); 60 std::string* result);
59 61
60 } // namespace net 62 } // namespace net
61 63
62 #endif // NET_BASE_MIME_SNIFFER_H__ 64 #endif // NET_BASE_MIME_SNIFFER_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698