| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ | 5 #ifndef PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ |
| 6 #define PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ | 6 #define PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ppapi/c/dev/ppb_file_chooser_dev.h" | 10 #include "ppapi/c/dev/ppb_file_chooser_dev.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 /// screen relative to the tab containing the instance. Returns 0 if passed | 29 /// screen relative to the tab containing the instance. Returns 0 if passed |
| 30 /// an invalid instance. | 30 /// an invalid instance. |
| 31 /// | 31 /// |
| 32 /// @param mode A PPB_FileChooser_Dev instance can be used to select a single | 32 /// @param mode A PPB_FileChooser_Dev instance can be used to select a single |
| 33 /// file (PP_FILECHOOSERMODE_OPEN) or multiple files | 33 /// file (PP_FILECHOOSERMODE_OPEN) or multiple files |
| 34 /// (PP_FILECHOOSERMODE_OPENMULTIPLE). Unlike the HTML5 <input type="file"> | 34 /// (PP_FILECHOOSERMODE_OPENMULTIPLE). Unlike the HTML5 <input type="file"> |
| 35 /// tag, a PPB_FileChooser_Dev instance cannot be used to select a directory. | 35 /// tag, a PPB_FileChooser_Dev instance cannot be used to select a directory. |
| 36 /// In order to get the list of files in a directory, the | 36 /// In order to get the list of files in a directory, the |
| 37 /// PPB_DirectoryReader_Dev interface must be used. | 37 /// PPB_DirectoryReader_Dev interface must be used. |
| 38 /// | 38 /// |
| 39 /// @param accept_mime_types A comma-separated list of MIME types such as | 39 /// @param accept_types A comma-separated list of MIME types and file |
| 40 /// "audio/ *,text/plain" (note there should be no space between the '/' and | 40 /// extensions such as "audio/ *,text/plain,.html" (note there should be |
| 41 /// the '*', but one is added to avoid confusing C++ comments). The dialog | 41 /// no space between the '/' and the '*', but one is added to avoid confusing |
| 42 /// may restrict selectable files to the specified MIME types. An empty string | 42 /// C++ comments). The dialog may restrict selectable files to the specified |
| 43 /// or an undefined var may be given to indicate that all types should be | 43 /// MIME types and file extensions. If a string in the comma-separated list |
| 44 /// begins with a period (.) then the string is interpreted as a file |
| 45 /// extension, otherwise it is interpreted as a MIME-type. An empty string or |
| 46 /// an undefined var may be given to indicate that all types should be |
| 44 /// accepted. | 47 /// accepted. |
| 45 /// | |
| 46 /// TODO(darin): What if the mime type is unknown to the system? The plugin | |
| 47 /// may wish to describe the mime type and provide a matching file extension. | |
| 48 /// It is more webby to use mime types here instead of file extensions. | |
| 49 FileChooser_Dev(const InstanceHandle& instance, | 48 FileChooser_Dev(const InstanceHandle& instance, |
| 50 PP_FileChooserMode_Dev mode, | 49 PP_FileChooserMode_Dev mode, |
| 51 const Var& accept_mime_types); | 50 const Var& accept_types); |
| 52 | 51 |
| 53 FileChooser_Dev(const FileChooser_Dev& other); | 52 FileChooser_Dev(const FileChooser_Dev& other); |
| 54 | 53 |
| 55 /// This function displays a previously created file chooser resource as a | 54 /// This function displays a previously created file chooser resource as a |
| 56 /// dialog box, prompting the user to choose a file or files. This function | 55 /// dialog box, prompting the user to choose a file or files. This function |
| 57 /// must be called in response to a user gesture, such as a mouse click or | 56 /// must be called in response to a user gesture, such as a mouse click or |
| 58 /// touch event. The callback is called with PP_OK on successful completion | 57 /// touch event. The callback is called with PP_OK on successful completion |
| 59 /// with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected | 58 /// with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected |
| 60 /// no file, or another error code from pp_errors.h on failure. | 59 /// no file, or another error code from pp_errors.h on failure. |
| 61 /// | 60 /// |
| (...skipping 30 matching lines...) Expand all Loading... |
| 92 // the caller is expecting. | 91 // the caller is expecting. |
| 93 // | 92 // |
| 94 // This takes a heap-allocated ChooseCallbackData0_5 struct passed as the | 93 // This takes a heap-allocated ChooseCallbackData0_5 struct passed as the |
| 95 // user data and deletes it when the call completes. | 94 // user data and deletes it when the call completes. |
| 96 static void CallbackConverter(void* user_data, int32_t result); | 95 static void CallbackConverter(void* user_data, int32_t result); |
| 97 }; | 96 }; |
| 98 | 97 |
| 99 } // namespace pp | 98 } // namespace pp |
| 100 | 99 |
| 101 #endif // PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ | 100 #endif // PPAPI_CPP_DEV_FILE_CHOOSER_DEV_H_ |
| OLD | NEW |