Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(264)

Side by Side Diff: net/base/platform_mime_util_chromeos.cc

Issue 1134393002: Implement ChromeOS mime type extension mappings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move to platform_mime_util_chromeos.cc Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #include "net/base/platform_mime_util.h"
6
7 #include "base/logging.h"
8 #include "net/base/mime_util.h"
9
10 namespace net {
11
12 namespace {
13
14 static const MimeInfo mimetype_extension_mapping[] = {
15 {"text/calendar", "ics"},
16 {"application/epub+zip", "epub"},
17 };
18 }
eroman 2015/05/15 09:05:33 Add comment: // namespace
yawano 2015/05/18 08:59:44 Done.
19
20 // 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
21 // |mimetype_extension_mapping| to resolve mime type.
22 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
23 const base::FilePath::StringType& ext,
24 std::string* mime_type) const {
25 const char* result =
26 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.
27 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
28 if (result) {
29 *mime_type = result;
30 return true;
31 }
32
33 return false;
34 }
35 }
eroman 2015/05/15 09:05:33 add comment: // namespace net
yawano 2015/05/18 08:59:44 Acknowledged.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698