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

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

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/supported_audio_video_checker.h " 5 #include "chrome/browser/media_galleries/fileapi/supported_audio_video_checker.h "
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 19 matching lines...) Expand all
30 net::GetExtensionsForMimeType("audio/*", &extensions); 30 net::GetExtensionsForMimeType("audio/*", &extensions);
31 net::GetExtensionsForMimeType("video/*", &extensions); 31 net::GetExtensionsForMimeType("video/*", &extensions);
32 for (size_t i = 0; i < extensions.size(); ++i) { 32 for (size_t i = 0; i < extensions.size(); ++i) {
33 std::string mime_type; 33 std::string mime_type;
34 if (net::GetWellKnownMimeTypeFromExtension(extensions[i], &mime_type) && 34 if (net::GetWellKnownMimeTypeFromExtension(extensions[i], &mime_type) &&
35 mime_util::IsSupportedMimeType(mime_type)) { 35 mime_util::IsSupportedMimeType(mime_type)) {
36 audio_video_extensions_.insert( 36 audio_video_extensions_.insert(
37 base::FilePath::kExtensionSeparator + extensions[i]); 37 base::FilePath::kExtensionSeparator + extensions[i]);
38 } 38 }
39 } 39 }
40 }; 40 }
41 41
42 bool HasSupportedAudioVideoExtension(const base::FilePath& file) { 42 bool HasSupportedAudioVideoExtension(const base::FilePath& file) {
43 return base::ContainsKey(audio_video_extensions_, file.Extension()); 43 return base::ContainsKey(audio_video_extensions_, file.Extension());
44 } 44 }
45 45
46 private: 46 private:
47 std::set<base::FilePath::StringType> audio_video_extensions_; 47 std::set<base::FilePath::StringType> audio_video_extensions_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(SupportedAudioVideoExtensions); 49 DISALLOW_COPY_AND_ASSIGN(SupportedAudioVideoExtensions);
50 }; 50 };
51 51
52 base::LazyInstance<SupportedAudioVideoExtensions> g_audio_video_extensions = 52 base::LazyInstance<SupportedAudioVideoExtensions>::DestructorAtExit
53 LAZY_INSTANCE_INITIALIZER; 53 g_audio_video_extensions = LAZY_INSTANCE_INITIALIZER;
54 54
55 base::File OpenOnFileThread(const base::FilePath& path) { 55 base::File OpenOnFileThread(const base::FilePath& path) {
56 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE); 56 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
57 return base::File(path, base::File::FLAG_OPEN | base::File::FLAG_READ); 57 return base::File(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 SupportedAudioVideoChecker::~SupportedAudioVideoChecker() {} 62 SupportedAudioVideoChecker::~SupportedAudioVideoChecker() {}
63 63
(...skipping 25 matching lines...) Expand all
89 void SupportedAudioVideoChecker::OnFileOpen(base::File file) { 89 void SupportedAudioVideoChecker::OnFileOpen(base::File file) {
90 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 90 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
91 if (!file.IsValid()) { 91 if (!file.IsValid()) {
92 callback_.Run(base::File::FILE_ERROR_SECURITY); 92 callback_.Run(base::File::FILE_ERROR_SECURITY);
93 return; 93 return;
94 } 94 }
95 95
96 safe_checker_ = new SafeAudioVideoChecker(std::move(file), callback_); 96 safe_checker_ = new SafeAudioVideoChecker(std::move(file), callback_);
97 safe_checker_->Start(); 97 safe_checker_->Start();
98 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698