diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 21:45:05 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 21:45:05 +0000 |
commit | 085cb5aea070d21835b750a0164b4cce0fcb12c7 (patch) | |
tree | 6a67a615602d93b622443fabcdcbc6f94a5475ff /net/base/platform_mime_util_linux.cc | |
parent | 2314403e94e659d586475e59975e9d84d87cbcd3 (diff) | |
download | chromium_src-085cb5aea070d21835b750a0164b4cce0fcb12c7.zip chromium_src-085cb5aea070d21835b750a0164b4cce0fcb12c7.tar.gz chromium_src-085cb5aea070d21835b750a0164b4cce0fcb12c7.tar.bz2 |
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
Diffstat (limited to 'net/base/platform_mime_util_linux.cc')
-rw-r--r-- | net/base/platform_mime_util_linux.cc | 40 |
1 files changed, 40 insertions, 0 deletions
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 <string> + +#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 |