Fix iOS build for XCode 4.6.
[chromium-blink-merge.git] / ppapi / api / dev / ppb_file_chooser_dev.idl
blobc545a041832d02f1719f0249aad0542c237ffc1f
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
7 /**
8 * This file defines the <code>PPB_FileChooser_Dev</code> interface.
9 */
11 label Chrome {
12 M16 = 0.5,
13 M19 = 0.6
16 /**
17 * This enumeration contains constants to control the behavior of the file
18 * chooser dialog.
20 [assert_size(4)]
21 enum PP_FileChooserMode_Dev {
22 /**
23 * Mode for choosing a single existing file.
25 PP_FILECHOOSERMODE_OPEN = 0,
26 /**
27 * Mode for choosing multiple existing files.
29 PP_FILECHOOSERMODE_OPENMULTIPLE = 1
32 interface PPB_FileChooser_Dev {
33 /**
34 * This function creates a file chooser dialog resource. The chooser is
35 * associated with a particular instance, so that it may be positioned on the
36 * screen relative to the tab containing the instance.
38 * @param[in] instance A <code>PP_Instance</code> identifying one instance
39 * of a module.
40 * @param[in] mode A <code>PP_FileChooserMode_Dev</code> value that controls
41 * the behavior of the file chooser dialog.
42 * @param[in] accept_types A comma-separated list of MIME types and file
43 * extensions such as "audio/ *,text/plain,.html" (note there should be no
44 * space between the '/' and the '*', but one is added to avoid confusing C++
45 * comments). The dialog may restrict selectable files to the specified MIME
46 * types and file extensions. If a string in the comma-separated list begins
47 * with a period (.) then the string is interpreted as a file extension,
48 * otherwise it is interpreted as a MIME-type. An empty string or an undefined
49 * var may be given to indicate that all types should be accepted.
51 * @return A <code>PP_Resource</code> containing the file chooser if
52 * successful or 0 if it could not be created.
54 PP_Resource Create(
55 [in] PP_Instance instance,
56 [in] PP_FileChooserMode_Dev mode,
57 [in] PP_Var accept_types);
59 /**
60 * Determines if the provided resource is a file chooser.
62 * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
63 * resource.
65 * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
66 * resource is a file chooser resource, otherwise <code>PP_FALSE</code>.
68 PP_Bool IsFileChooser(
69 [in] PP_Resource resource);
71 /**
72 * This function displays a previously created file chooser resource as a
73 * dialog box, prompting the user to choose a file or files. This function
74 * must be called in response to a user gesture, such as a mouse click or
75 * touch event. The callback is called with PP_OK on successful completion
76 * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected
77 * no file, or another error code from pp_errors.h on failure.
79 * <b>Subtle note:</b> This function will only work when the tab containing
80 * the plugin is visible. Show will fail if the tab is in the background.
81 * Since it's not normally possible to get input events while invisible, this
82 * is not an issue. But there is a race condition because events are
83 * processed asynchronously that authors should be aware of. If the user
84 * clicks and switches tabs very quickly, a plugin could believe the tab is
85 * visible while Chrome believes it is invisible and the Show() call will
86 * fail. This will not generally cause user confusion since the user will
87 * have switched tabs and will not want to see a file chooser from a
88 * different tab.
90 * @param[in] chooser The file chooser resource.
91 * @param[in] callback A <code>CompletionCallback</code> to be called after
92 * the user has closed the file chooser dialog.
94 * @return PP_OK_COMPLETIONPENDING if request to show the dialog was
95 * successful, another error code from pp_errors.h on failure.
97 [deprecate=0.6]
98 int32_t Show(
99 [in] PP_Resource chooser,
100 [in] PP_CompletionCallback callback);
103 * After a successful completion callback call from Show, this method may be
104 * used to query the chosen files. It should be called in a loop until it
105 * returns 0. Their file system type will be PP_FileSystemType_External. If
106 * the user chose no files or canceled the dialog, then this method will
107 * simply return 0 the first time it is called.
109 * @param[in] chooser The file chooser resource.
111 * @return A <code>PP_Resource</code> containing the next file chosen by the
112 * user, or 0 if there are no more files.
114 [deprecate=0.6]
115 PP_Resource GetNextChosenFile(
116 [in] PP_Resource chooser);
119 * This function displays a previously created file chooser resource as a
120 * dialog box, prompting the user to choose a file or files. This function
121 * must be called in response to a user gesture, such as a mouse click or
122 * touch event. The callback is called with PP_OK on successful completion
123 * with a file (or files) selected, PP_ERROR_USERCANCEL if the user selected
124 * no file, or another error code from pp_errors.h on failure.
126 * <b>Subtle note:</b> This function will only work when the tab containing
127 * the plugin is visible. Show() will fail if the tab is in the background.
128 * Since it's not normally possible to get input events while invisible, this
129 * is not normally an issue. But there is a race condition because events are
130 * processed asynchronously. If the user clicks and switches tabs very
131 * quickly, a plugin could believe the tab is visible while Chrome believes
132 * it is invisible and the Show() call will fail. This will not generally
133 * cause user confusion since the user will have switched tabs and will not
134 * want to see a file chooser from a different tab.
136 * @param[in] chooser The file chooser resource.
138 * @param[in] output An output array which will receive PP_Resource(s)
139 * identifying the <code>PPB_FileRef</code> objects that the user selected on
140 * success.
142 * @param[in] callback A <code>CompletionCallback</code> to be called after
143 * the user has closed the file chooser dialog.
145 * @return PP_OK_COMPLETIONPENDING if request to show the dialog was
146 * successful, another error code from pp_errors.h on failure.
148 [version=0.6]
149 int32_t Show([in] PP_Resource chooser,
150 [in] PP_ArrayOutput output,
151 [in] PP_CompletionCallback callback);