Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 NOT_A_DIRECTORY, | 22 NOT_A_DIRECTORY, |
| 23 INVALID_OPERATION, | 23 INVALID_OPERATION, |
| 24 SECURITY, | 24 SECURITY, |
| 25 ABORT, | 25 ABORT, |
| 26 NOT_A_FILE, | 26 NOT_A_FILE, |
| 27 NOT_EMPTY, | 27 NOT_EMPTY, |
| 28 INVALID_URL, | 28 INVALID_URL, |
| 29 IO | 29 IO |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Represents metadata of a file or a directory. | |
| 33 dictionary EntryMetadata { | |
| 34 // True if it is a directory. | |
| 35 boolean isDirectory; | |
| 36 | |
| 37 // Name of this entry (not full path name). | |
| 38 DOMString name; | |
| 39 | |
| 40 // File size in bytes. | |
| 41 double size; | |
| 42 | |
| 43 // The last modified time of this entry. | |
| 44 [instanceOf=Date] object modificationTime; | |
| 45 }; | |
| 46 | |
| 32 // Callback to receive the result of mount() function. | 47 // Callback to receive the result of mount() function. |
| 33 // <code>fileSystemID</code> will be a unique ID for the file system just | 48 // <code>fileSystemID</code> will be a unique ID for the file system just |
| 34 // mounted. The ID is used to distinguish multiple file systems mounted | 49 // mounted. The ID is used to distinguish multiple file systems mounted |
| 35 // from a single File System Provider. | 50 // from a single File System Provider. |
| 36 callback MountCallback = void(long fileSystemId, | 51 callback MountCallback = void(long fileSystemId, |
| 37 [nodoc, instanceOf=DOMError] object error); | 52 [nodoc, instanceOf=DOMError] object error); |
| 38 | 53 |
| 39 | 54 |
| 40 // Callback to receive the result of unmount() function with the <code> | 55 // Callback to receive the result of unmount() function with the <code> |
| 41 // fileSystemId</code> identifier. | 56 // fileSystemId</code> identifier. |
| 42 callback UnmountCallback = void(long fileSystemId, | 57 callback UnmountCallback = void(long fileSystemId, |
| 43 [nodoc, instanceOf=DOMError] object error); | 58 [nodoc, instanceOf=DOMError] object error); |
| 44 | 59 |
| 45 // Callback to be called by the providing extension in case of a success. | 60 // Callback to be called by the providing extension in case of a success. |
| 46 callback ProviderSuccessCallback = void(); | 61 callback ProviderSuccessCallback = void(); |
| 47 | 62 |
| 48 // Callback to be called by the providing extension in case of an error. | 63 // Callback to be called by the providing extension in case of an error. |
| 49 callback ProviderErrorCallback = void(ProviderError error); | 64 callback ProviderErrorCallback = void(ProviderError error); |
| 50 | 65 |
| 51 // Callback to handle an error raised from the browser. | 66 // Callback to handle an error raised from the browser. |
| 52 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); | 67 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); |
| 53 | 68 |
| 69 // Success callback for the <code>onGetMetadataRequested</code> event. | |
| 70 callback MetadataCallback = void(EntryMetadata metadata); | |
| 71 | |
| 54 interface Functions { | 72 interface Functions { |
| 55 // Mounts a file system with the given <code>displayName</code>. | 73 // Mounts a file system with the given <code>displayName</code>. |
| 56 // <code>displayName</code> will be shown in the left panel of | 74 // <code>displayName</code> will be shown in the left panel of |
| 57 // Files.app. <code>displayName</code> can contain any characters | 75 // Files.app. <code>displayName</code> can contain any characters |
| 58 // including '/', but cannot be an empty string. <code>displayName</code> | 76 // including '/', but cannot be an empty string. <code>displayName</code> |
| 59 // should be descriptive but doesn't have to be unique. Duplicate display | 77 // should be descriptive but doesn't have to be unique. Duplicate display |
| 60 // names are uniquified by adding suffix like "(1)" in the Files.app UI. | 78 // names are uniquified by adding suffix like "(1)" in the Files.app UI. |
| 61 static void mount(DOMString displayName, | 79 static void mount(DOMString displayName, |
| 62 MountCallback successCallback, | 80 MountCallback successCallback, |
| 63 [nocompile] ErrorCallback errorCallback); | 81 [nocompile] ErrorCallback errorCallback); |
| 64 | 82 |
| 65 // Unmounts a file system with the given <code>fileSystemId</code>. It | 83 // Unmounts a file system with the given <code>fileSystemId</code>. It |
| 66 // should be called after <code>onUnmountRequested</code> is invoked. Also, | 84 // should be called after <code>onUnmountRequested</code> is invoked. Also, |
| 67 // the providing extension can decide to perform unmounting if not requested | 85 // the providing extension can decide to perform unmounting if not requested |
| 68 // (eg. in case of lost connection, or a file error). If there is no file | 86 // (eg. in case of lost connection, or a file error). If there is no file |
| 69 // system with the requested id, or unmounting fails, then the | 87 // system with the requested id, or unmounting fails, then the |
| 70 // <code>errorCallback</code> will be called. | 88 // <code>errorCallback</code> will be called. |
| 71 static void unmount(long fileSystemId, | 89 static void unmount(long fileSystemId, |
| 72 UnmountCallback successCallback, | 90 UnmountCallback successCallback, |
| 73 [nocompile] ErrorCallback errorCallback); | 91 [nocompile] ErrorCallback errorCallback); |
| 74 }; | 92 }; |
| 75 | 93 |
| 76 interface Events { | 94 interface Events { |
| 77 // Raised, when the user requests unmounting of the file system with the | 95 // Raised when unmounting for the file system with the <code>fileSystemId |
| 78 // <code>fileSystemId</code> identifier in the Files.app UI. In response, | 96 // </code> identifier is requested. In response, the <code>unmount</code> |
| 79 // the <code>unmount</code> API method should be called. If unmounting is | 97 // API method should be called together with <code>successCallback</code>. |
| 80 // not possible (eg. due to pending operation), then <code>errorCallback | 98 // If unmounting is not possible (eg. due to a pending operation), then |
| 81 // </code> should be called, and <code>unmount</code> should not be called. | 99 // <code>errorCallback</code> must be called. |
| 82 [maxListeners=1] static void onUnmountRequested( | 100 [maxListeners=1] static void onUnmountRequested( |
| 83 long fileSystemId, | 101 long fileSystemId, |
| 84 ProviderSuccessCallback successCallback, | 102 ProviderSuccessCallback successCallback, |
| 85 ProviderErrorCallback errorCallback); | 103 ProviderErrorCallback errorCallback); |
| 104 | |
| 105 // Raised, when metada of a file or a directory at <code>entryPath</code> | |
|
benwells
2014/05/01 04:16:25
Nit: metada?
mtomasz
2014/05/01 05:09:07
Oops. Done.
| |
| 106 // is requested. The metadata should be returned with the <code> | |
| 107 // successCallback</code> call. In case of an error, <code>errorCallback | |
| 108 // </code> must be called. | |
| 109 [maxListeners=1] static void onGetMetadataRequested( | |
| 110 long fileSystemId, | |
| 111 DOMString entryPath, | |
| 112 MetadataCallback successCallback, | |
| 113 ErrorCallback errorCallback); | |
| 86 }; | 114 }; |
| 87 }; | 115 }; |
| 88 | 116 |
| OLD | NEW |