summaryrefslogtreecommitdiffstats
path: root/net/base/mime_util.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-03 01:34:14 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-03 01:34:14 +0000
commit4172081a0e4cbb694293dad2d5ed4ba4f2cd26b4 (patch)
tree77cdae20592a241afafa8f86a3f75d4be87c42bf /net/base/mime_util.h
parent313f73ea0b7fd817741ed866770dcbebd9d6a66a (diff)
downloadchromium_src-4172081a0e4cbb694293dad2d5ed4ba4f2cd26b4.zip
chromium_src-4172081a0e4cbb694293dad2d5ed4ba4f2cd26b4.tar.gz
chromium_src-4172081a0e4cbb694293dad2d5ed4ba4f2cd26b4.tar.bz2
Reland r129998: When input is "" (or " " with trim_whitespace true), SplitString() should return an empty vector, not a vector of one empty string.
Brett and I discussed this for a while and felt this would be wise, whereas dropping all empty segments entirely (e.g. converting "a,,b" to a vector of two elements instead of three) was probably unwise. This also simplifies the code some. Fixing this also required changing the code in mime_util.cc to handle empty vectors to "are codecs valid" oracle functions (in which case we return false). I also fixed some style issues there. It also required avoiding passing the empty string in a test in extension_api_unittest.cc; Aaron assures me that this code is not expected to be defensive against such inputs, but at his suggestion I also added some CHECK()s to the API. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9958076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130285 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/mime_util.h')
-rw-r--r--net/base/mime_util.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/base/mime_util.h b/net/base/mime_util.h
index 7640504..adff518 100644
--- a/net/base/mime_util.h
+++ b/net/base/mime_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -40,14 +40,14 @@ NET_EXPORT bool GetPreferredExtensionForMimeType(
FilePath::StringType* extension);
// Check to see if a particular MIME type is in our list.
-NET_EXPORT bool IsSupportedImageMimeType(const char* mime_type);
-NET_EXPORT bool IsSupportedMediaMimeType(const char* mime_type);
-NET_EXPORT bool IsSupportedNonImageMimeType(const char* mime_type);
-NET_EXPORT bool IsSupportedJavascriptMimeType(const char* mime_type);
+NET_EXPORT bool IsSupportedImageMimeType(const std::string& mime_type);
+NET_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type);
+NET_EXPORT bool IsSupportedNonImageMimeType(const std::string& mime_type);
+NET_EXPORT bool IsSupportedJavascriptMimeType(const std::string& mime_type);
// Get whether this mime type should be displayed in view-source mode.
// (For example, XML.)
-NET_EXPORT bool IsViewSourceMimeType(const char* mime_type);
+NET_EXPORT bool IsViewSourceMimeType(const std::string& mime_type);
// Convenience function.
NET_EXPORT bool IsSupportedMimeType(const std::string& mime_type);
@@ -55,8 +55,8 @@ NET_EXPORT 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.
-NET_EXPORT bool MatchesMimeType(const std::string &mime_type_pattern,
- const std::string &mime_type);
+NET_EXPORT 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.
NET_EXPORT bool AreSupportedMediaCodecs(const std::vector<std::string>& codecs);