OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Generated from namespace: fileSystem | 5 // Generated from namespace: fileSystem |
6 | 6 |
7 part of chrome; | 7 part of chrome; |
8 | 8 |
9 /** | 9 /** |
10 * Types | 10 * Types |
11 */ | 11 */ |
12 | 12 |
13 class FilesystemAcceptOption extends ChromeObject { | 13 class FilesystemAcceptOption extends ChromeObject { |
14 /* | 14 /* |
15 * Public constructor | 15 * Public constructor |
16 */ | 16 */ |
17 FilesystemAcceptOption({String description, List<String> mimeTypes, List<Strin
g> extensions}) { | 17 FilesystemAcceptOption( |
18 if (description != null) | 18 {String description, List<String> mimeTypes, List<String> extensions}) { |
19 this.description = description; | 19 if (description != null) this.description = description; |
20 if (mimeTypes != null) | 20 if (mimeTypes != null) this.mimeTypes = mimeTypes; |
21 this.mimeTypes = mimeTypes; | 21 if (extensions != null) this.extensions = extensions; |
22 if (extensions != null) | |
23 this.extensions = extensions; | |
24 } | 22 } |
25 | 23 |
26 /* | 24 /* |
27 * Private constructor | 25 * Private constructor |
28 */ | 26 */ |
29 FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject); | 27 FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject); |
30 | 28 |
31 /* | 29 /* |
32 * Public accessors | 30 * Public accessors |
33 */ | 31 */ |
34 /// This is the optional text description for this option. If not present, a | 32 /// This is the optional text description for this option. If not present, a |
35 /// description will be automatically generated; typically containing an | 33 /// description will be automatically generated; typically containing an |
36 /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html, | 34 /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html, |
37 /// *.htm"). | 35 /// *.htm"). |
38 String get description => JS('String', '#.description', this._jsObject); | 36 String get description => JS('String', '#.description', this._jsObject); |
39 | 37 |
40 set description(String description) { | 38 set description(String description) { |
41 JS('void', '#.description = #', this._jsObject, description); | 39 JS('void', '#.description = #', this._jsObject, description); |
42 } | 40 } |
43 | 41 |
44 /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or | 42 /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or |
45 /// extensions must contain at least one valid element. | 43 /// extensions must contain at least one valid element. |
46 List<String> get mimeTypes => JS('List<String>', '#.mimeTypes', this._jsObject
); | 44 List<String> get mimeTypes => |
| 45 JS('List<String>', '#.mimeTypes', this._jsObject); |
47 | 46 |
48 set mimeTypes(List<String> mimeTypes) { | 47 set mimeTypes(List<String> mimeTypes) { |
49 JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes); | 48 JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes); |
50 } | 49 } |
51 | 50 |
52 /// Extensions to accept, e.g. "jpg", "gif", "crx". | 51 /// Extensions to accept, e.g. "jpg", "gif", "crx". |
53 List<String> get extensions => JS('List<String>', '#.extensions', this._jsObje
ct); | 52 List<String> get extensions => |
| 53 JS('List<String>', '#.extensions', this._jsObject); |
54 | 54 |
55 set extensions(List<String> extensions) { | 55 set extensions(List<String> extensions) { |
56 JS('void', '#.extensions = #', this._jsObject, extensions); | 56 JS('void', '#.extensions = #', this._jsObject, extensions); |
57 } | 57 } |
58 | |
59 } | 58 } |
60 | 59 |
61 class FilesystemChooseEntryOptions extends ChromeObject { | 60 class FilesystemChooseEntryOptions extends ChromeObject { |
62 /* | 61 /* |
63 * Public constructor | 62 * Public constructor |
64 */ | 63 */ |
65 FilesystemChooseEntryOptions({String type, String suggestedName, List<Filesyst
emAcceptOption> accepts, bool acceptsAllTypes}) { | 64 FilesystemChooseEntryOptions( |
66 if (type != null) | 65 {String type, |
67 this.type = type; | 66 String suggestedName, |
68 if (suggestedName != null) | 67 List<FilesystemAcceptOption> accepts, |
69 this.suggestedName = suggestedName; | 68 bool acceptsAllTypes}) { |
70 if (accepts != null) | 69 if (type != null) this.type = type; |
71 this.accepts = accepts; | 70 if (suggestedName != null) this.suggestedName = suggestedName; |
72 if (acceptsAllTypes != null) | 71 if (accepts != null) this.accepts = accepts; |
73 this.acceptsAllTypes = acceptsAllTypes; | 72 if (acceptsAllTypes != null) this.acceptsAllTypes = acceptsAllTypes; |
74 } | 73 } |
75 | 74 |
76 /* | 75 /* |
77 * Private constructor | 76 * Private constructor |
78 */ | 77 */ |
79 FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject); | 78 FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject); |
80 | 79 |
81 /* | 80 /* |
82 * Public accessors | 81 * Public accessors |
83 */ | 82 */ |
84 /// Type of the prompt to show. The default is 'openFile'. | 83 /// Type of the prompt to show. The default is 'openFile'. |
85 String get type => JS('String', '#.type', this._jsObject); | 84 String get type => JS('String', '#.type', this._jsObject); |
86 | 85 |
87 set type(String type) { | 86 set type(String type) { |
88 JS('void', '#.type = #', this._jsObject, type); | 87 JS('void', '#.type = #', this._jsObject, type); |
89 } | 88 } |
90 | 89 |
91 /// The suggested file name that will be presented to the user as the default | 90 /// The suggested file name that will be presented to the user as the default |
92 /// name to read or write. This is optional. | 91 /// name to read or write. This is optional. |
93 String get suggestedName => JS('String', '#.suggestedName', this._jsObject); | 92 String get suggestedName => JS('String', '#.suggestedName', this._jsObject); |
94 | 93 |
95 set suggestedName(String suggestedName) { | 94 set suggestedName(String suggestedName) { |
96 JS('void', '#.suggestedName = #', this._jsObject, suggestedName); | 95 JS('void', '#.suggestedName = #', this._jsObject, suggestedName); |
97 } | 96 } |
98 | 97 |
99 /// The optional list of accept options for this file opener. Each option will | 98 /// The optional list of accept options for this file opener. Each option will |
100 /// be presented as a unique group to the end-user. | 99 /// be presented as a unique group to the end-user. |
101 List<FilesystemAcceptOption> get accepts { | 100 List<FilesystemAcceptOption> get accepts { |
102 List<FilesystemAcceptOption> __proxy_accepts = new List<FilesystemAcceptOpti
on>(); | 101 List<FilesystemAcceptOption> __proxy_accepts = |
| 102 new List<FilesystemAcceptOption>(); |
103 int count = JS('int', '#.accepts.length', this._jsObject); | 103 int count = JS('int', '#.accepts.length', this._jsObject); |
104 for (int i = 0; i < count; i++) { | 104 for (int i = 0; i < count; i++) { |
105 var item = JS('', '#.accepts[#]', this._jsObject, i); | 105 var item = JS('', '#.accepts[#]', this._jsObject, i); |
106 __proxy_accepts.add(new FilesystemAcceptOption._proxy(item)); | 106 __proxy_accepts.add(new FilesystemAcceptOption._proxy(item)); |
107 } | 107 } |
108 return __proxy_accepts; | 108 return __proxy_accepts; |
109 } | 109 } |
110 | 110 |
111 set accepts(List<FilesystemAcceptOption> accepts) { | 111 set accepts(List<FilesystemAcceptOption> accepts) { |
112 JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts)); | 112 JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts)); |
113 } | 113 } |
114 | 114 |
115 /// Whether to accept all file types, in addition to the options specified in | 115 /// Whether to accept all file types, in addition to the options specified in |
116 /// the accepts argument. The default is true. If the accepts field is unset o
r | 116 /// the accepts argument. The default is true. If the accepts field is unset o
r |
117 /// contains no valid entries, this will always be reset to true. | 117 /// contains no valid entries, this will always be reset to true. |
118 bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject); | 118 bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject); |
119 | 119 |
120 set acceptsAllTypes(bool acceptsAllTypes) { | 120 set acceptsAllTypes(bool acceptsAllTypes) { |
121 JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes); | 121 JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes); |
122 } | 122 } |
123 | |
124 } | 123 } |
125 | 124 |
126 /** | 125 /** |
127 * Functions | 126 * Functions |
128 */ | 127 */ |
129 | 128 |
130 class API_file_system { | 129 class API_file_system { |
131 /* | 130 /* |
132 * API connection | 131 * API connection |
133 */ | 132 */ |
134 Object _jsObject; | 133 Object _jsObject; |
135 | 134 |
136 /* | 135 /* |
137 * Functions | 136 * Functions |
138 */ | 137 */ |
139 /// Get the display path of a FileEntry object. The display path is based on | 138 /// Get the display path of a FileEntry object. The display path is based on |
140 /// the full path of the file on the local file system, but may be made more | 139 /// the full path of the file on the local file system, but may be made more |
141 /// readable for display purposes. | 140 /// readable for display purposes. |
142 void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) =>
JS('void', '#.getDisplayPath(#, #)', this._jsObject, convertArgument(fileEntry)
, convertDartClosureToJS(callback, 1)); | 141 void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) => |
| 142 JS('void', '#.getDisplayPath(#, #)', this._jsObject, |
| 143 convertArgument(fileEntry), convertDartClosureToJS(callback, 1)); |
143 | 144 |
144 /// Get a writable FileEntry from another FileEntry. This call will fail if th
e | 145 /// Get a writable FileEntry from another FileEntry. This call will fail if th
e |
145 /// application does not have the 'write' permission under 'fileSystem'. | 146 /// application does not have the 'write' permission under 'fileSystem'. |
146 void getWritableEntry(FileEntry fileEntry, void callback(FileEntry fileEntry))
{ | 147 void getWritableEntry( |
| 148 FileEntry fileEntry, void callback(FileEntry fileEntry)) { |
147 void __proxy_callback(fileEntry) { | 149 void __proxy_callback(fileEntry) { |
148 if (callback != null) { | 150 if (callback != null) { |
149 callback(fileEntry); | 151 callback(fileEntry); |
150 } | 152 } |
151 } | 153 } |
152 JS('void', '#.getWritableEntry(#, #)', this._jsObject, convertArgument(fileE
ntry), convertDartClosureToJS(__proxy_callback, 1)); | 154 |
| 155 JS( |
| 156 'void', |
| 157 '#.getWritableEntry(#, #)', |
| 158 this._jsObject, |
| 159 convertArgument(fileEntry), |
| 160 convertDartClosureToJS(__proxy_callback, 1)); |
153 } | 161 } |
154 | 162 |
155 /// Gets whether this FileEntry is writable or not. | 163 /// Gets whether this FileEntry is writable or not. |
156 void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) => J
S('void', '#.isWritableEntry(#, #)', this._jsObject, convertArgument(fileEntry),
convertDartClosureToJS(callback, 1)); | 164 void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) => |
| 165 JS('void', '#.isWritableEntry(#, #)', this._jsObject, |
| 166 convertArgument(fileEntry), convertDartClosureToJS(callback, 1)); |
157 | 167 |
158 /// Ask the user to choose a file. | 168 /// Ask the user to choose a file. |
159 void chooseEntry(void callback(FileEntry fileEntry), [FilesystemChooseEntryOpt
ions options]) { | 169 void chooseEntry(void callback(FileEntry fileEntry), |
| 170 [FilesystemChooseEntryOptions options]) { |
160 void __proxy_callback(fileEntry) { | 171 void __proxy_callback(fileEntry) { |
161 if (callback != null) { | 172 if (callback != null) { |
162 callback(fileEntry); | 173 callback(fileEntry); |
163 } | 174 } |
164 } | 175 } |
165 JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options),
convertDartClosureToJS(__proxy_callback, 1)); | 176 |
| 177 JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options), |
| 178 convertDartClosureToJS(__proxy_callback, 1)); |
166 } | 179 } |
167 | 180 |
168 /// Returns the file entry with the given id if it can be restored. This call | 181 /// Returns the file entry with the given id if it can be restored. This call |
169 /// will fail otherwise. | 182 /// will fail otherwise. |
170 void restoreEntry(String id, void callback(FileEntry fileEntry)) { | 183 void restoreEntry(String id, void callback(FileEntry fileEntry)) { |
171 void __proxy_callback(fileEntry) { | 184 void __proxy_callback(fileEntry) { |
172 if (callback != null) { | 185 if (callback != null) { |
173 callback(fileEntry); | 186 callback(fileEntry); |
174 } | 187 } |
175 } | 188 } |
176 JS('void', '#.restoreEntry(#, #)', this._jsObject, id, convertDartClosureToJ
S(__proxy_callback, 1)); | 189 |
| 190 JS('void', '#.restoreEntry(#, #)', this._jsObject, id, |
| 191 convertDartClosureToJS(__proxy_callback, 1)); |
177 } | 192 } |
178 | 193 |
179 /// Returns whether a file entry for the given id can be restored, i.e. whethe
r | 194 /// Returns whether a file entry for the given id can be restored, i.e. whethe
r |
180 /// restoreEntry would succeed with this id now. | 195 /// restoreEntry would succeed with this id now. |
181 void isRestorable(String id, void callback(bool isRestorable)) => JS('void', '
#.isRestorable(#, #)', this._jsObject, id, convertDartClosureToJS(callback, 1)); | 196 void isRestorable(String id, void callback(bool isRestorable)) => JS( |
| 197 'void', |
| 198 '#.isRestorable(#, #)', |
| 199 this._jsObject, |
| 200 id, |
| 201 convertDartClosureToJS(callback, 1)); |
182 | 202 |
183 /// Returns an id that can be passed to restoreEntry to regain access to a | 203 /// Returns an id that can be passed to restoreEntry to regain access to a |
184 /// given file entry. Only the 500 most recently used entries are retained, | 204 /// given file entry. Only the 500 most recently used entries are retained, |
185 /// where calls to retainEntry and restoreEntry count as use. If the app has | 205 /// where calls to retainEntry and restoreEntry count as use. If the app has |
186 /// the 'retainEntries' permission under 'fileSystem', entries are retained | 206 /// the 'retainEntries' permission under 'fileSystem', entries are retained |
187 /// indefinitely. Otherwise, entries are retained only while the app is runnin
g | 207 /// indefinitely. Otherwise, entries are retained only while the app is runnin
g |
188 /// and across restarts. | 208 /// and across restarts. |
189 String retainEntry(FileEntry fileEntry) => JS('String', '#.retainEntry(#)', th
is._jsObject, convertArgument(fileEntry)); | 209 String retainEntry(FileEntry fileEntry) => JS( |
| 210 'String', '#.retainEntry(#)', this._jsObject, convertArgument(fileEntry)); |
190 | 211 |
191 API_file_system(this._jsObject) { | 212 API_file_system(this._jsObject) {} |
192 } | |
193 } | 213 } |
OLD | NEW |