OLD | NEW |
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 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 MediaPathFilter::~MediaPathFilter() { | 147 MediaPathFilter::~MediaPathFilter() { |
148 } | 148 } |
149 | 149 |
150 bool MediaPathFilter::Match(const base::FilePath& path) { | 150 bool MediaPathFilter::Match(const base::FilePath& path) { |
151 return GetType(path) != MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; | 151 return GetType(path) != MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; |
152 } | 152 } |
153 | 153 |
154 MediaGalleryScanFileType MediaPathFilter::GetType(const base::FilePath& path) { | 154 MediaGalleryScanFileType MediaPathFilter::GetType(const base::FilePath& path) { |
155 EnsureInitialized(); | 155 EnsureInitialized(); |
156 MediaFileExtensionMap::const_iterator it = | 156 MediaFileExtensionMap::const_iterator it = |
157 media_file_extensions_map_.find(StringToLowerASCII(path.Extension())); | 157 media_file_extensions_map_.find( |
| 158 base::StringToLowerASCII(path.Extension())); |
158 if (it == media_file_extensions_map_.end()) | 159 if (it == media_file_extensions_map_.end()) |
159 return MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; | 160 return MEDIA_GALLERY_SCAN_FILE_TYPE_UNKNOWN; |
160 return static_cast<MediaGalleryScanFileType>(it->second); | 161 return static_cast<MediaGalleryScanFileType>(it->second); |
161 } | 162 } |
162 | 163 |
163 void MediaPathFilter::EnsureInitialized() { | 164 void MediaPathFilter::EnsureInitialized() { |
164 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | 165 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); |
165 if (initialized_) | 166 if (initialized_) |
166 return; | 167 return; |
167 | 168 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |