Chromium Code Reviews| Index: webkit/fileapi/media/media_path_filter.cc |
| diff --git a/webkit/fileapi/media/media_path_filter.cc b/webkit/fileapi/media/media_path_filter.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6a1244662e52f907d5470a2af94f3ae03f231489 |
| --- /dev/null |
| +++ b/webkit/fileapi/media/media_path_filter.cc |
| @@ -0,0 +1,33 @@ |
| +// Copyright (c) 2012 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 "webkit/fileapi/media/media_path_filter.h" |
| + |
| +#include <algorithm> |
| + |
| +#include "base/string_util.h" |
| +#include "net/base/mime_util.h" |
| + |
| +namespace fileapi { |
| + |
| +MediaPathFilter::MediaPathFilter() { |
| + net::GetImageExtensions(&media_file_extensions_); |
|
vandebo (ex-Chrome)
2012/07/30 17:01:44
This seems ok, but maybe we want to filter to only
tzik
2012/07/30 23:32:36
Done.
I restrict them to supported type.
|
| + net::GetAudioExtensions(&media_file_extensions_); |
| + net::GetVideoExtensions(&media_file_extensions_); |
| + for (MediaFileExtensionList::iterator itr = media_file_extensions_.begin(); |
| + itr != media_file_extensions_.end(); ++itr) |
| + *itr = FilePath::kExtensionSeparator + *itr; |
| + std::sort(media_file_extensions_.begin(), media_file_extensions_.end()); |
| +} |
| + |
| +MediaPathFilter::~MediaPathFilter() { |
| +} |
| + |
| +bool MediaPathFilter::Match(const FilePath& path) const { |
| + return std::binary_search(media_file_extensions_.begin(), |
| + media_file_extensions_.end(), |
| + StringToLowerASCII(path.Extension())); |
| +} |
| + |
| +} // namespace fileapi |