Chromium Code Reviews| Index: net/base/platform_mime_util_chromeos.cc |
| diff --git a/net/base/platform_mime_util_chromeos.cc b/net/base/platform_mime_util_chromeos.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..dd80a3708d47ae4f6eb77f80e5f453395b939983 |
| --- /dev/null |
| +++ b/net/base/platform_mime_util_chromeos.cc |
| @@ -0,0 +1,35 @@ |
| +// Copyright 2015 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 "net/base/platform_mime_util.h" |
| + |
| +#include "base/logging.h" |
| +#include "net/base/mime_util.h" |
| + |
| +namespace net { |
| + |
| +namespace { |
| + |
| +static const MimeInfo mimetype_extension_mapping[] = { |
| + {"text/calendar", "ics"}, |
| + {"application/epub+zip", "epub"}, |
| +}; |
| +} |
|
eroman
2015/05/15 09:05:33
Add comment:
// namespace
yawano
2015/05/18 08:59:44
Done.
|
| + |
| +// Since ChromeOS does not have mimetype-extension database in it, we use |
|
eroman
2015/05/15 09:05:33
Please provide some extra details in this comment
yawano
2015/05/18 08:59:44
Done.
I asked this on ML but I couldn't figure ou
|
| +// |mimetype_extension_mapping| to resolve mime type. |
| +bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( |
| + const base::FilePath::StringType& ext, |
| + std::string* mime_type) const { |
| + const char* result = |
| + net::FindMimeType(mimetype_extension_mapping, |
|
eroman
2015/05/15 09:05:33
no need for net:: prefix
yawano
2015/05/18 08:59:44
Acknowledged.
|
| + arraysize(mimetype_extension_mapping), ext.c_str()); |
|
eroman
2015/05/15 09:05:33
It would be better if didn't have to take .c_str()
yawano
2015/05/18 08:59:43
I think an extension which contains null character
|
| + if (result) { |
| + *mime_type = result; |
| + return true; |
| + } |
| + |
| + return false; |
| +} |
| +} |
|
eroman
2015/05/15 09:05:33
add comment:
// namespace net
yawano
2015/05/18 08:59:44
Acknowledged.
|