| // Copyright 2023 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| #include "chrome/browser/ash/file_manager/uma_enums.gen.h" |
| |
| #include <algorithm> |
| |
| #include "base/strings/string_util.h" |
| |
| // File generated by //ui/file_manager/base/gn/uma_enums_generate.py. |
| namespace file_manager::file_tasks { |
| |
| ViewFileType GetViewFileType(const base::FilePath& path) { |
| static constexpr auto kViewFileTypes = { |
| "other", ".3ga", ".3gp", |
| ".aac", ".alac", ".asf", |
| ".avi", ".bmp", ".csv", |
| ".doc", ".docx", ".flac", |
| ".gif", ".jpeg", ".jpg", |
| ".log", ".m3u", ".m3u8", |
| ".m4a", ".m4v", ".mid", |
| ".mkv", ".mov", ".mp3", |
| ".mp4", ".mpg", ".odf", |
| ".odp", ".ods", ".odt", |
| ".oga", ".ogg", ".ogv", |
| ".pdf", ".png", ".ppt", |
| ".pptx", ".ra", ".ram", |
| ".rar", ".rm", ".rtf", |
| ".wav", ".webm", ".webp", |
| ".wma", ".wmv", ".xls", |
| ".xlsx", ".crdownload", ".crx", |
| ".dmg", ".exe", ".html", |
| ".htm", ".jar", ".ps", |
| ".torrent", ".txt", ".zip", |
| "directory", "no extension", "unknown extension", |
| ".mhtml", ".gdoc", ".gsheet", |
| ".gslides", ".arw", ".cr2", |
| ".dng", ".nef", ".nrw", |
| ".orf", ".raf", ".rw2", |
| ".tini", ".7z", ".apk", |
| ".apng", ".avif", ".bz2", |
| ".c", ".crswap", ".css", |
| ".dat", ".email", ".eml", |
| ".eps", ".gz", ".ico", |
| ".ics", ".iso", ".java", |
| ".jxl", ".mpeg", ".msg", |
| ".msi", ".pps", ".ppsx", |
| ".psd", ".py", ".sh", |
| ".svg", ".svgz", ".tar", |
| ".tgz", ".tif", ".tiff", |
| ".vcf", ".xml", ".xz", |
| }; |
| |
| auto* const* it = std::find(kViewFileTypes.begin(), kViewFileTypes.end(), |
| base::ToLowerASCII(path.FinalExtension())); |
| if (it != kViewFileTypes.end()) { |
| return static_cast<ViewFileType>(std::distance(kViewFileTypes.begin(), it)); |
| } |
| return ViewFileType::kOther; |
| } |
| |
| } // namespace file_manager::file_tasks |