OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.fileSystemProvider</code> API to create file systems, | 5 // Use the <code>chrome.fileSystemProvider</code> API to create file systems, |
6 // that can be accessible from the file manager on Chrome OS. | 6 // that can be accessible from the file manager on Chrome OS. |
7 [platforms=("chromeos"), | 7 [platforms=("chromeos"), |
8 implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy
stem_provider_api.h"] | 8 implemented_in="chrome/browser/chromeos/extensions/file_system_provider/file_sy
stem_provider_api.h"] |
9 namespace fileSystemProvider { | 9 namespace fileSystemProvider { |
10 // Error codes used by providing extensions in response to requests. For | 10 // Error codes used by providing extensions in response to requests. For |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // Callback to be called by the providing extension in case of an error. | 69 // Callback to be called by the providing extension in case of an error. |
70 callback ProviderErrorCallback = void(ProviderError error); | 70 callback ProviderErrorCallback = void(ProviderError error); |
71 | 71 |
72 // Callback to handle an error raised from the browser. | 72 // Callback to handle an error raised from the browser. |
73 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); | 73 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); |
74 | 74 |
75 // Success callback for the <code>onGetMetadataRequested</code> event. | 75 // Success callback for the <code>onGetMetadataRequested</code> event. |
76 callback MetadataCallback = void(EntryMetadata metadata); | 76 callback MetadataCallback = void(EntryMetadata metadata); |
77 | 77 |
78 // Success callback for the <code>onDirectoryRequested</code> event. If more | 78 // Success callback for the <code>onReadDirectoryRequested</code> event. If |
79 // entries will be returned, then <code>hasNext</code> must be true, and it | 79 // more entries will be returned, then <code>hasNext</code> must be true, and |
80 // has to be called again with additional entries. If no more entries are | 80 // it has to be called again with additional entries. If no more entries are |
81 // available, then <code>hasNext</code> must be set to false. | 81 // available, then <code>hasNext</code> must be set to false. |
82 callback EntriesCallback = void(ResourceEntry[] entries, bool hasNext); | 82 callback EntriesCallback = void(ResourceEntry[] entries, bool hasNext); |
83 | 83 |
| 84 // Success callback for the <code>onReadFileRequested</code> event. If more |
| 85 // data will be returned, then <code>hasNext</code> must be true, and it |
| 86 // has to be called again with additional entries. If no more data is |
| 87 // available, then <code>hasNext</code> must be set to false. |
| 88 callback FileDataCallback = void(DOMString data, bool hasNext); |
| 89 |
84 interface Functions { | 90 interface Functions { |
85 // Mounts a file system with the given <code>displayName</code>. | 91 // Mounts a file system with the given <code>displayName</code>. |
86 // <code>displayName</code> will be shown in the left panel of | 92 // <code>displayName</code> will be shown in the left panel of |
87 // Files.app. <code>displayName</code> can contain any characters | 93 // Files.app. <code>displayName</code> can contain any characters |
88 // including '/', but cannot be an empty string. <code>displayName</code> | 94 // including '/', but cannot be an empty string. <code>displayName</code> |
89 // should be descriptive but doesn't have to be unique. Duplicate display | 95 // should be descriptive but doesn't have to be unique. Duplicate display |
90 // names are uniquified by adding suffix like "(1)" in the Files.app UI. | 96 // names are uniquified by adding suffix like "(1)" in the Files.app UI. |
91 static void mount(DOMString displayName, | 97 static void mount(DOMString displayName, |
92 MountCallback successCallback, | 98 MountCallback successCallback, |
93 [nocompile] ErrorCallback errorCallback); | 99 [nocompile] ErrorCallback errorCallback); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 ProviderSuccessCallback successCallback, | 151 ProviderSuccessCallback successCallback, |
146 ProviderErrorCallback errorCallback); | 152 ProviderErrorCallback errorCallback); |
147 | 153 |
148 // Raised when opening a file previously opened with <code>openRequestId | 154 // Raised when opening a file previously opened with <code>openRequestId |
149 // </code> is requested to be closed. | 155 // </code> is requested to be closed. |
150 [maxListeners=1] static void onCloseFileRequested( | 156 [maxListeners=1] static void onCloseFileRequested( |
151 long fileSystemId, | 157 long fileSystemId, |
152 long openRequestId, | 158 long openRequestId, |
153 ProviderSuccessCallback successCallback, | 159 ProviderSuccessCallback successCallback, |
154 ProviderErrorCallback errorCallback); | 160 ProviderErrorCallback errorCallback); |
| 161 |
| 162 // Raised when contents of a file opened previously with <code>openRequestId |
| 163 // </code>. The results should be returned in chunks by calling <code> |
| 164 // successCallback</code> several times. In case of an error, <code> |
| 165 // errorCallback</code> must be called. |
| 166 [maxListeners=1] static void onReadFileRequested( |
| 167 long fileSystemId, |
| 168 long openRequestId, |
| 169 double offset, |
| 170 double length, |
| 171 FileDataCallback successCallback, |
| 172 ProviderErrorCallback errorCallback); |
155 }; | 173 }; |
156 }; | 174 }; |
157 | 175 |
OLD | NEW |