diff options
author | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 00:05:32 +0000 |
---|---|---|
committer | raymes@chromium.org <raymes@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-30 00:05:32 +0000 |
commit | f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2 (patch) | |
tree | 2f06565b8aaf35996d1ff3a553801f6d5aa29565 /ppapi/c | |
parent | 1e1184a4047adf5096a5597e4adf1ad07130445a (diff) | |
download | chromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.zip chromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.tar.gz chromium_src-f9a4c41a40dc781ea6bbbeeeb77ee3713dc168e2.tar.bz2 |
Modified the pepper file chooser API to support filtering files by extensions.
Previously you could filter only by MIME type. This adds support for filtering by specific extensions as well, e.g. .txt,.html. This change is aligned with the web platform which now allows filtering by file extension for <input> elements (http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#attr-input-accept).
This also changes the linux implementation of the file dialog (SelectFileDialogImplGTK). In the past, it would turn file extensions to filter into MIME types. However this is a bit silly because in FileSelectHelper we do the reverse (turn MIME types into a list of file extensions to filter by). It also prevents us from filtering by a specific extensions when this is really what is desired.
BUG=129251
TEST=
Review URL: https://chromiumcodereview.appspot.com/10414085
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r-- | ppapi/c/dev/ppb_file_chooser_dev.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/ppapi/c/dev/ppb_file_chooser_dev.h b/ppapi/c/dev/ppb_file_chooser_dev.h index 81e8f52..469c712 100644 --- a/ppapi/c/dev/ppb_file_chooser_dev.h +++ b/ppapi/c/dev/ppb_file_chooser_dev.h @@ -3,7 +3,7 @@ * found in the LICENSE file. */ -/* From dev/ppb_file_chooser_dev.idl modified Thu Mar 15 09:29:39 2012. */ +/* From dev/ppb_file_chooser_dev.idl modified Thu May 17 09:04:27 2012. */ #ifndef PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ #define PPAPI_C_DEV_PPB_FILE_CHOOSER_DEV_H_ @@ -64,19 +64,21 @@ struct PPB_FileChooser_Dev_0_6 { * of a module. * @param[in] mode A <code>PP_FileChooserMode_Dev</code> value that controls * the behavior of the file chooser dialog. - * @param[in] accept_mime_types A comma-separated list of MIME types such as - * "audio/ *,text/plain" (note there should be no space between the '/' and - * the '*', but one is added to avoid confusing C++ comments). The dialog - * may restrict selectable files to the specified MIME types. An empty string - * or an undefined var may be given to indicate that all types should be - * accepted. + * @param[in] accept_types A comma-separated list of MIME types and file + * extensions such as "audio/ *,text/plain,.html" (note there should be no + * space between the '/' and the '*', but one is added to avoid confusing C++ + * comments). The dialog may restrict selectable files to the specified MIME + * types and file extensions. If a string in the comma-separated list begins + * with a period (.) then the string is interpreted as a file extension, + * otherwise it is interpreted as a MIME-type. An empty string or an undefined + * var may be given to indicate that all types should be accepted. * * @return A <code>PP_Resource</code> containing the file chooser if * successful or 0 if it could not be created. */ PP_Resource (*Create)(PP_Instance instance, PP_FileChooserMode_Dev mode, - struct PP_Var accept_mime_types); + struct PP_Var accept_types); /** * Determines if the provided resource is a file chooser. * @@ -117,7 +119,7 @@ typedef struct PPB_FileChooser_Dev_0_6 PPB_FileChooser_Dev; struct PPB_FileChooser_Dev_0_5 { PP_Resource (*Create)(PP_Instance instance, PP_FileChooserMode_Dev mode, - struct PP_Var accept_mime_types); + struct PP_Var accept_types); PP_Bool (*IsFileChooser)(PP_Resource resource); int32_t (*Show)(PP_Resource chooser, struct PP_CompletionCallback callback); PP_Resource (*GetNextChosenFile)(PP_Resource chooser); |