summaryrefslogtreecommitdiffstats
path: root/net/base/platform_mime_util_linux.cc
blob: 1d7dccc3ba15945b35a84bd7cf267fbc28749f51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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