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

Unified Diff: chrome/browser/media_galleries/fileapi/media_path_filter.h

Issue 149363004: Media Galleries: Initial media scanner implementation. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: with test Created 6 years, 11 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 | « no previous file | chrome/browser/media_galleries/fileapi/media_path_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_galleries/fileapi/media_path_filter.h
===================================================================
--- chrome/browser/media_galleries/fileapi/media_path_filter.h (revision 247534)
+++ chrome/browser/media_galleries/fileapi/media_path_filter.h (working copy)
@@ -5,10 +5,13 @@
#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_PATH_FILTER_H_
#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_PATH_FILTER_H_
+#include <string>
#include <vector>
+#include "base/containers/hash_tables.h"
#include "base/files/file_path.h"
#include "base/sequence_checker.h"
+#include "chrome/browser/media_galleries/media_scan_types.h"
// This class holds the list of file path extensions that we should expose on
// media filesystem.
@@ -16,17 +19,38 @@
public:
MediaPathFilter();
~MediaPathFilter();
+
+ // Returns true if |path| is a media file.
bool Match(const base::FilePath& path);
+ // Returns the type of |path| or MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN if it
+ // is not a media file.
+ MediaGalleryScanFileType GetType(const base::FilePath& path);
+
private:
typedef std::vector<base::FilePath::StringType> MediaFileExtensionList;
+ // Key: .extension
+ // Value: MediaGalleryScanFileType, but stored as an int to allow "|="
+ typedef base::hash_map<base::FilePath::StringType, int> MediaFileExtensionMap;
+
void EnsureInitialized();
+ void AddExtensionsToMediaFileExtensionMap(
+ const MediaFileExtensionList& extensions_list,
+ MediaGalleryScanFileType type);
+ void AddAdditionalExtensionsToMediaFileExtensionMap(
+ const base::FilePath::CharType* const* extensions_list,
+ size_t extensions_list_size,
+ MediaGalleryScanFileType type);
+ void AddExtensionToMediaFileExtensionMap(
+ const base::FilePath::CharType* extension,
+ MediaGalleryScanFileType type);
+
// Checks |initialized_| is only accessed on one sequence.
base::SequenceChecker sequence_checker_;
bool initialized_;
- MediaFileExtensionList media_file_extensions_;
+ MediaFileExtensionMap media_file_extensions_map_;
DISALLOW_COPY_AND_ASSIGN(MediaPathFilter);
};
« no previous file with comments | « no previous file | chrome/browser/media_galleries/fileapi/media_path_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698