| OLD | NEW |
| (Empty) | |
| 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 |
| 5 namespace fileSystem { |
| 6 dictionary AcceptOption { |
| 7 // This is the optional text description for this option. If not present, |
| 8 // a description will be automatically generated; typically containing an |
| 9 // expanded list of valid extensions (e.g. "text/html" may expand to |
| 10 // "*.html, *.htm"). |
| 11 DOMString? description; |
| 12 |
| 13 // Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or |
| 14 // extensions must contain at least one valid element. |
| 15 DOMString[]? mimeTypes; |
| 16 |
| 17 // Extensions to accept, e.g. "jpg", "gif", "crx". |
| 18 DOMString[]? extensions; |
| 19 }; |
| 20 |
| 21 dictionary ChooseEntryOptions { |
| 22 // Type of the prompt to show. Valid types are 'openFile', |
| 23 // 'openWritableFile' or 'saveFile'. |
| 24 // |
| 25 // Both 'openFile' and 'openWritableFile' will prompt the user to open an |
| 26 // existing file, with 'openFile' returning a read-only FileEntry on |
| 27 // success. 'saveFile' will prompt the user to choose an existing file or |
| 28 // a new file, and will return a writable FileEntry. |
| 29 // Calls to chooseFile with either 'openWritableFile' or 'saveFile' will |
| 30 // fail unless the application has the 'write' permission under |
| 31 // 'fileSystem'. |
| 32 // |
| 33 // The default is 'openFile'. |
| 34 DOMString? type; |
| 35 |
| 36 // The suggested file name that will be presented to the user as the |
| 37 // default name to read or write. This is optional. |
| 38 DOMString? suggestedName; |
| 39 |
| 40 // The optional list of accept options for this file opener. Each option |
| 41 // will be presented as a unique group to the end-user. |
| 42 AcceptOption[]? accepts; |
| 43 |
| 44 // Whether to accept all file types, in addition to the options specified |
| 45 // in the accepts argument. The default is true. If the accepts field is |
| 46 // unset or contains no valid entries, this will always be reset to true. |
| 47 boolean? acceptsAllTypes; |
| 48 }; |
| 49 callback GetDisplayPathCallback = void (DOMString displayPath); |
| 50 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); |
| 51 callback IsWritableCallback = void (boolean isWritable); |
| 52 |
| 53 interface Functions { |
| 54 // Get the display path of a FileEntry object. The display path is based on |
| 55 // the full path of the file on the local file system, but may be made more |
| 56 // readable for display purposes. |
| 57 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, |
| 58 GetDisplayPathCallback callback); |
| 59 |
| 60 // Get a writable FileEntry from another FileEntry. This call will fail if |
| 61 // the application does not have the 'write' permission under 'fileSystem'. |
| 62 static void getWritableEntry([instanceOf=FileEntry] object fileEntry, |
| 63 FileEntryCallback callback); |
| 64 |
| 65 // Gets whether this FileEntry is writable or not. |
| 66 static void isWritableEntry([instanceOf=FileEntry] object fileEntry, |
| 67 IsWritableCallback callback); |
| 68 |
| 69 // Ask the user to choose a file. |
| 70 static void chooseEntry(optional ChooseEntryOptions options, |
| 71 FileEntryCallback callback); |
| 72 |
| 73 // Returns the file entry with the given id. |
| 74 [nocompile] static FileEntry getEntryById(DOMString id); |
| 75 |
| 76 // Returns the id of the given file entry. |
| 77 [nocompile] static DOMString getEntryId( |
| 78 [instanceOf=FileEntry] object fileEntry); |
| 79 }; |
| 80 }; |
| OLD | NEW |