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

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

Issue 7529043: Rename NET_API to NET_EXPORT, and rename NET_TEST to NET_EXPORT_PRIVATE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "net/base/net_api.h" 11 #include "net/base/net_export.h"
12 12
13 class GURL; 13 class GURL;
14 14
15 namespace net { 15 namespace net {
16 16
17 // The maximum number of bytes used by any internal mime sniffing routine. May 17 // The maximum number of bytes used by any internal mime sniffing routine. May
18 // be useful for callers to determine an efficient buffer size to pass to 18 // be useful for callers to determine an efficient buffer size to pass to
19 // |SniffMimeType|. 19 // |SniffMimeType|.
20 // This must be updated if any internal sniffing routine needs more bytes. 20 // This must be updated if any internal sniffing routine needs more bytes.
21 const int kMaxBytesToSniff = 1024; 21 const int kMaxBytesToSniff = 1024;
22 22
23 // Examine the URL and the mime_type and decide whether we should sniff a 23 // Examine the URL and the mime_type and decide whether we should sniff a
24 // replacement mime type from the content. 24 // replacement mime type from the content.
25 // 25 //
26 // @param url The URL from which we obtained the content. 26 // @param url The URL from which we obtained the content.
27 // @param mime_type The current mime type, e.g. from the Content-Type header. 27 // @param mime_type The current mime type, e.g. from the Content-Type header.
28 // @return Returns true if we should sniff the mime type. 28 // @return Returns true if we should sniff the mime type.
29 NET_API bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type); 29 NET_EXPORT bool ShouldSniffMimeType(const GURL& url,
30 const std::string& mime_type);
30 31
31 // Guess a mime type from the first few bytes of content an its URL. Always 32 // 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. 33 // assigns |result| with its best guess of a mime type.
33 // 34 //
34 // @param content A buffer containing the bytes to sniff. 35 // @param content A buffer containing the bytes to sniff.
35 // @param content_size The number of bytes in the |content| buffer. 36 // @param content_size The number of bytes in the |content| buffer.
36 // @param url The URL from which we obtained this content. 37 // @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. 38 // @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. 39 // @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. 40 // @return Returns true if we have enough content to guess the mime type.
40 NET_API bool SniffMimeType(const char* content, size_t content_size, 41 NET_EXPORT bool SniffMimeType(const char* content, size_t content_size,
41 const GURL& url, const std::string& type_hint, 42 const GURL& url, const std::string& type_hint,
42 std::string* result); 43 std::string* result);
43 44
44 } // namespace net 45 } // namespace net
45 46
46 #endif // NET_BASE_MIME_SNIFFER_H__ 47 #endif // NET_BASE_MIME_SNIFFER_H__
OLDNEW
« no previous file with comments | « net/base/mapped_host_resolver.h ('k') | net/base/mime_util.h » ('j') | net/base/net_export.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698