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

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: Oops, forgot, I can now add Flash 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
« no previous file with comments | « no previous file | net/base/mime_sniffer.cc » ('j') | net/base/mime_sniffer.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 11
12 class GURL; 12 class GURL;
13 13
14 namespace net { 14 namespace net {
15 15
16 // The maximum number of bytes used by any internal mime sniffing routine. May 16 // The maximum number of bytes used by any internal mime sniffing routine. May
17 // be useful for callers to determine an efficient buffer size to pass to 17 // be useful for callers to determine an efficient buffer size to pass to
18 // |SniffMimeType|. 18 // |SniffMimeType|.
19 // This must be updated if any internal sniffing routine needs more bytes. 19 // This must be updated if any internal sniffing routine needs more bytes.
20 const int kMaxBytesToSniff = 1024; 20 const int kMaxBytesToSniff = 1024;
21 21
22 NET_EXPORT bool IdentifyExtraMimeType(const char* content,
vandebo (ex-Chrome) 2013/04/29 19:43:50 nit: add a comment and move below SniffMimeType
Kevin Bailey 2013/04/30 20:57:56 Done.
23 size_t content_size,
24 std::string* result);
25
22 // Examine the URL and the mime_type and decide whether we should sniff a 26 // Examine the URL and the mime_type and decide whether we should sniff a
23 // replacement mime type from the content. 27 // replacement mime type from the content.
24 // 28 //
25 // @param url The URL from which we obtained the content. 29 // @param url The URL from which we obtained the content.
26 // @param mime_type The current mime type, e.g. from the Content-Type header. 30 // @param mime_type The current mime type, e.g. from the Content-Type header.
27 // @return Returns true if we should sniff the mime type. 31 // @return Returns true if we should sniff the mime type.
28 NET_EXPORT bool ShouldSniffMimeType(const GURL& url, 32 NET_EXPORT bool ShouldSniffMimeType(const GURL& url,
29 const std::string& mime_type); 33 const std::string& mime_type);
30 34
31 // Guess a mime type from the first few bytes of content an its URL. Always 35 // 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. 36 // assigns |result| with its best guess of a mime type.
33 // 37 //
34 // @param content A buffer containing the bytes to sniff. 38 // @param content A buffer containing the bytes to sniff.
35 // @param content_size The number of bytes in the |content| buffer. 39 // @param content_size The number of bytes in the |content| buffer.
36 // @param url The URL from which we obtained this content. 40 // @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. 41 // @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. 42 // @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. 43 // @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, 44 NET_EXPORT bool SniffMimeType(const char* content, size_t content_size,
41 const GURL& url, const std::string& type_hint, 45 const GURL& url, const std::string& type_hint,
42 std::string* result); 46 std::string* result);
43 47
44 } // namespace net 48 } // namespace net
45 49
46 #endif // NET_BASE_MIME_SNIFFER_H__ 50 #endif // NET_BASE_MIME_SNIFFER_H__
OLDNEW
« no previous file with comments | « no previous file | net/base/mime_sniffer.cc » ('j') | net/base/mime_sniffer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698