OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/base/platform_mime_util.h" | 5 #include "net/base/platform_mime_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/mime_util.h" | 9 #include "base/mime_util.h" |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 }; | 45 }; |
46 | 46 |
47 const struct MimeToExt mime_type_ext_map[] = { | 47 const struct MimeToExt mime_type_ext_map[] = { |
48 {"application/pdf", "pdf"}, | 48 {"application/pdf", "pdf"}, |
49 {"application/x-tar", "tar"}, | 49 {"application/x-tar", "tar"}, |
50 {"audio/mpeg", "mp3"}, | 50 {"audio/mpeg", "mp3"}, |
51 {"image/gif", "gif"}, | 51 {"image/gif", "gif"}, |
52 {"image/jpeg", "jpg"}, | 52 {"image/jpeg", "jpg"}, |
53 {"image/png", "png"}, | 53 {"image/png", "png"}, |
54 {"text/html", "html"}, | 54 {"text/html", "html"}, |
55 {"video/x-msvideo", "avi"}, | |
scherkus (not reviewing)
2011/06/29 17:00:36
woah I've never seen this mime typ mapping struct
ilja
2011/06/29 21:40:05
I think it is for displaying files in the download
| |
55 {"video/mp4", "mp4"}, | 56 {"video/mp4", "mp4"}, |
56 {"video/mpeg", "mpg"}, | 57 {"video/mpeg", "mpg"}, |
57 {"text/plain", "txt"}, | 58 {"text/plain", "txt"}, |
58 {"text/x-sh", "sh"}, | 59 {"text/x-sh", "sh"}, |
59 }; | 60 }; |
60 | 61 |
61 bool PlatformMimeUtil::GetPreferredExtensionForMimeType( | 62 bool PlatformMimeUtil::GetPreferredExtensionForMimeType( |
62 const std::string& mime_type, FilePath::StringType* ext) const { | 63 const std::string& mime_type, FilePath::StringType* ext) const { |
63 | 64 |
64 for (size_t x = 0; | 65 for (size_t x = 0; |
(...skipping 12 matching lines...) Expand all Loading... | |
77 // | 78 // |
78 // If we wanted to do this properly, we would read the mime.cache file which | 79 // If we wanted to do this properly, we would read the mime.cache file which |
79 // has a section where they assign a glob (*.gif) to a mimetype | 80 // has a section where they assign a glob (*.gif) to a mimetype |
80 // (image/gif). We look up the "heaviest" glob for a certain mime type and | 81 // (image/gif). We look up the "heaviest" glob for a certain mime type and |
81 // then then try to chop off "*.". | 82 // then then try to chop off "*.". |
82 | 83 |
83 return false; | 84 return false; |
84 } | 85 } |
85 | 86 |
86 } // namespace net | 87 } // namespace net |
OLD | NEW |