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 | 21 |
22 // The suggested file name that will be presented to the user as the | 22 // The suggested file name that will be presented to the user as the |
23 // default name to read or write. This is optional. | 23 // default name to read or write. This is optional. |
24 DOMString? suggestedName; | 24 DOMString? suggestedName; |
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 | |
30 // options - one accepting images - and the other accepting json files and | |
benwells
2012/07/24 06:01:27
Collapse the above two paragraphs into one.
thorogood
2012/07/25 05:02:59
Done.
| |
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 // Whether to accept all file types, in addition to the options specified | |
38 // in the accepts argument. | |
39 // | |
40 // The default is true. | |
benwells
2012/07/24 06:01:27
Ditto
thorogood
2012/07/25 05:02:59
Done.
| |
41 boolean? acceptsAllTypes; | |
25 }; | 42 }; |
26 callback GetDisplayPathCallback = void (DOMString displayPath); | 43 callback GetDisplayPathCallback = void (DOMString displayPath); |
27 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); | 44 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); |
28 callback IsWritableCallback = void (boolean isWritable); | 45 callback IsWritableCallback = void (boolean isWritable); |
29 | 46 |
30 interface Functions { | 47 interface Functions { |
31 // Get the display path of a FileEntry object. The display path is based on | 48 // Get the display path of a FileEntry object. The display path is based on |
32 // the full path of the file on the local file system, but may be made more | 49 // the full path of the file on the local file system, but may be made more |
33 // readable for display purposes. | 50 // readable for display purposes. |
34 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, | 51 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, |
35 GetDisplayPathCallback callback); | 52 GetDisplayPathCallback callback); |
36 | 53 |
37 // Get a writable FileEntry from another FileEntry. This call will fail | 54 // Get a writable FileEntry from another FileEntry. This call will fail |
38 // if the application does not have the fileSystemWrite permission. | 55 // if the application does not have the fileSystemWrite permission. |
39 static void getWritableFileEntry([instanceOf=FileEntry] object fileEntry, | 56 static void getWritableFileEntry([instanceOf=FileEntry] object fileEntry, |
40 FileEntryCallback callback); | 57 FileEntryCallback callback); |
41 | 58 |
42 // Gets whether this FileEntry is writable or not. | 59 // Gets whether this FileEntry is writable or not. |
43 static void isWritableFileEntry([instanceOf=FileEntry] object fileEntry, | 60 static void isWritableFileEntry([instanceOf=FileEntry] object fileEntry, |
44 IsWritableCallback callback); | 61 IsWritableCallback callback); |
45 | 62 |
46 // Ask the user to choose a file. | 63 // Ask the user to choose a file. |
47 static void chooseFile(optional ChooseFileOptions options, | 64 static void chooseFile(optional ChooseFileOptions options, |
48 FileEntryCallback callback); | 65 FileEntryCallback callback); |
49 }; | 66 }; |
50 }; | 67 }; |
OLD | NEW |