diff options
author | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 11:17:24 +0000 |
---|---|---|
committer | mtomasz@chromium.org <mtomasz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-16 11:17:24 +0000 |
commit | 60dfffbd9285a14b932310697315a85589b1321f (patch) | |
tree | ec38777f725453442c3846e0dc5d7471374c258f /chrome/common | |
parent | 92549ad6da5ce375d1939140cea70d8dea1d40b3 (diff) | |
download | chromium_src-60dfffbd9285a14b932310697315a85589b1321f.zip chromium_src-60dfffbd9285a14b932310697315a85589b1321f.tar.gz chromium_src-60dfffbd9285a14b932310697315a85589b1321f.tar.bz2 |
[fsp] First part of support for reading files.
This patch adds the read file operation, which is however not bound yet to
fileapi.
In the upcoming patch, support for FileStreamReader will be added. After that,
OpenFile, CloseFile and ReadFile will be bound to async file utils.
TEST=unit_tests: *FileSystemProvider*ReadFile*
BUG=248427
Review URL: https://codereview.chromium.org/287673004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270985 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/extensions/api/file_system_provider.idl | 24 | ||||
-rw-r--r-- | chrome/common/extensions/api/file_system_provider_internal.idl | 15 |
2 files changed, 36 insertions, 3 deletions
diff --git a/chrome/common/extensions/api/file_system_provider.idl b/chrome/common/extensions/api/file_system_provider.idl index cadaccb..8b02cff 100644 --- a/chrome/common/extensions/api/file_system_provider.idl +++ b/chrome/common/extensions/api/file_system_provider.idl @@ -75,12 +75,18 @@ namespace fileSystemProvider { // Success callback for the <code>onGetMetadataRequested</code> event. callback MetadataCallback = void(EntryMetadata metadata); - // Success callback for the <code>onDirectoryRequested</code> event. If more - // entries will be returned, then <code>hasNext</code> must be true, and it - // has to be called again with additional entries. If no more entries are + // Success callback for the <code>onReadDirectoryRequested</code> event. If + // more entries will be returned, then <code>hasNext</code> must be true, and + // it has to be called again with additional entries. If no more entries are // available, then <code>hasNext</code> must be set to false. callback EntriesCallback = void(ResourceEntry[] entries, bool hasNext); + // Success callback for the <code>onReadFileRequested</code> event. If more + // data will be returned, then <code>hasNext</code> must be true, and it + // has to be called again with additional entries. If no more data is + // available, then <code>hasNext</code> must be set to false. + callback FileDataCallback = void(DOMString data, bool hasNext); + interface Functions { // Mounts a file system with the given <code>displayName</code>. // <code>displayName</code> will be shown in the left panel of @@ -152,6 +158,18 @@ namespace fileSystemProvider { long openRequestId, ProviderSuccessCallback successCallback, ProviderErrorCallback errorCallback); + + // Raised when contents of a file opened previously with <code>openRequestId + // </code>. The results should be returned in chunks by calling <code> + // successCallback</code> several times. In case of an error, <code> + // errorCallback</code> must be called. + [maxListeners=1] static void onReadFileRequested( + long fileSystemId, + long openRequestId, + double offset, + double length, + FileDataCallback successCallback, + ProviderErrorCallback errorCallback); }; }; diff --git a/chrome/common/extensions/api/file_system_provider_internal.idl b/chrome/common/extensions/api/file_system_provider_internal.idl index 582bc7d..f63cc0e 100644 --- a/chrome/common/extensions/api/file_system_provider_internal.idl +++ b/chrome/common/extensions/api/file_system_provider_internal.idl @@ -74,6 +74,21 @@ namespace fileSystemProviderInternal { long fileSystemId, long requestId, fileSystemProvider.ProviderError error); + + // Internal. Success callback of the <code>onReadFileRequested</code> + // event. Can be called multiple times per request. + static void readFileRequestedSuccess( + long fileSystemId, + long requestId, + DOMString data, + boolean hasNext); + + // Internal. Error callback of the <code>onReadFileRequested</code> + // event. Must be called when reading a file fails. + static void readFileRequestedError( + long fileSystemId, + long requestId, + fileSystemProvider.ProviderError error); }; }; |