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

Side by Side Diff: chrome/browser/media_galleries/fileapi/media_path_filter.cc

Issue 401523002: Move media related mimetype functionality out of net/ and into media/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add content/common/mime_util.h for realz Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/media_galleries/fileapi/media_path_filter.h" 5 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #endif 9 #endif
10 10
11 #include <algorithm> 11 #include <algorithm>
12 #include <string> 12 #include <string>
13 13
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "content/common/mime_util.h"
15 #include "net/base/mime_util.h" 16 #include "net/base/mime_util.h"
16 17
17 namespace { 18 namespace {
18 19
19 const base::FilePath::CharType* const kExtraSupportedImageExtensions[] = { 20 const base::FilePath::CharType* const kExtraSupportedImageExtensions[] = {
20 // RAW picture file types. 21 // RAW picture file types.
21 // Some of which are just image/tiff. 22 // Some of which are just image/tiff.
22 FILE_PATH_LITERAL("3fr"), // (Hasselblad) 23 FILE_PATH_LITERAL("3fr"), // (Hasselblad)
23 FILE_PATH_LITERAL("arw"), // (Sony) 24 FILE_PATH_LITERAL("arw"), // (Sony)
24 FILE_PATH_LITERAL("dcr"), // (Kodak) 25 FILE_PATH_LITERAL("dcr"), // (Kodak)
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 FILE_PATH_LITERAL("alac"), // video/mp4 73 FILE_PATH_LITERAL("alac"), // video/mp4
73 FILE_PATH_LITERAL("flac"), // audio/x-flac 74 FILE_PATH_LITERAL("flac"), // audio/x-flac
74 FILE_PATH_LITERAL("m4b"), // video/mp4 75 FILE_PATH_LITERAL("m4b"), // video/mp4
75 FILE_PATH_LITERAL("m4p"), // video/mp4 76 FILE_PATH_LITERAL("m4p"), // video/mp4
76 FILE_PATH_LITERAL("wma"), // video/x-ms-asf 77 FILE_PATH_LITERAL("wma"), // video/x-ms-asf
77 }; 78 };
78 79
79 bool IsUnsupportedExtension(const base::FilePath::StringType& extension) { 80 bool IsUnsupportedExtension(const base::FilePath::StringType& extension) {
80 std::string mime_type; 81 std::string mime_type;
81 return !net::GetMimeTypeFromExtension(extension, &mime_type) || 82 return !net::GetMimeTypeFromExtension(extension, &mime_type) ||
82 !net::IsSupportedMimeType(mime_type); 83 !content::IsSupportedMimeType(mime_type);
83 } 84 }
84 85
85 std::vector<base::FilePath::StringType> GetMediaExtensionList( 86 std::vector<base::FilePath::StringType> GetMediaExtensionList(
86 const std::string& mime_type) { 87 const std::string& mime_type) {
87 std::vector<base::FilePath::StringType> extensions; 88 std::vector<base::FilePath::StringType> extensions;
88 net::GetExtensionsForMimeType(mime_type, &extensions); 89 net::GetExtensionsForMimeType(mime_type, &extensions);
89 std::vector<base::FilePath::StringType>::iterator new_end = 90 std::vector<base::FilePath::StringType>::iterator new_end =
90 std::remove_if(extensions.begin(), 91 std::remove_if(extensions.begin(),
91 extensions.end(), 92 extensions.end(),
92 &IsUnsupportedExtension); 93 &IsUnsupportedExtension);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 207 }
207 208
208 void MediaPathFilter::AddExtensionToMediaFileExtensionMap( 209 void MediaPathFilter::AddExtensionToMediaFileExtensionMap(
209 const base::FilePath::CharType* extension, 210 const base::FilePath::CharType* extension,
210 MediaGalleryScanFileType type) { 211 MediaGalleryScanFileType type) {
211 base::FilePath::StringType extension_with_sep = 212 base::FilePath::StringType extension_with_sep =
212 base::FilePath::kExtensionSeparator + 213 base::FilePath::kExtensionSeparator +
213 base::FilePath::StringType(extension); 214 base::FilePath::StringType(extension);
214 media_file_extensions_map_[extension_with_sep] |= type; 215 media_file_extensions_map_[extension_with_sep] |= type;
215 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698