Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / chromeos / file_manager / mime_util.cc
blob17792b324cca028787b6300be764ed3193c5cb18
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/chromeos/file_manager/mime_util.h"
7 #include "base/files/file_path.h"
8 #include "net/base/mime_util.h"
10 namespace file_manager {
11 namespace util {
13 std::string GetMimeTypeForPath(const base::FilePath& file_path) {
14 const base::FilePath::StringType file_extension = file_path.Extension();
16 // TODO(thorogood): Rearchitect this call so it can run on the File thread;
17 // GetMimeTypeFromFile requires this on Linux. Right now, we use
18 // Chrome-level knowledge only.
19 std::string mime_type;
20 if (file_extension.empty() ||
21 !net::GetWellKnownMimeTypeFromExtension(file_extension.substr(1),
22 &mime_type)) {
23 // If the file doesn't have an extension or its mime-type cannot be
24 // determined, then indicate that it has the empty mime-type. This will
25 // only be matched if the Web Intents accepts "*" or "*/*".
26 return "";
27 } else {
28 return mime_type;
32 } // namespace util
33 } // namespace file_manager