[FilesRecentFilter] support *.mov file in Recent filter
With the json data generator tool introduced in CL:3473619, we extract
the supported file type list from the original `file_type.js` and put
it in a standalone `file_types.json5`, which serves as a single source
of truth for all files we support in Files app.
The json data generator will generate files both in Javascript and C++,
so they can be imported directly in both frontend and backend as the
file type data source. This CL covers the change in the backend, we
generate a map so the recent_disk_source.cc can utilize that map to
get the mime type for a file, then utilize the existing util function
to check if the mime type belongs to a specific category or not.
Demo: http://shortn/_pnnLUmStXs (mov/avi are supported in Recent view
now, also arm audio and RAW images)
Bug: 1259359
Test: deploy to chromeos-on-linux and manually test
Test: unit_tests --gtest_filter="*RecentDiskSourceTest*"
Change-Id: Ib89c5c2b21fd2c8954bed96a5fb6a8535f263ce0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3482577
Reviewed-by: Luciano Pacheco <[email protected]>
Commit-Queue: Wenbo Jie <[email protected]>
Cr-Commit-Position: refs/heads/main@{#976113}
diff --git a/ui/file_manager/base/gn/BUILD.gn b/ui/file_manager/base/gn/BUILD.gn
index 3af8da9..9999c89 100644
--- a/ui/file_manager/base/gn/BUILD.gn
+++ b/ui/file_manager/base/gn/BUILD.gn
@@ -4,6 +4,24 @@
import("//tools/json_data_generator/json_data_generator.gni")
+json_data_generator("file_types_data_gen_cpp") {
+ sources = [ "file_types.json5" ]
+ templates = [
+ "file_types_data.cc.jinja",
+ "file_types_data.h.jinja",
+ ]
+ template_helper = "custom_jinja_helper.py"
+ output_dir = "$root_gen_dir/ui/file_manager"
+}
+
+source_set("file_types_data_cpp") {
+ sources = [
+ "$root_gen_dir/ui/file_manager/file_types_data.cc",
+ "$root_gen_dir/ui/file_manager/file_types_data.h",
+ ]
+ deps = [ ":file_types_data_gen_cpp" ]
+}
+
json_data_generator("file_types_data_gen_js") {
sources = [ "file_types.json5" ]
templates = [ "file_types_data.js.jinja" ]