From 085cb5aea070d21835b750a0164b4cce0fcb12c7 Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Mon, 8 Sep 2008 21:45:05 +0000 Subject: Get MIME stuff working minimally to the point where we have unit tests passing. B=1315 Review URL: http://codereview.chromium.org/1824 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1866 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/platform_mime_util_linux.cc | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 net/base/platform_mime_util_linux.cc (limited to 'net/base/platform_mime_util_linux.cc') diff --git a/net/base/platform_mime_util_linux.cc b/net/base/platform_mime_util_linux.cc new file mode 100644 index 0000000..1d7dccc --- /dev/null +++ b/net/base/platform_mime_util_linux.cc @@ -0,0 +1,40 @@ +// Copyright (c) 2006-2008 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. + +#include + +#include "net/base/platform_mime_util.h" + +namespace net { + +bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( + const std::wstring& 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; +} + +bool PlatformMimeUtil::GetPreferredExtensionForMimeType( + const std::string& mime_type, std::wstring* ext) const { + // Unlike GetPlatformMimeTypeFromExtension, this method doesn't have a + // default list that it uses, but for now we are also returning false since + // this doesn't really matter as much under Linux. + // + // If we wanted to do this properly, we would read the mime.cache file which + // has a section where they assign a glob (*.gif) to a mimetype + // (image/gif). We look up the "heaviest" glob for a certain mime type and + // then then try to chop off "*.". + + return false; +} + +} // namespace net -- cgit v1.1