Used by packaged apps
to specify what types of files the app can handle. An app can have multiple
file_handlers, with each one having an identifier, a list of MIME
types and/or a list of file extensions that can be handled.
The app can handle a file if it either has a matching file extension or
has a matching MIME type.
You can use a wildcard "*" in types or
extensions to indicate that the app can handle any file type or
"type/*" in types to indicate that the app
can handle any file with a MIME type of type.
Here's an example of specifying file handlers:
"file_handlers": {
"text": {
"types": [
"text/*"
],
"title": "{Name of app}"
},
"image": {
"types": [
"image/png",
"image/jpeg"
],
"extensions": [
"tiff"
],
"title": "{Name of app}"
},
"any": {
"extensions": [
"*"
],
"title": "{Name of app}"
}
}
The title attribute is mandatory on Chrome
version 37 and earlier. As of Chrome version 38, it is deprecated and
will be ignored (the app's name will be used instead). For
compatibility, title should always be the name of the app.
To handle files, apps also need to declare the $(ref:fileSystem) permission. Apps can then be passed files in the $(ref:app.runtime.onLaunched) event - either from the system file manager (currently supported on ChromeOS only) or by providing a path on the command line.