diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-18 18:29:36 +0000 |
commit | 13677b86fc97aeab327e476c7de42bc777a54ee4 (patch) | |
tree | 5e2682e91c0d09d63a6a54e36d9996fef5528e8d /net/base/mime_util.h | |
parent | d929a9dfff856658662a962fd4dabed66d1e0b2f (diff) | |
download | chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.zip chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.gz chromium_src-13677b86fc97aeab327e476c7de42bc777a54ee4.tar.bz2 |
net: Add NET_API to net/base
BUG=76997
TEST=NONE
Review URL: http://codereview.chromium.org/6969077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85785 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/mime_util.h')
-rw-r--r-- | net/base/mime_util.h | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/net/base/mime_util.h b/net/base/mime_util.h index 249a25b..d228b58 100644 --- a/net/base/mime_util.h +++ b/net/base/mime_util.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,89 +10,93 @@ #include <vector> #include "base/file_path.h" +#include "net/base/net_api.h" namespace net { // Get the mime type (if any) that is associated with the given file extension. // Returns true if a corresponding mime type exists. -bool GetMimeTypeFromExtension(const FilePath::StringType& ext, - std::string* mime_type); +NET_API bool GetMimeTypeFromExtension(const FilePath::StringType& ext, + std::string* mime_type); // Get the mime type (if any) that is associated with the given file. Returns // true if a corresponding mime type exists. -bool GetMimeTypeFromFile(const FilePath& file_path, std::string* mime_type); +NET_API bool GetMimeTypeFromFile(const FilePath& file_path, + std::string* mime_type); // Get the preferred extension (if any) associated with the given mime type. // Returns true if a corresponding file extension exists. The extension is // returned without a prefixed dot, ex "html". -bool GetPreferredExtensionForMimeType(const std::string& mime_type, - FilePath::StringType* extension); +NET_API bool GetPreferredExtensionForMimeType(const std::string& mime_type, + FilePath::StringType* extension); // Check to see if a particular MIME type is in our list. -bool IsSupportedImageMimeType(const char* mime_type); -bool IsSupportedMediaMimeType(const char* mime_type); -bool IsSupportedNonImageMimeType(const char* mime_type); -bool IsSupportedJavascriptMimeType(const char* mime_type); +NET_API bool IsSupportedImageMimeType(const char* mime_type); +NET_API bool IsSupportedMediaMimeType(const char* mime_type); +NET_API bool IsSupportedNonImageMimeType(const char* mime_type); +NET_API bool IsSupportedJavascriptMimeType(const char* mime_type); // Get whether this mime type should be displayed in view-source mode. // (For example, XML.) -bool IsViewSourceMimeType(const char* mime_type); +NET_API bool IsViewSourceMimeType(const char* mime_type); // Convenience function. -bool IsSupportedMimeType(const std::string& mime_type); +NET_API bool IsSupportedMimeType(const std::string& mime_type); // Returns true if this the mime_type_pattern matches a given mime-type. // Checks for absolute matching and wildcards. mime-types should be in // lower case. -bool MatchesMimeType(const std::string &mime_type_pattern, - const std::string &mime_type); +NET_API bool MatchesMimeType(const std::string &mime_type_pattern, + const std::string &mime_type); // Returns true if and only if all codecs are supported, false otherwise. -bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); +NET_API bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs); // Parses a codec string, populating |codecs_out| with the prefix of each codec // in the string |codecs_in|. For example, passed "aaa.b.c,dd.eee", if // |strip| == true |codecs_out| will contain {"aaa", "dd"}, if |strip| == false // |codecs_out| will contain {"aaa.b.c", "dd.eee"}. // See http://www.ietf.org/rfc/rfc4281.txt. -void ParseCodecString(const std::string& codecs, - std::vector<std::string>* codecs_out, - bool strip); +NET_API void ParseCodecString(const std::string& codecs, + std::vector<std::string>* codecs_out, + bool strip); // Check to see if a particular MIME type is in our list which only supports a // certain subset of codecs. -bool IsStrictMediaMimeType(const std::string& mime_type); +NET_API bool IsStrictMediaMimeType(const std::string& mime_type); // Check to see if a particular MIME type is in our list which only supports a // certain subset of codecs. Returns true if and only if all codecs are // supported for that specific MIME type, false otherwise. If this returns // false you will still need to check if the media MIME tpyes and codecs are // supported. -bool IsSupportedStrictMediaMimeType(const std::string& mime_type, +NET_API bool IsSupportedStrictMediaMimeType( + const std::string& mime_type, const std::vector<std::string>& codecs); // Get the extensions for images files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetImageExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetImageExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions for audio files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetAudioExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetAudioExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions for video files. // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetVideoExtensions(std::vector<FilePath::StringType>* extensions); +NET_API void GetVideoExtensions(std::vector<FilePath::StringType>* extensions); // Get the extensions associated with the given mime type. // There could be multiple extensions for a given mime type, like "html,htm" // for "text/html". // Note that we do not erase the existing elements in the the provided vector. // Instead, we append the result to it. -void GetExtensionsForMimeType(const std::string& mime_type, - std::vector<FilePath::StringType>* extensions); +NET_API void GetExtensionsForMimeType( + const std::string& mime_type, + std::vector<FilePath::StringType>* extensions); } // namespace net |