summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 04:30:05 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-16 04:30:05 +0000
commitbff1ddf84a4743c05f754cf55875b7f510dbb364 (patch)
tree10ccf3c02a1d510ea0c6c9282b192a20b2063497 /net
parent85b9984be3cf3566ab3bb6f9b719876b551525f3 (diff)
downloadchromium_src-bff1ddf84a4743c05f754cf55875b7f510dbb364.zip
chromium_src-bff1ddf84a4743c05f754cf55875b7f510dbb364.tar.gz
chromium_src-bff1ddf84a4743c05f754cf55875b7f510dbb364.tar.bz2
Add xdg mime support on Linux.
BUG=10049 Review URL: http://codereview.chromium.org/113168 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16227 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/platform_mime_util_linux.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/base/platform_mime_util_linux.cc b/net/base/platform_mime_util_linux.cc
index 874f6af..acc14dc 100644
--- a/net/base/platform_mime_util_linux.cc
+++ b/net/base/platform_mime_util_linux.cc
@@ -4,23 +4,22 @@
#include <string>
+#include "base/logging.h"
+#include "base/mime_util.h"
#include "net/base/platform_mime_util.h"
namespace net {
bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
const FilePath::StringType& ext, std::string* result) const {
- // The correct thing to do is to interact somehow with the freedesktop shared
- // mime info cache. Since Linux (and other traditional *IX systems) don't use
- // file extensions; they use mime types and have multiple ways of detecting
- // that; some types can be guessed from globs (*.gif), but there's a whole
- // bunch that use a magic byte test.
- //
- // Since this method only is called from inside mime_util where there is
- // already a hard coded table of mime types, we just return false because it
- // doesn't matter.
-
- return false;
+ FilePath::StringType dummy_path = "foo." + ext;
+ std::string out = mime_util::GetFileMimeType(dummy_path);
+ // GetFileMimeType likes to return application/octet-stream
+ // for everything it doesn't know - ignore that.
+ if (out == "application/octet-stream" || !out.length())
+ return false;
+ *result = out;
+ return true;
}
bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
@@ -34,6 +33,7 @@ bool PlatformMimeUtil::GetPreferredExtensionForMimeType(
// (image/gif). We look up the "heaviest" glob for a certain mime type and
// then then try to chop off "*.".
+ NOTIMPLEMENTED();
return false;
}