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 // Use the <code>chrome.fileSystem</code> API to create, read, navigate, | 5 // Use the <code>chrome.fileSystem</code> API to create, read, navigate, |
6 // and write to a sandboxed section of the user's local file system. With this | 6 // and write to a sandboxed section of the user's local file system. With this |
7 // API, packaged apps can read and write to a user-selected location. For | 7 // API, packaged apps can read and write to a user-selected location. For |
8 // example, a text editor app can use the API to read and write local documents. | 8 // example, a text editor app can use the API to read and write local documents. |
9 namespace fileSystem { | 9 namespace fileSystem { |
10 dictionary AcceptOption { | 10 dictionary AcceptOption { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 DOMString? suggestedName; | 48 DOMString? suggestedName; |
49 | 49 |
50 // The optional list of accept options for this file opener. Each option | 50 // The optional list of accept options for this file opener. Each option |
51 // will be presented as a unique group to the end-user. | 51 // will be presented as a unique group to the end-user. |
52 AcceptOption[]? accepts; | 52 AcceptOption[]? accepts; |
53 | 53 |
54 // Whether to accept all file types, in addition to the options specified | 54 // Whether to accept all file types, in addition to the options specified |
55 // in the accepts argument. The default is true. If the accepts field is | 55 // in the accepts argument. The default is true. If the accepts field is |
56 // unset or contains no valid entries, this will always be reset to true. | 56 // unset or contains no valid entries, this will always be reset to true. |
57 boolean? acceptsAllTypes; | 57 boolean? acceptsAllTypes; |
| 58 |
| 59 // Whether to accept multiple files. This is only supported for openFile and |
| 60 // openWritableFile. The callback to chooseEntry will be called with a list |
| 61 // of entries if this is set to true. Otherwise it will be called with a |
| 62 // single Entry. |
| 63 boolean? acceptsMultiple; |
58 }; | 64 }; |
59 callback GetDisplayPathCallback = void (DOMString displayPath); | 65 callback GetDisplayPathCallback = void (DOMString displayPath); |
60 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); | 66 callback FileEntryCallback = void ([instanceOf=FileEntry] object fileEntry); |
| 67 callback FileEntriesCallback = void ( |
| 68 [instanceOf=FileEntry] optional object fileEntry, |
| 69 [instanceOf=FileEntry] optional object[] fileEntries); |
61 callback IsWritableCallback = void (boolean isWritable); | 70 callback IsWritableCallback = void (boolean isWritable); |
62 callback IsRestorableCallback = void (boolean isRestorable); | 71 callback IsRestorableCallback = void (boolean isRestorable); |
63 | 72 |
64 interface Functions { | 73 interface Functions { |
65 // Get the display path of a FileEntry object. The display path is based on | 74 // Get the display path of a FileEntry object. The display path is based on |
66 // the full path of the file on the local file system, but may be made more | 75 // the full path of the file on the local file system, but may be made more |
67 // readable for display purposes. | 76 // readable for display purposes. |
68 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, | 77 static void getDisplayPath([instanceOf=FileEntry] object fileEntry, |
69 GetDisplayPathCallback callback); | 78 GetDisplayPathCallback callback); |
70 | 79 |
71 // Get a writable FileEntry from another FileEntry. This call will fail if | 80 // Get a writable FileEntry from another FileEntry. This call will fail if |
72 // the application does not have the 'write' permission under 'fileSystem'. | 81 // the application does not have the 'write' permission under 'fileSystem'. |
73 static void getWritableEntry([instanceOf=FileEntry] object fileEntry, | 82 static void getWritableEntry([instanceOf=FileEntry] object fileEntry, |
74 FileEntryCallback callback); | 83 FileEntryCallback callback); |
75 | 84 |
76 // Gets whether this FileEntry is writable or not. | 85 // Gets whether this FileEntry is writable or not. |
77 static void isWritableEntry([instanceOf=FileEntry] object fileEntry, | 86 static void isWritableEntry([instanceOf=FileEntry] object fileEntry, |
78 IsWritableCallback callback); | 87 IsWritableCallback callback); |
79 | 88 |
80 // Ask the user to choose a file. | 89 // Ask the user to choose a file. |
81 static void chooseEntry(optional ChooseEntryOptions options, | 90 static void chooseEntry(optional ChooseEntryOptions options, |
82 FileEntryCallback callback); | 91 FileEntriesCallback callback); |
83 | 92 |
84 // Returns the file entry with the given id if it can be restored. This call | 93 // Returns the file entry with the given id if it can be restored. This call |
85 // will fail otherwise. | 94 // will fail otherwise. |
86 static void restoreEntry(DOMString id, FileEntryCallback callback); | 95 static void restoreEntry(DOMString id, FileEntryCallback callback); |
87 | 96 |
88 // Returns whether a file entry for the given id can be restored, i.e. | 97 // Returns whether a file entry for the given id can be restored, i.e. |
89 // whether restoreEntry would succeed with this id now. | 98 // whether restoreEntry would succeed with this id now. |
90 static void isRestorable(DOMString id, IsRestorableCallback callback); | 99 static void isRestorable(DOMString id, IsRestorableCallback callback); |
91 | 100 |
92 // Returns an id that can be passed to restoreEntry to regain access to a | 101 // Returns an id that can be passed to restoreEntry to regain access to a |
93 // given file entry. Only the 500 most recently used entries are retained, | 102 // given file entry. Only the 500 most recently used entries are retained, |
94 // where calls to retainEntry and restoreEntry count as use. If the app has | 103 // where calls to retainEntry and restoreEntry count as use. If the app has |
95 // the 'retainEntries' permission under 'fileSystem', entries are retained | 104 // the 'retainEntries' permission under 'fileSystem', entries are retained |
96 // indefinitely. Otherwise, entries are retained only while the app is | 105 // indefinitely. Otherwise, entries are retained only while the app is |
97 // running and across restarts. | 106 // running and across restarts. |
98 static DOMString retainEntry([instanceOf=FileEntry] object fileEntry); | 107 static DOMString retainEntry([instanceOf=FileEntry] object fileEntry); |
99 }; | 108 }; |
100 }; | 109 }; |
OLD | NEW |