OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // File-level comment to appease parser. Eventually this will not be necessary. | 5 // File-level comment to appease parser. Eventually this will not be necessary. |
6 | 6 |
7 namespace fileSystem { | 7 namespace fileSystem { |
8 dictionary ChooseFileOptions { | 8 dictionary ChooseFileOptions { |
9 // Type of the prompt to show. Valid types are 'openFile', | 9 // Type of the prompt to show. Valid types are 'openFile', |
10 // 'openWritableFile' or 'saveFile'. | 10 // 'openWritableFile' or 'saveFile'. |
11 // | 11 // |
12 // Both 'openFile' and 'openWritableFile' will prompt the user to open an | 12 // Both 'openFile' and 'openWritableFile' will prompt the user to open an |
13 // existing file, with 'openFile' returning a read-only FileEntry on | 13 // existing file, with 'openFile' returning a read-only FileEntry on |
14 // success. 'saveFile' will prompt the user to choose an existing file or | 14 // success. 'saveFile' will prompt the user to choose an existing file or |
15 // a new file, and will return a writable FileEntry. | 15 // a new file, and will return a writable FileEntry. |
16 // Calls to chooseFile with either 'openWritableFile' or 'saveFile' will | 16 // Calls to chooseFile with either 'openWritableFile' or 'saveFile' will |
17 // fail unless the application has the fileSystemWrite permission. | 17 // fail unless the application has the fileSystemWrite permission. |
18 // | 18 // |
19 // The default is 'openFile'. | 19 // The default is 'openFile'. |
20 DOMString? type; | 20 DOMString? type; |
21 | |
22 // The suggested file name that will be presented to the user as the | |
23 // default name to read or write. This is optional. | |
24 DOMString? suggestedPath; | |
benwells
2012/07/12 06:10:57
Cool :) Feel free to do in a separate patch, or in
thorogood
2012/07/13 04:17:27
Done in other patch.
| |
25 | |
26 // The optional list of accepted mime-types for this file opener, grouped | |
27 // by type. | |
28 // | |
29 // For example, ['image/*', 'application/json,.jso'] would display two type | |
benwells
2012/07/12 06:10:57
This is not nitting on the text, just me trying to
thorogood
2012/07/13 04:17:27
Yes, that's right. The aim here is to allow for al
| |
30 // options - one accepting images - and the other accepting json files and | |
31 // those with the extension 'jso'. | |
32 // | |
33 // This field is optional. However, it is an error to not specify this | |
34 // field (or pass an empty array) but pass acceptsAllTypes as false. | |
35 DOMString[]? accepts; | |
36 | |
37 // Does this file picker accept all file types, in addition to the options | |
38 // specified in the accepts argument? | |
benwells
2012/07/12 06:10:57
Nit: don't phrase as a question.
thorogood
2012/07/13 04:17:27
Done.
| |
39 // | |
40 // The default is true. | |
41 boolean? acceptsAllTypes; | |
21 }; | 42 }; |
22 callback GetDisplayPathCallback = void (DOMString displayPath); | 43 callback GetDisplayPathCallback = void (DOMString displayPath); |
23 callback FileEntryCallback = void ([instanceOf=fileEntry] object fileEntry); | 44 callback FileEntryCallback = void ([instanceOf=fileEntry] object fileEntry); |
24 | 45 |
25 interface Functions { | 46 interface Functions { |
26 // Get the display path of a FileEntry object. The display path is based on | 47 // Get the display path of a FileEntry object. The display path is based on |
27 // the full path of the file on the local file system, but may be made more | 48 // the full path of the file on the local file system, but may be made more |
28 // readable for display purposes. | 49 // readable for display purposes. |
29 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, | 50 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, |
30 GetDisplayPathCallback callback); | 51 GetDisplayPathCallback callback); |
31 | 52 |
32 // Get a writable FileEntry from another FileEntry. This call will fail | 53 // Get a writable FileEntry from another FileEntry. This call will fail |
33 // if the application does not have the fileSystemWrite permission. | 54 // if the application does not have the fileSystemWrite permission. |
34 static void getWritableFileEntry([instanceOf=FileEntry] object fileEntry, | 55 static void getWritableFileEntry([instanceOf=FileEntry] object fileEntry, |
35 FileEntryCallback callback); | 56 FileEntryCallback callback); |
36 | 57 |
37 // Ask the user to choose a file. | 58 // Ask the user to choose a file. |
38 static void chooseFile(optional ChooseFileOptions options, | 59 static void chooseFile(optional ChooseFileOptions options, |
39 FileEntryCallback callback); | 60 FileEntryCallback callback); |
40 }; | 61 }; |
41 }; | 62 }; |
OLD | NEW |