Chromium Code Reviews| 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 dictionary RequestFileSystemOptions { | 86 [nodoc] dictionary RequestFileSystemOptions { |
| 87 // The ID of the requested volume. | 87 // The ID of the requested volume. |
| 88 DOMString volumeId; | 88 DOMString volumeId; |
| 89 | 89 |
| 90 // Whether the requested file system should be writeable, or read-only. | 90 // Whether the requested file system should be writeable, or read-only. |
| 91 // By default read-only. | 91 // By default read-only. |
| 92 boolean? writable; | 92 boolean? writable; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 // Change to an entry within a tracked directory. | 95 // Represents a mounted volume, which can be accessed via <code>chrome. |
| 96 // fileSystem.requestFileSystem</code>. | |
| 97 [nodoc] dictionary Volume { | |
| 98 DOMString volumeId; | |
| 99 boolean writable; | |
| 100 }; | |
| 101 | |
| 102 // Change to an entry within a tracked directory. | |
| 96 [nodoc] dictionary ChildChange { | 103 [nodoc] dictionary ChildChange { |
| 97 [instanceOf=Entry] object entry; | 104 [instanceOf=Entry] object entry; |
| 98 ChildChangeType type; | 105 ChildChangeType type; |
| 99 }; | 106 }; |
| 100 | 107 |
| 101 // Event notifying about a change in a file or a directory, including its | 108 // Event notifying about a change in a file or a directory, including its |
| 102 // contents. | 109 // contents. |
| 103 [nodoc] dictionary EntryChangedEvent { | 110 [nodoc] dictionary EntryChangedEvent { |
| 104 // Tracked entry. | 111 // Tracked entry. |
| 105 [instanceOf=Entry] object target; | 112 [instanceOf=Entry] object target; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 118 callback EntryCallback = void ([instanceOf=Entry] object entry); | 125 callback EntryCallback = void ([instanceOf=Entry] object entry); |
| 119 callback EntriesCallback = void ( | 126 callback EntriesCallback = void ( |
| 120 [instanceOf=Entry] optional object entry, | 127 [instanceOf=Entry] optional object entry, |
| 121 [instanceOf=FileEntry] optional object[] fileEntries); | 128 [instanceOf=FileEntry] optional object[] fileEntries); |
| 122 callback IsWritableCallback = void (boolean isWritable); | 129 callback IsWritableCallback = void (boolean isWritable); |
| 123 callback IsRestorableCallback = void (boolean isRestorable); | 130 callback IsRestorableCallback = void (boolean isRestorable); |
| 124 [nodoc] callback GetObservedEntriesCallback = void ( | 131 [nodoc] callback GetObservedEntriesCallback = void ( |
| 125 [instanceOf=Entry] object[] entries); | 132 [instanceOf=Entry] object[] entries); |
| 126 [nodoc] callback RequestFileSystemCallback = void( | 133 [nodoc] callback RequestFileSystemCallback = void( |
| 127 [instanceOf=FileSystem] optional object fileSystem); | 134 [instanceOf=FileSystem] optional object fileSystem); |
| 135 [nodoc] callback GetVolumeListCallback = void(optional Volume[] volumes); | |
|
benwells
2015/04/07 05:43:13
Nit: should this be optional? I think if the call
mtomasz
2015/04/07 07:35:35
Good point. Done.
| |
| 128 | 136 |
| 129 interface Functions { | 137 interface Functions { |
| 130 // Get the display path of an Entry object. The display path is based on | 138 // Get the display path of an Entry object. The display path is based on |
| 131 // the full path of the file or directory on the local file system, but may | 139 // the full path of the file or directory on the local file system, but may |
| 132 // be made more readable for display purposes. | 140 // be made more readable for display purposes. |
| 133 static void getDisplayPath([instanceOf=Entry] object entry, | 141 static void getDisplayPath([instanceOf=Entry] object entry, |
| 134 GetDisplayPathCallback callback); | 142 GetDisplayPathCallback callback); |
| 135 | 143 |
| 136 // Get a writable Entry from another Entry. This call will fail with a | 144 // Get a writable Entry from another Entry. This call will fail with a |
| 137 // runtime error if the application does not have the 'write' permission | 145 // runtime error if the application does not have the 'write' permission |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 168 // Requests access to a file system for a volume represented by <code> | 176 // 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, | 177 // 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. | 178 // then the file system will be writable. Otherwise, it will be read-only. |
| 171 // The <code>writable</code> option requires the <code> | 179 // The <code>writable</code> option requires the <code> |
| 172 // "fileSystem": {"write"}</code> permission in the manifest. Available to | 180 // "fileSystem": {"write"}</code> permission in the manifest. Available to |
| 173 // kiosk apps running in kiosk session only. For manual-launch kiosk mode, a | 181 // kiosk apps running in kiosk session only. For manual-launch kiosk mode, a |
| 174 // confirmation dialog will be shown on top of the active app window. | 182 // confirmation dialog will be shown on top of the active app window. |
| 175 [nodoc] static void requestFileSystem(RequestFileSystemOptions options, | 183 [nodoc] static void requestFileSystem(RequestFileSystemOptions options, |
| 176 RequestFileSystemCallback callback); | 184 RequestFileSystemCallback callback); |
| 177 | 185 |
| 186 // Returns a list of volumes available for <code>requestFileSystem()</code>. | |
| 187 // The <code>"fileSystem": {"requestFileSystem"}</code> manifest permission | |
| 188 // is required. permission in the manifest. Available to kiosk apps running | |
|
benwells
2015/04/07 05:43:13
Nit: I think you want to delete ' permission in th
mtomasz
2015/04/07 07:35:35
Done.
| |
| 189 // in the kiosk session only. | |
| 190 [nodoc] static void getVolumeList(GetVolumeListCallback callback); | |
| 191 | |
| 178 // Observes a directory entry. Emits an event if the tracked directory is | 192 // Observes a directory entry. Emits an event if the tracked directory is |
| 179 // changed (including the list of files on it), or removed. If <code> | 193 // changed (including the list of files on it), or removed. If <code> |
| 180 // recursive</code> is set to true, then also all accessible subdirectories | 194 // recursive</code> is set to true, then also all accessible subdirectories |
| 181 // will be tracked. Observers are automatically removed once the extension | 195 // will be tracked. Observers are automatically removed once the extension |
| 182 // is closed or suspended, unless <code>entry</code> is retained using | 196 // is closed or suspended, unless <code>entry</code> is retained using |
| 183 // <code>chrome.fileSystem.retainEntry</code>. | 197 // <code>chrome.fileSystem.retainEntry</code>. |
| 184 // | 198 // |
| 185 // In such case of retained entries, the observer stays active across | 199 // In such case of retained entries, the observer stays active across |
| 186 // restarts until <code>unobserveEntry</code> is explicitly called. Note, | 200 // restarts until <code>unobserveEntry</code> is explicitly called. Note, |
| 187 // that once the <code>entry</code> is not retained anymore, the observer | 201 // that once the <code>entry</code> is not retained anymore, the observer |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 200 }; | 214 }; |
| 201 | 215 |
| 202 interface Events { | 216 interface Events { |
| 203 // Called when an observed entry is changed. | 217 // Called when an observed entry is changed. |
| 204 [nodoc] static void onEntryChanged(EntryChangedEvent event); | 218 [nodoc] static void onEntryChanged(EntryChangedEvent event); |
| 205 | 219 |
| 206 // Called when an observed entry is removed. | 220 // Called when an observed entry is removed. |
| 207 [nodoc] static void onEntryRemoved(EntryRemovedEvent event); | 221 [nodoc] static void onEntryRemoved(EntryRemovedEvent event); |
| 208 }; | 222 }; |
| 209 }; | 223 }; |
| OLD | NEW |