| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Generated from namespace: fileSystem |
| 6 |
| 7 part of chrome; |
| 8 |
| 9 /** |
| 10 * Types |
| 11 */ |
| 12 |
| 13 class FilesystemAcceptOption extends ChromeObject { |
| 14 /* |
| 15 * Public constructor |
| 16 */ |
| 17 FilesystemAcceptOption({String description, List<String> mimeTypes, List<Strin
g> extensions}) { |
| 18 if (?description) |
| 19 this.description = description; |
| 20 if (?mimeTypes) |
| 21 this.mimeTypes = mimeTypes; |
| 22 if (?extensions) |
| 23 this.extensions = extensions; |
| 24 } |
| 25 |
| 26 /* |
| 27 * Private constructor |
| 28 */ |
| 29 FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject); |
| 30 |
| 31 /* |
| 32 * Public accessors |
| 33 */ |
| 34 /// This is the optional text description for this option. If not present, a |
| 35 /// description will be automatically generated; typically containing an |
| 36 /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html, |
| 37 /// *.htm"). |
| 38 String get description => JS('String', '#.description', this._jsObject); |
| 39 |
| 40 void set description(String description) { |
| 41 JS('void', '#.description = #', this._jsObject, description); |
| 42 } |
| 43 |
| 44 /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or |
| 45 /// extensions must contain at least one valid element. |
| 46 List<String> get mimeTypes => JS('List<String>', '#.mimeTypes', this._jsObject
); |
| 47 |
| 48 void set mimeTypes(List<String> mimeTypes) { |
| 49 JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes); |
| 50 } |
| 51 |
| 52 /// Extensions to accept, e.g. "jpg", "gif", "crx". |
| 53 List<String> get extensions => JS('List<String>', '#.extensions', this._jsObje
ct); |
| 54 |
| 55 void set extensions(List<String> extensions) { |
| 56 JS('void', '#.extensions = #', this._jsObject, extensions); |
| 57 } |
| 58 |
| 59 } |
| 60 |
| 61 class FilesystemChooseEntryOptions extends ChromeObject { |
| 62 /* |
| 63 * Public constructor |
| 64 */ |
| 65 FilesystemChooseEntryOptions({String type, String suggestedName, List<Filesyst
emAcceptOption> accepts, bool acceptsAllTypes}) { |
| 66 if (?type) |
| 67 this.type = type; |
| 68 if (?suggestedName) |
| 69 this.suggestedName = suggestedName; |
| 70 if (?accepts) |
| 71 this.accepts = accepts; |
| 72 if (?acceptsAllTypes) |
| 73 this.acceptsAllTypes = acceptsAllTypes; |
| 74 } |
| 75 |
| 76 /* |
| 77 * Private constructor |
| 78 */ |
| 79 FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject); |
| 80 |
| 81 /* |
| 82 * Public accessors |
| 83 */ |
| 84 /// Type of the prompt to show. Valid types are 'openFile', 'openWritableFile' |
| 85 /// or 'saveFile'.<br/><br/> Both 'openFile' and 'openWritableFile' will promp
t |
| 86 /// the user to open an existing file, with 'openFile' returning a read-only |
| 87 /// FileEntry on success. 'saveFile' will prompt the user to choose an existin
g |
| 88 /// file or a new file, and will return a writable FileEntry. Calls to |
| 89 /// chooseFile with either 'openWritableFile' or 'saveFile' will fail unless |
| 90 /// the application has the 'write' permission under 'fileSystem'.<br/><br/> |
| 91 /// The default is 'openFile'. |
| 92 String get type => JS('String', '#.type', this._jsObject); |
| 93 |
| 94 void set type(String type) { |
| 95 JS('void', '#.type = #', this._jsObject, type); |
| 96 } |
| 97 |
| 98 /// The suggested file name that will be presented to the user as the default |
| 99 /// name to read or write. This is optional. |
| 100 String get suggestedName => JS('String', '#.suggestedName', this._jsObject); |
| 101 |
| 102 void set suggestedName(String suggestedName) { |
| 103 JS('void', '#.suggestedName = #', this._jsObject, suggestedName); |
| 104 } |
| 105 |
| 106 /// The optional list of accept options for this file opener. Each option will |
| 107 /// be presented as a unique group to the end-user. |
| 108 List<FilesystemAcceptOption> get accepts { |
| 109 List<FilesystemAcceptOption> __proxy_accepts = new List<FilesystemAcceptOpti
on>(); |
| 110 for (var o in JS('List', '#.accepts', this._jsObject)) { |
| 111 __proxy_accepts.add(new FilesystemAcceptOption._proxy(o)); |
| 112 } |
| 113 return __proxy_accepts; |
| 114 } |
| 115 |
| 116 void set accepts(List<FilesystemAcceptOption> accepts) { |
| 117 JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts)); |
| 118 } |
| 119 |
| 120 /// Whether to accept all file types, in addition to the options specified in |
| 121 /// the accepts argument. The default is true. If the accepts field is unset o
r |
| 122 /// contains no valid entries, this will always be reset to true. |
| 123 bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject); |
| 124 |
| 125 void set acceptsAllTypes(bool acceptsAllTypes) { |
| 126 JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes); |
| 127 } |
| 128 |
| 129 } |
| 130 |
| 131 /** |
| 132 * Functions |
| 133 */ |
| 134 |
| 135 class API_file_system { |
| 136 /* |
| 137 * API connection |
| 138 */ |
| 139 Object _jsObject; |
| 140 |
| 141 /* |
| 142 * Functions |
| 143 */ |
| 144 /// Get the display path of a FileEntry object. The display path is based on |
| 145 /// the full path of the file on the local file system, but may be made more |
| 146 /// readable for display purposes. |
| 147 void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) =>
JS('void', '#.getDisplayPath(#, #)', this._jsObject, convertArgument(fileEntry)
, convertDartClosureToJS(callback, 1)); |
| 148 |
| 149 /// Get a writable FileEntry from another FileEntry. This call will fail if th
e |
| 150 /// application does not have the 'write' permission under 'fileSystem'. |
| 151 void getWritableEntry(FileEntry fileEntry, void callback(FileEntry fileEntry))
{ |
| 152 void __proxy_callback(fileEntry) { |
| 153 if (?callback) { |
| 154 callback(fileEntry); |
| 155 } |
| 156 } |
| 157 JS('void', '#.getWritableEntry(#, #)', this._jsObject, convertArgument(fileE
ntry), convertDartClosureToJS(__proxy_callback, 1)); |
| 158 } |
| 159 |
| 160 /// Gets whether this FileEntry is writable or not. |
| 161 void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) => J
S('void', '#.isWritableEntry(#, #)', this._jsObject, convertArgument(fileEntry),
convertDartClosureToJS(callback, 1)); |
| 162 |
| 163 /// Ask the user to choose a file. |
| 164 void chooseEntry(void callback(FileEntry fileEntry), [FilesystemChooseEntryOpt
ions options]) { |
| 165 void __proxy_callback(fileEntry) { |
| 166 if (?callback) { |
| 167 callback(fileEntry); |
| 168 } |
| 169 } |
| 170 JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options),
convertDartClosureToJS(__proxy_callback, 1)); |
| 171 } |
| 172 |
| 173 /// Returns the file entry with the given id. |
| 174 FileEntry getEntryById(String id) => new FileEntry._proxy(JS('', '#.getEntryBy
Id(#)', this._jsObject, id)); |
| 175 |
| 176 /// Returns the id of the given file entry. |
| 177 String getEntryId(FileEntry fileEntry) => JS('String', '#.getEntryId(#)', this
._jsObject, convertArgument(fileEntry)); |
| 178 |
| 179 API_file_system(this._jsObject) { |
| 180 } |
| 181 } |
| OLD | NEW |