Index: chrome/common/extensions/api/extfs.idl |
diff --git a/chrome/common/extensions/api/extfs.idl b/chrome/common/extensions/api/extfs.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1d6ef838cd14f0fd16c4e4a3c0eeeb8782baf44b |
--- /dev/null |
+++ b/chrome/common/extensions/api/extfs.idl |
@@ -0,0 +1,99 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// TODO(satorux): Rename 'extfs' to something else. |
+namespace extfs { |
+ // Represents metadata of a file or a directory |
+ dictionary Entry { |
+ // True if this is a directory. |
+ boolean isDirectory; |
+ // Name of this entry (not full path name). |
+ DOMString name; |
+ // File size. Conceptually, it should be long long. |
+ double size; |
+ // The last modified time of this entry. |
+ [instanceOf=Date] object modificationTime; |
+ }; |
+ |
+ // Mirrors PlatformFileError in base/platform_file.h |
+ // TODO(satorux): Shoud we use WebKit/Source/core/fileapi/FileError.h |
+ // instead? |
+ enum FileError { |
+ OK, |
+ ERROR_FAILED, |
+ ERROR_IN_USE, |
+ ERROR_EXISTS, |
+ ERROR_NOT_FOUND, |
+ ERROR_ACCESS_DENIED, |
+ ERROR_TOO_MANY_OPENED, |
+ ERROR_NO_MEMORY, |
+ ERROR_NO_SPACE, |
+ ERROR_NOT_A_DIRECTORY, |
+ ERROR_INVALID_OPERATION, |
+ ERROR_SECURITY, |
+ ERROR_ABORT, |
+ ERROR_NOT_A_FILE, |
+ ERROR_NOT_EMPTY, |
+ ERROR_INVALID_URL, |
+ ERROR_IO, |
+ ERROR_MAX |
+ }; |
+ |
+ // Callback to report an error code to the browser. |
+ callback FileErrorCallback = void (FileError errorCode); |
+ |
+ // Callback to return an entry to the browser. |
+ callback EntryCallback = void(FileError errorCode, Entry entry); |
+ |
+ // Callback to return entries to the browser. |
+ callback EntriesCallback = void(FileError errorCode, Entry[] entry); |
+ |
+ // Callback to return a blob to the browser. |
+ callback SnapshotCallback = void(FileError errorCode, |
+ [instanceOf=Blob] object blob); |
+ |
+ interface Functions { |
+ // Adds a mount point named mountPoint. |
+ static void addMountPoint(DOMString mountPoint, |
+ FileErrorCallback callback); |
+ |
+ // The followings are only used from custom bindings. |requestId| is |
+ // handled inside the custom bindings hence event listeners don't see it. |
+ // TODO(satorux): Should be moved to 'internal'. |
+ static void returnEntry(long requestId, |
+ FileError errorCode, |
+ Entry entry); |
+ static void returnEntries(long requestId, |
+ FileError errorCode, |
+ Entry[] entries); |
+ static void returnSnapshot(long requestId, |
+ FileError errorCode, |
+ [instanceOf=Blob] object blob); |
+ }; |
+ |
+ interface Events { |
+ // Raised when an entry for a file or a directory at |path| is requested. |
+ // The listener is responsible for returning the entry via |callback| |
+ [maxListeners=1] static void onEntryRequested( |
+ DOMString path, |
+ EntryCallback callback); |
+ |
+ // Raised when directory entries of a directory at |path| is requested. |
+ // The listener is responsible for returning the entries via |callback| |
+ [maxListeners=1] static void onDirectoryEntriesRequested( |
+ DOMString path, |
+ EntriesCallback callback); |
+ |
+ // Raised when a snapshot of a file at |path| is requested. |
+ // The listener is responsible for returning the snapshot via |callback| |
+ [maxListeners=1] static void onSnapshotRequested( |
+ DOMString path, |
+ SnapshotCallback callback); |
+ |
+ // Raised when unmounting of |mountPoint| is requested. |
+ [maxListeners=1] static void onUnmountingRequested( |
+ DOMString mountPoint, |
+ SnapshotCallback callback); |
+ }; |
+}; |