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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // 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. |
64 callback ProviderErrorCallback = void(ProviderError error); | 64 callback ProviderErrorCallback = void(ProviderError error); |
65 | 65 |
66 // Callback to handle an error raised from the browser. | 66 // Callback to handle an error raised from the browser. |
67 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); | 67 [nocompile] callback ErrorCallback = void([instanceOf=DOMError] object error); |
68 | 68 |
69 // Success callback for the <code>onGetMetadataRequested</code> event. | 69 // Success callback for the <code>onGetMetadataRequested</code> event. |
70 callback MetadataCallback = void(EntryMetadata metadata); | 70 callback MetadataCallback = void(EntryMetadata metadata); |
71 | 71 |
| 72 // Success callback for the <code>onDirectoryRequested</code> event. If more |
| 73 // entries will be returned, then <code>hasNext</code> must be true, and it |
| 74 // has to be called again with additional entries. If no more entries are |
| 75 // available, then <code>hasNext</code> must be set to false. |
| 76 callback EntriesCallback = void(ResourceEntry[] entries, bool hasNext); |
| 77 |
72 interface Functions { | 78 interface Functions { |
73 // Mounts a file system with the given <code>displayName</code>. | 79 // Mounts a file system with the given <code>displayName</code>. |
74 // <code>displayName</code> will be shown in the left panel of | 80 // <code>displayName</code> will be shown in the left panel of |
75 // Files.app. <code>displayName</code> can contain any characters | 81 // Files.app. <code>displayName</code> can contain any characters |
76 // including '/', but cannot be an empty string. <code>displayName</code> | 82 // including '/', but cannot be an empty string. <code>displayName</code> |
77 // should be descriptive but doesn't have to be unique. Duplicate display | 83 // should be descriptive but doesn't have to be unique. Duplicate display |
78 // names are uniquified by adding suffix like "(1)" in the Files.app UI. | 84 // names are uniquified by adding suffix like "(1)" in the Files.app UI. |
79 static void mount(DOMString displayName, | 85 static void mount(DOMString displayName, |
80 MountCallback successCallback, | 86 MountCallback successCallback, |
81 [nocompile] ErrorCallback errorCallback); | 87 [nocompile] ErrorCallback errorCallback); |
82 | 88 |
83 // Unmounts a file system with the given <code>fileSystemId</code>. It | 89 // Unmounts a file system with the given <code>fileSystemId</code>. It |
84 // should be called after <code>onUnmountRequested</code> is invoked. Also, | 90 // should be called after <code>onUnmountRequested</code> is invoked. Also, |
85 // the providing extension can decide to perform unmounting if not requested | 91 // the providing extension can decide to perform unmounting if not requested |
86 // (eg. in case of lost connection, or a file error). If there is no file | 92 // (eg. in case of lost connection, or a file error). If there is no file |
87 // system with the requested id, or unmounting fails, then the | 93 // system with the requested id, or unmounting fails, then the |
88 // <code>errorCallback</code> will be called. | 94 // <code>errorCallback</code> must be called. |
89 static void unmount(long fileSystemId, | 95 static void unmount(long fileSystemId, |
90 UnmountCallback successCallback, | 96 UnmountCallback successCallback, |
91 [nocompile] ErrorCallback errorCallback); | 97 [nocompile] ErrorCallback errorCallback); |
92 }; | 98 }; |
93 | 99 |
94 interface Events { | 100 interface Events { |
95 // Raised when unmounting for the file system with the <code>fileSystemId | 101 // Raised when unmounting for the file system with the <code>fileSystemId |
96 // </code> identifier is requested. In response, the <code>unmount</code> | 102 // </code> identifier is requested. In the response, the <code>unmount |
97 // API method should be called together with <code>successCallback</code>. | 103 // </code> API method should be called together with <code>successCallback |
98 // If unmounting is not possible (eg. due to a pending operation), then | 104 // </code>. If unmounting is not possible (eg. due to a pending operation), |
99 // <code>errorCallback</code> must be called. | 105 // then <code>errorCallback</code> must be called. |
100 [maxListeners=1] static void onUnmountRequested( | 106 [maxListeners=1] static void onUnmountRequested( |
101 long fileSystemId, | 107 long fileSystemId, |
102 ProviderSuccessCallback successCallback, | 108 ProviderSuccessCallback successCallback, |
103 ProviderErrorCallback errorCallback); | 109 ProviderErrorCallback errorCallback); |
104 | 110 |
105 // Raised when metadata of a file or a directory at <code>entryPath</code> | 111 // Raised when metadata of a file or a directory at <code>entryPath</code> |
106 // is requested. The metadata should be returned with the <code> | 112 // is requested. The metadata should be returned with the <code> |
107 // successCallback</code> call. In case of an error, <code>errorCallback | 113 // successCallback</code> call. In case of an error, <code>errorCallback |
108 // </code> must be called. | 114 // </code> must be called. |
109 [maxListeners=1] static void onGetMetadataRequested( | 115 [maxListeners=1] static void onGetMetadataRequested( |
110 long fileSystemId, | 116 long fileSystemId, |
111 DOMString entryPath, | 117 DOMString entryPath, |
112 MetadataCallback successCallback, | 118 MetadataCallback successCallback, |
113 ErrorCallback errorCallback); | 119 ErrorCallback errorCallback); |
| 120 |
| 121 // Raised when contents of a directory at <code>directoryPath</code> are |
| 122 // requested. The results should be returned in chunks by calling the <code> |
| 123 // successCallback</code> several times. In case of an error, <code> |
| 124 // errorCallback</code> must be called. |
| 125 [maxListeners=1] static void onReadDirectoryRequested( |
| 126 long fileSystemId, |
| 127 DOMString directoryPath, |
| 128 EntriesCallback successCallback, |
| 129 ErrorCallback errorCallback); |
114 }; | 130 }; |
115 }; | 131 }; |
116 | 132 |
OLD | NEW |