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; | |
benwells
2014/04/30 07:04:34
Maybe this should this be called baseName?
mtomasz
2014/04/30 09:18:24
It follows HTML5 FileEntry specs. It is called the
| |
39 | |
40 // File size in bytes. | |
41 double size; | |
benwells
2014/04/30 07:04:34
Is this because long isn't big enough?
mtomasz
2014/04/30 09:18:24
Exactly yes. We had this issue in Files app.
| |
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); |
(...skipping 12 matching lines...) Expand all Loading... | |
76 interface Events { | 94 interface Events { |
77 // Raised, when the user requests unmounting of the file system with the | 95 // Raised, when the user requests unmounting of the file system with the |
78 // <code>fileSystemId</code> identifier in the Files.app UI. In response, | 96 // <code>fileSystemId</code> identifier in the Files.app UI. In response, |
79 // the <code>unmount</code> API method should be called. If unmounting is | 97 // the <code>unmount</code> API method should be called. If unmounting is |
80 // not possible (eg. due to pending operation), then <code>errorCallback | 98 // not possible (eg. due to pending operation), then <code>errorCallback |
81 // </code> should be called, and <code>unmount</code> should not be called. | 99 // </code> should be called, and <code>unmount</code> should not 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 the user requests metadat for a file or a directory at | |
benwells
2014/04/30 07:04:34
It feels weird to explicitly mention the user here
mtomasz
2014/04/30 09:18:24
Good point. Done.
| |
106 // <code>entryPath</code>. In case of an error, <code>errorCallback</code> | |
107 // must be called. | |
108 [maxListeners=1] static void onGetMetadataRequested( | |
109 long fileSystemId, | |
110 DOMString entryPath, | |
111 MetadataCallback successCallback, | |
112 ErrorCallback errorCallback); | |
86 }; | 113 }; |
87 }; | 114 }; |
88 | 115 |
OLD | NEW |