OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // TODO(satorux): Rename 'extfs' to something else. |
| 6 namespace extfs { |
| 7 // Represents metadata of a file or a directory |
| 8 dictionary Entry { |
| 9 // True if this is a directory. |
| 10 boolean isDirectory; |
| 11 // Name of this entry (not full path name). |
| 12 DOMString name; |
| 13 // File size. Conceptually, it should be long long. |
| 14 double size; |
| 15 // The last modified time of this entry. |
| 16 [instanceOf=Date] object modificationTime; |
| 17 }; |
| 18 |
| 19 // Mirrors PlatformFileError in base/platform_file.h |
| 20 // TODO(satorux): Shoud we use WebKit/Source/core/fileapi/FileError.h |
| 21 // instead? |
| 22 enum FileError { |
| 23 OK, |
| 24 ERROR_FAILED, |
| 25 ERROR_IN_USE, |
| 26 ERROR_EXISTS, |
| 27 ERROR_NOT_FOUND, |
| 28 ERROR_ACCESS_DENIED, |
| 29 ERROR_TOO_MANY_OPENED, |
| 30 ERROR_NO_MEMORY, |
| 31 ERROR_NO_SPACE, |
| 32 ERROR_NOT_A_DIRECTORY, |
| 33 ERROR_INVALID_OPERATION, |
| 34 ERROR_SECURITY, |
| 35 ERROR_ABORT, |
| 36 ERROR_NOT_A_FILE, |
| 37 ERROR_NOT_EMPTY, |
| 38 ERROR_INVALID_URL, |
| 39 ERROR_IO, |
| 40 ERROR_MAX |
| 41 }; |
| 42 |
| 43 // Callback to report an error code to the browser. |
| 44 callback FileErrorCallback = void (FileError errorCode); |
| 45 |
| 46 // Callback to return an entry to the browser. |
| 47 callback EntryCallback = void(FileError errorCode, Entry entry); |
| 48 |
| 49 // Callback to return entries to the browser. |
| 50 callback EntriesCallback = void(FileError errorCode, Entry[] entry); |
| 51 |
| 52 // Callback to return a blob to the browser. |
| 53 callback SnapshotCallback = void(FileError errorCode, |
| 54 [instanceOf=Blob] object blob); |
| 55 |
| 56 interface Functions { |
| 57 // Adds a mount point named mountPoint. |
| 58 static void addMountPoint(DOMString mountPoint, |
| 59 FileErrorCallback callback); |
| 60 |
| 61 // The followings are only used from custom bindings. |requestId| is |
| 62 // handled inside the custom bindings hence event listeners don't see it. |
| 63 // TODO(satorux): Should be moved to 'internal'. |
| 64 static void returnEntry(long requestId, |
| 65 FileError errorCode, |
| 66 Entry entry); |
| 67 static void returnEntries(long requestId, |
| 68 FileError errorCode, |
| 69 Entry[] entries); |
| 70 static void returnSnapshot(long requestId, |
| 71 FileError errorCode, |
| 72 [instanceOf=Blob] object blob); |
| 73 }; |
| 74 |
| 75 interface Events { |
| 76 // Raised when an entry for a file or a directory at |path| is requested. |
| 77 // The listener is responsible for returning the entry via |callback| |
| 78 [maxListeners=1] static void onEntryRequested( |
| 79 DOMString path, |
| 80 EntryCallback callback); |
| 81 |
| 82 // Raised when directory entries of a directory at |path| is requested. |
| 83 // The listener is responsible for returning the entries via |callback| |
| 84 [maxListeners=1] static void onDirectoryEntriesRequested( |
| 85 DOMString path, |
| 86 EntriesCallback callback); |
| 87 |
| 88 // Raised when a snapshot of a file at |path| is requested. |
| 89 // The listener is responsible for returning the snapshot via |callback| |
| 90 [maxListeners=1] static void onSnapshotRequested( |
| 91 DOMString path, |
| 92 SnapshotCallback callback); |
| 93 |
| 94 // Raised when unmounting of |mountPoint| is requested. |
| 95 [maxListeners=1] static void onUnmountingRequested( |
| 96 DOMString mountPoint, |
| 97 SnapshotCallback callback); |
| 98 }; |
| 99 }; |
OLD | NEW |