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

Unified Diff: webkit/fileapi/media/media_path_filter.cc

Issue 14247034: Move Media Galleries FileAPI code out of webkit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cr-14352004
Patch Set: Add android ifdef. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/media/media_path_filter.h ('k') | webkit/fileapi/media/mtp_device_async_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
deleted file mode 100644
index c9a0a818319254db0630dc0404a22bb4b98ac2bc..0000000000000000000000000000000000000000
--- a/webkit/fileapi/media/media_path_filter.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// 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 <string>
-
-#include "base/string_util.h"
-#include "net/base/mime_util.h"
-
-namespace fileapi {
-
-namespace {
-
-const base::FilePath::CharType* const kExtraSupportedExtensions[] = {
- FILE_PATH_LITERAL("3gp"),
- FILE_PATH_LITERAL("3gpp"),
- FILE_PATH_LITERAL("avi"),
- FILE_PATH_LITERAL("flv"),
- FILE_PATH_LITERAL("mov"),
- FILE_PATH_LITERAL("mpeg"),
- FILE_PATH_LITERAL("mpeg4"),
- FILE_PATH_LITERAL("mpegps"),
- FILE_PATH_LITERAL("mpg"),
- FILE_PATH_LITERAL("wmv"),
-};
-
-bool IsUnsupportedExtension(const base::FilePath::StringType& extension) {
- std::string mime_type;
- return !net::GetMimeTypeFromExtension(extension, &mime_type) ||
- !net::IsSupportedMimeType(mime_type);
-}
-
-} // namespace
-
-MediaPathFilter::MediaPathFilter()
- : initialized_(false) {
-}
-
-MediaPathFilter::~MediaPathFilter() {
-}
-
-bool MediaPathFilter::Match(const base::FilePath& path) {
- EnsureInitialized();
- return std::binary_search(media_file_extensions_.begin(),
- media_file_extensions_.end(),
- StringToLowerASCII(path.Extension()));
-}
-
-void MediaPathFilter::EnsureInitialized() {
- if (initialized_)
- return;
-
- base::AutoLock lock(initialization_lock_);
- if (initialized_)
- return;
-
- net::GetExtensionsForMimeType("image/*", &media_file_extensions_);
- net::GetExtensionsForMimeType("audio/*", &media_file_extensions_);
- net::GetExtensionsForMimeType("video/*", &media_file_extensions_);
-
- MediaFileExtensionList::iterator new_end =
- std::remove_if(media_file_extensions_.begin(),
- media_file_extensions_.end(),
- &IsUnsupportedExtension);
- media_file_extensions_.erase(new_end, media_file_extensions_.end());
-
- // Add other common extensions.
- for (size_t i = 0; i < arraysize(kExtraSupportedExtensions); ++i)
- media_file_extensions_.push_back(kExtraSupportedExtensions[i]);
-
- for (MediaFileExtensionList::iterator itr = media_file_extensions_.begin();
- itr != media_file_extensions_.end(); ++itr)
- *itr = base::FilePath::kExtensionSeparator + *itr;
- std::sort(media_file_extensions_.begin(), media_file_extensions_.end());
-
- initialized_ = true;
-}
-
-} // namespace fileapi
« no previous file with comments | « webkit/fileapi/media/media_path_filter.h ('k') | webkit/fileapi/media/mtp_device_async_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698