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 namespace fileSystem { | 5 namespace fileSystem { |
6 dictionary AcceptOption { | 6 dictionary AcceptOption { |
7 // This is the optional text description for this option. If not present, | 7 // This is the optional text description for this option. If not present, |
8 // a description will be automatically generated; typically containing an | 8 // a description will be automatically generated; typically containing an |
9 // expanded list of valid extensions (e.g. "text/html" may expand to | 9 // expanded list of valid extensions (e.g. "text/html" may expand to |
10 // "*.html, *.htm"). | 10 // "*.html, *.htm"). |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 AcceptOption[]? accepts; | 48 AcceptOption[]? accepts; |
49 | 49 |
50 // Whether to accept all file types, in addition to the options specified | 50 // Whether to accept all file types, in addition to the options specified |
51 // in the accepts argument. The default is true. If the accepts field is | 51 // in the accepts argument. The default is true. If the accepts field is |
52 // unset or contains no valid entries, this will always be reset to true. | 52 // unset or contains no valid entries, this will always be reset to true. |
53 boolean? acceptsAllTypes; | 53 boolean? acceptsAllTypes; |
54 }; | 54 }; |
55 callback GetDisplayPathCallback = void (DOMString displayPath); | 55 callback GetDisplayPathCallback = void (DOMString displayPath); |
56 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); | 56 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); |
57 callback IsWritableCallback = void (boolean isWritable); | 57 callback IsWritableCallback = void (boolean isWritable); |
| 58 callback IsRestorableCallback = void (boolean isRestorable); |
58 | 59 |
59 interface Functions { | 60 interface Functions { |
60 // Get the display path of a FileEntry object. The display path is based on | 61 // Get the display path of a FileEntry object. The display path is based on |
61 // the full path of the file on the local file system, but may be made more | 62 // the full path of the file on the local file system, but may be made more |
62 // readable for display purposes. | 63 // readable for display purposes. |
63 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, | 64 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, |
64 GetDisplayPathCallback callback); | 65 GetDisplayPathCallback callback); |
65 | 66 |
66 // Get a writable FileEntry from another FileEntry. This call will fail if | 67 // Get a writable FileEntry from another FileEntry. This call will fail if |
67 // the application does not have the 'write' permission under 'fileSystem'. | 68 // the application does not have the 'write' permission under 'fileSystem'. |
68 static void getWritableEntry([instanceOf=FileEntry] object fileEntry, | 69 static void getWritableEntry([instanceOf=FileEntry] object fileEntry, |
69 FileEntryCallback callback); | 70 FileEntryCallback callback); |
70 | 71 |
71 // Gets whether this FileEntry is writable or not. | 72 // Gets whether this FileEntry is writable or not. |
72 static void isWritableEntry([instanceOf=FileEntry] object fileEntry, | 73 static void isWritableEntry([instanceOf=FileEntry] object fileEntry, |
73 IsWritableCallback callback); | 74 IsWritableCallback callback); |
74 | 75 |
75 // Ask the user to choose a file. | 76 // Ask the user to choose a file. |
76 static void chooseEntry(optional ChooseEntryOptions options, | 77 static void chooseEntry(optional ChooseEntryOptions options, |
77 FileEntryCallback callback); | 78 FileEntryCallback callback); |
78 | 79 |
79 // Returns the file entry with the given id. | 80 // Returns the file entry with the given id if it can be restored. This call |
80 [nocompile] static FileEntry getEntryById(DOMString id); | 81 // will fail otherwise. |
| 82 static void restoreEntry(DOMString id, FileEntryCallback callback); |
81 | 83 |
82 // Returns the id of the given file entry. This can be used to retrieve file | 84 // Returns whether a file entry for the given id can be restored, i.e. |
83 // entries with getEntryById(). When an app is restarted (ie: it is sent the | 85 // whether restoreEntry would succeed with this id now. |
84 // onRestarted event) it can regain access to the file entries it had by | 86 static void isRestorable(DOMString id, IsRestorableCallback callback); |
85 // remembering their ids and calling getEntryById(). | 87 |
86 [nocompile] static DOMString getEntryId( | 88 // Returns an id that can be passed to restoreEntry to regain access to a |
87 [instanceOf=FileEntry] object fileEntry); | 89 // given file entry. Only the 500 most recently used entries are retained, |
| 90 // where calls to retainEntry and restoreEntry count as use. |
| 91 static DOMString retainEntry([instanceOf=FileEntry] object fileEntry); |
88 }; | 92 }; |
89 }; | 93 }; |
OLD | NEW |