| 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 the user's local file system. With this API, Chrome Apps can | 6 // and write to the user's local file system. With this API, Chrome Apps can |
| 7 // read and write to a user-selected location. For example, a text editor app | 7 // read and write to a user-selected location. For example, a text editor app |
| 8 // can use the API to read and write local documents. All failures are notified | 8 // can use the API to read and write local documents. All failures are notified |
| 9 // via chrome.runtime.lastError. | 9 // via chrome.runtime.lastError. |
| 10 namespace fileSystem { | 10 namespace fileSystem { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // unset or contains no valid entries, this will always be reset to true. | 76 // unset or contains no valid entries, this will always be reset to true. |
| 77 boolean? acceptsAllTypes; | 77 boolean? acceptsAllTypes; |
| 78 | 78 |
| 79 // Whether to accept multiple files. This is only supported for openFile and | 79 // Whether to accept multiple files. This is only supported for openFile and |
| 80 // openWritableFile. The callback to chooseEntry will be called with a list | 80 // openWritableFile. The callback to chooseEntry will be called with a list |
| 81 // of entries if this is set to true. Otherwise it will be called with a | 81 // of entries if this is set to true. Otherwise it will be called with a |
| 82 // single Entry. | 82 // single Entry. |
| 83 boolean? acceptsMultiple; | 83 boolean? acceptsMultiple; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 // Change to an entry within a tracked directory. | 86 dictionary RequestFileSystemOptions { |
| 87 // The ID of the requested volume. |
| 88 DOMString volumeId; |
| 89 |
| 90 // Whether the requested file system should be writeable, or read-only. |
| 91 // By default read-only. |
| 92 boolean? writable; |
| 93 }; |
| 94 |
| 95 // Change to an entry within a tracked directory. |
| 87 [nodoc] dictionary ChildChange { | 96 [nodoc] dictionary ChildChange { |
| 88 [instanceOf=Entry] object entry; | 97 [instanceOf=Entry] object entry; |
| 89 ChildChangeType type; | 98 ChildChangeType type; |
| 90 }; | 99 }; |
| 91 | 100 |
| 92 // Event notifying about a change in a file or a directory, including its | 101 // Event notifying about a change in a file or a directory, including its |
| 93 // contents. | 102 // contents. |
| 94 [nodoc] dictionary EntryChangedEvent { | 103 [nodoc] dictionary EntryChangedEvent { |
| 95 // Tracked entry. | 104 // Tracked entry. |
| 96 [instanceOf=Entry] object target; | 105 [instanceOf=Entry] object target; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 | 116 |
| 108 callback GetDisplayPathCallback = void (DOMString displayPath); | 117 callback GetDisplayPathCallback = void (DOMString displayPath); |
| 109 callback EntryCallback = void ([instanceOf=Entry] object entry); | 118 callback EntryCallback = void ([instanceOf=Entry] object entry); |
| 110 callback EntriesCallback = void ( | 119 callback EntriesCallback = void ( |
| 111 [instanceOf=Entry] optional object entry, | 120 [instanceOf=Entry] optional object entry, |
| 112 [instanceOf=FileEntry] optional object[] fileEntries); | 121 [instanceOf=FileEntry] optional object[] fileEntries); |
| 113 callback IsWritableCallback = void (boolean isWritable); | 122 callback IsWritableCallback = void (boolean isWritable); |
| 114 callback IsRestorableCallback = void (boolean isRestorable); | 123 callback IsRestorableCallback = void (boolean isRestorable); |
| 115 [nodoc] callback GetObservedEntriesCallback = void ( | 124 [nodoc] callback GetObservedEntriesCallback = void ( |
| 116 [instanceOf=Entry] object[] entries); | 125 [instanceOf=Entry] object[] entries); |
| 126 [nodoc] callback RequestFileSystemCallback = void( |
| 127 [instanceOf=FileSystem] optional object fileSystem); |
| 117 | 128 |
| 118 interface Functions { | 129 interface Functions { |
| 119 // Get the display path of an Entry object. The display path is based on | 130 // Get the display path of an Entry object. The display path is based on |
| 120 // the full path of the file or directory on the local file system, but may | 131 // the full path of the file or directory on the local file system, but may |
| 121 // be made more readable for display purposes. | 132 // be made more readable for display purposes. |
| 122 static void getDisplayPath([instanceOf=Entry] object entry, | 133 static void getDisplayPath([instanceOf=Entry] object entry, |
| 123 GetDisplayPathCallback callback); | 134 GetDisplayPathCallback callback); |
| 124 | 135 |
| 125 // Get a writable Entry from another Entry. This call will fail with a | 136 // Get a writable Entry from another Entry. This call will fail with a |
| 126 // runtime error if the application does not have the 'write' permission | 137 // runtime error if the application does not have the 'write' permission |
| (...skipping 20 matching lines...) Expand all Loading... |
| 147 static void isRestorable(DOMString id, IsRestorableCallback callback); | 158 static void isRestorable(DOMString id, IsRestorableCallback callback); |
| 148 | 159 |
| 149 // Returns an id that can be passed to restoreEntry to regain access to a | 160 // Returns an id that can be passed to restoreEntry to regain access to a |
| 150 // given file entry. Only the 500 most recently used entries are retained, | 161 // given file entry. Only the 500 most recently used entries are retained, |
| 151 // where calls to retainEntry and restoreEntry count as use. If the app has | 162 // where calls to retainEntry and restoreEntry count as use. If the app has |
| 152 // the 'retainEntries' permission under 'fileSystem', entries are retained | 163 // the 'retainEntries' permission under 'fileSystem', entries are retained |
| 153 // indefinitely. Otherwise, entries are retained only while the app is | 164 // indefinitely. Otherwise, entries are retained only while the app is |
| 154 // running and across restarts. | 165 // running and across restarts. |
| 155 static DOMString retainEntry([instanceOf=Entry] object entry); | 166 static DOMString retainEntry([instanceOf=Entry] object entry); |
| 156 | 167 |
| 168 // Requests access to a file system for a volume represented by <code> |
| 169 // options.volumeId</code>. If <code>options.writable</code> is set to true, |
| 170 // then the file system will be writable. Otherwise, it will be read-only. |
| 171 // The <code>writable</code> option requires the <code> |
| 172 // "fileSystem": {"write"}</code> permission in the manifest. Available to |
| 173 // kiosk apps running in kiosk session only. |
| 174 [nodoc] static void requestFileSystem(RequestFileSystemOptions options, |
| 175 RequestFileSystemCallback callback); |
| 176 |
| 157 // Observes a directory entry. Emits an event if the tracked directory is | 177 // Observes a directory entry. Emits an event if the tracked directory is |
| 158 // changed (including the list of files on it), or removed. If <code> | 178 // changed (including the list of files on it), or removed. If <code> |
| 159 // recursive</code> is set to true, then also all accessible subdirectories | 179 // recursive</code> is set to true, then also all accessible subdirectories |
| 160 // will be tracked. Observers are automatically removed once the extension | 180 // will be tracked. Observers are automatically removed once the extension |
| 161 // is closed or suspended, unless <code>entry</code> is retained using | 181 // is closed or suspended, unless <code>entry</code> is retained using |
| 162 // <code>chrome.fileSystem.retainEntry</code>. | 182 // <code>chrome.fileSystem.retainEntry</code>. |
| 163 // | 183 // |
| 164 // In such case of retained entries, the observer stays active across | 184 // In such case of retained entries, the observer stays active across |
| 165 // restarts until <code>unobserveEntry</code> is explicitly called. Note, | 185 // restarts until <code>unobserveEntry</code> is explicitly called. Note, |
| 166 // that once the <code>entry</code> is not retained anymore, the observer | 186 // that once the <code>entry</code> is not retained anymore, the observer |
| (...skipping 12 matching lines...) Expand all Loading... |
| 179 }; | 199 }; |
| 180 | 200 |
| 181 interface Events { | 201 interface Events { |
| 182 // Called when an observed entry is changed. | 202 // Called when an observed entry is changed. |
| 183 [nodoc] static void onEntryChanged(EntryChangedEvent event); | 203 [nodoc] static void onEntryChanged(EntryChangedEvent event); |
| 184 | 204 |
| 185 // Called when an observed entry is removed. | 205 // Called when an observed entry is removed. |
| 186 [nodoc] static void onEntryRemoved(EntryRemovedEvent event); | 206 [nodoc] static void onEntryRemoved(EntryRemovedEvent event); |
| 187 }; | 207 }; |
| 188 }; | 208 }; |
| OLD | NEW |