| 1 | /* |
| 2 | * Copyright 2012 Closure Compiler Authors |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | /** |
| 17 | * @fileoverview Definitions for objects in the synchronous File API, File |
| 18 | * Writer API, and File System API. Details of the API are at: |
| 19 | * http://www.w3.org/TR/FileAPI/ |
| 20 | * http://www.w3.org/TR/file-writer-api/ |
| 21 | * http://www.w3.org/TR/file-system-api/ |
| 22 | * |
| 23 | * @externs |
| 24 | */ |
| 25 | |
| 26 | |
| 27 | /** |
| 28 | * @see http://www.w3.org/TR/file-writer-api/#idl-def-FileWriterSync |
| 29 | * @constructor |
| 30 | */ |
| 31 | function FileWriterSync() {} |
| 32 | |
| 33 | /** |
| 34 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-position |
| 35 | * @type {number} |
| 36 | * @const |
| 37 | */ |
| 38 | FileWriterSync.prototype.position; |
| 39 | |
| 40 | /** |
| 41 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-length |
| 42 | * @type {number} |
| 43 | * @const |
| 44 | */ |
| 45 | FileWriterSync.prototype.length; |
| 46 | |
| 47 | /** |
| 48 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriter-write |
| 49 | * @param {!Blob} blob |
| 50 | */ |
| 51 | FileWriterSync.prototype.write = function(blob) {}; |
| 52 | |
| 53 | /** |
| 54 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-seek |
| 55 | * @param {number} offset |
| 56 | */ |
| 57 | FileWriterSync.prototype.seek = function(offset) {}; |
| 58 | |
| 59 | /** |
| 60 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileWriterSync-truncate |
| 61 | * @param {number} size |
| 62 | */ |
| 63 | FileWriterSync.prototype.truncate = function(size) {}; |
| 64 | |
| 65 | /** |
| 66 | * @see http://www.w3.org/TR/FileAPI/#FileReaderSyncSync |
| 67 | * @constructor |
| 68 | */ |
| 69 | function FileReaderSync() {} |
| 70 | |
| 71 | /** |
| 72 | * @see http://www.w3.org/TR/FileAPI/#dfn-readAsArrayBufferSync |
| 73 | * @param {!Blob} blob |
| 74 | */ |
| 75 | FileReaderSync.prototype.readAsArrayBuffer = function(blob) {}; |
| 76 | |
| 77 | /** |
| 78 | * @see http://www.w3.org/TR/FileAPI/#dfn-readAsBinaryStringSync |
| 79 | * @param {!Blob} blob |
| 80 | */ |
| 81 | FileReaderSync.prototype.readAsBinaryString = function(blob) {}; |
| 82 | |
| 83 | /** |
| 84 | * @see http://www.w3.org/TR/FileAPI/#dfn-readAsTextSync |
| 85 | * @param {!Blob} blob |
| 86 | * @param {string=} encoding |
| 87 | */ |
| 88 | FileReaderSync.prototype.readAsText = function(blob, encoding) {}; |
| 89 | |
| 90 | /** |
| 91 | * @see http://www.w3.org/TR/FileAPI/#dfn-readAsDataURLSync |
| 92 | * @param {!Blob} blob |
| 93 | */ |
| 94 | FileReaderSync.prototype.readAsDataURL = function(blob) {}; |
| 95 | |
| 96 | /** |
| 97 | * LocalFileSystemSync interface, implemented by WorkerGlobalScope. |
| 98 | * @see http://www.w3.org/TR/file-system-api/#idl-def-LocalFileSystemSync |
| 99 | * @constructor |
| 100 | */ |
| 101 | function LocalFileSystemSync() {} |
| 102 | |
| 103 | /** |
| 104 | * @see http://www.w3.org/TR/file-system-api/ |
| 105 | * #the-synchronous-filesystem-interface |
| 106 | * @constructor |
| 107 | */ |
| 108 | function FileSystemSync() {} |
| 109 | |
| 110 | /** |
| 111 | * @see http://www.w3.org/TR/file-system-api/#widl-FileSystemSync-name |
| 112 | * @type {string} |
| 113 | * @const |
| 114 | */ |
| 115 | FileSystemSync.prototype.name; |
| 116 | |
| 117 | /** |
| 118 | * @see http://www.w3.org/TR/file-system-api/#widl-FileSystemSync-root |
| 119 | * @type {!DirectoryEntrySync} |
| 120 | * @const |
| 121 | */ |
| 122 | FileSystemSync.prototype.root; |
| 123 | |
| 124 | /** |
| 125 | * @see http://www.w3.org/TR/file-system-api/#widl-LocalFileSystemSync-requestFileSystemSync-FileSystemSync-unsigned-short-type-unsigned-long-long-size |
| 126 | * @param {number} type |
| 127 | * @param {number} size |
| 128 | * @return {!FileSystemSync} |
| 129 | */ |
| 130 | function requestFileSystemSync(type, size) {} |
| 131 | |
| 132 | /** |
| 133 | * @see http://www.w3.org/TR/file-system-api/#widl-LocalFileSystemSync-requestFileSystemSync-FileSystemSync-unsigned-short-type-unsigned-long-long-size |
| 134 | * @param {number} type |
| 135 | * @param {number} size |
| 136 | * @return {!FileSystemSync} |
| 137 | */ |
| 138 | function webkitRequestFileSystemSync(type, size) {} |
| 139 | |
| 140 | /** |
| 141 | * @see http://www.w3.org/TR/file-system-api/#the-entrysync-interface |
| 142 | * @constructor |
| 143 | */ |
| 144 | function EntrySync() {}; |
| 145 | |
| 146 | /** |
| 147 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-isFile |
| 148 | * @type {boolean} |
| 149 | * @const |
| 150 | */ |
| 151 | EntrySync.prototype.isFile; |
| 152 | |
| 153 | /** |
| 154 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-isDirectory |
| 155 | * @type {boolean} |
| 156 | * @const |
| 157 | */ |
| 158 | EntrySync.prototype.isDirectory; |
| 159 | |
| 160 | /** |
| 161 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-name |
| 162 | * @type {string} |
| 163 | * @const |
| 164 | */ |
| 165 | EntrySync.prototype.name; |
| 166 | |
| 167 | /** |
| 168 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-fullPath |
| 169 | * @type {string} |
| 170 | * @const |
| 171 | */ |
| 172 | EntrySync.prototype.fullPath; |
| 173 | |
| 174 | /** |
| 175 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-filesystem |
| 176 | * @type {!FileSystemSync} |
| 177 | * @const |
| 178 | */ |
| 179 | EntrySync.prototype.filesystem; |
| 180 | |
| 181 | /** |
| 182 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-moveTo |
| 183 | * @param {!DirectoryEntrySync} parent |
| 184 | * @param {string=} newName |
| 185 | * @return {!EntrySync} |
| 186 | */ |
| 187 | EntrySync.prototype.moveTo = function(parent, newName) {}; |
| 188 | |
| 189 | /** |
| 190 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-copyTo |
| 191 | * @param {!DirectoryEntrySync} parent |
| 192 | * @param {string=} newName |
| 193 | * @return {!EntrySync} |
| 194 | */ |
| 195 | EntrySync.prototype.copyTo = function(parent, newName) {}; |
| 196 | |
| 197 | /** |
| 198 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-toURL |
| 199 | * @param {string=} mimeType |
| 200 | * @return {string} |
| 201 | */ |
| 202 | EntrySync.prototype.toURL = function(mimeType) {}; |
| 203 | |
| 204 | /** |
| 205 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-remove |
| 206 | */ |
| 207 | EntrySync.prototype.remove = function() {}; |
| 208 | |
| 209 | /** |
| 210 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-getMetadata |
| 211 | * @return {!Metadata} |
| 212 | */ |
| 213 | EntrySync.prototype.getMetadata = function() {}; |
| 214 | |
| 215 | /** |
| 216 | * @see http://www.w3.org/TR/file-system-api/#widl-EntrySync-getParent |
| 217 | * @return {!DirectoryEntrySync} |
| 218 | */ |
| 219 | EntrySync.prototype.getParent = function() {}; |
| 220 | |
| 221 | /** |
| 222 | * @see http://www.w3.org/TR/file-system-api/#the-directoryentrysync-interface |
| 223 | * @constructor |
| 224 | * @extends {EntrySync} |
| 225 | */ |
| 226 | function DirectoryEntrySync() {}; |
| 227 | |
| 228 | /** |
| 229 | * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-createReader |
| 230 | * @return {!DirectoryReaderSync} |
| 231 | */ |
| 232 | DirectoryEntrySync.prototype.createReader = function() {}; |
| 233 | |
| 234 | /** |
| 235 | * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-getFile |
| 236 | * @param {string} path |
| 237 | * @param {Object=} options |
| 238 | * @return {!FileEntrySync} |
| 239 | */ |
| 240 | DirectoryEntrySync.prototype.getFile = function(path, options) {}; |
| 241 | |
| 242 | /** |
| 243 | * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-getDirectory |
| 244 | * @param {string} path |
| 245 | * @param {Object=} options |
| 246 | * @return {!DirectoryEntrySync} |
| 247 | */ |
| 248 | DirectoryEntrySync.prototype.getDirectory = function(path, options) {}; |
| 249 | |
| 250 | /** |
| 251 | * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryEntrySync-removeRecursively |
| 252 | */ |
| 253 | DirectoryEntrySync.prototype.removeRecursively = function() {}; |
| 254 | |
| 255 | /** |
| 256 | * @see http://www.w3.org/TR/file-system-api/#the-directoryreadersync-interface |
| 257 | * @constructor |
| 258 | */ |
| 259 | function DirectoryReaderSync() {}; |
| 260 | |
| 261 | /** |
| 262 | * @see http://www.w3.org/TR/file-system-api/#widl-DirectoryReaderSync-readEntries |
| 263 | * @return {!Array.<!EntrySync>} |
| 264 | */ |
| 265 | DirectoryReaderSync.prototype.readEntries = function() {}; |
| 266 | |
| 267 | /** |
| 268 | * @see http://www.w3.org/TR/file-system-api/#the-fileentrysync-interface |
| 269 | * @constructor |
| 270 | * @extends {EntrySync} |
| 271 | */ |
| 272 | function FileEntrySync() {}; |
| 273 | |
| 274 | /** |
| 275 | * @see http://www.w3.org/TR/file-system-api/#widl-FileEntrySync-createWriter |
| 276 | * @return {!FileWriterSync} |
| 277 | */ |
| 278 | FileEntrySync.prototype.createWriter = function() {}; |
| 279 | |
| 280 | /** |
| 281 | * @see http://www.w3.org/TR/file-system-api/#widl-FileEntrySync-file |
| 282 | * @return {!File} |
| 283 | */ |
| 284 | FileEntrySync.prototype.file = function() {}; |
| 285 | |
| 286 | /** |
| 287 | * @see http://www.w3.org/TR/file-system-api/#the-fileexception-exception |
| 288 | * @constructor |
| 289 | */ |
| 290 | function FileException() {} |
| 291 | |
| 292 | /** |
| 293 | * @see http://www.w3.org/TR/FileAPI/#dfn-NOT_FOUND_ERR |
| 294 | * @type {number} |
| 295 | */ |
| 296 | FileException.prototype.NOT_FOUND_ERR = 1; |
| 297 | |
| 298 | /** @type {number} */ |
| 299 | FileException.NOT_FOUND_ERR = 1; |
| 300 | |
| 301 | /** |
| 302 | * @see http://www.w3.org/TR/FileAPI/#dfn-SECURITY_ERR |
| 303 | * @type {number} |
| 304 | */ |
| 305 | FileException.prototype.SECURITY_ERR = 2; |
| 306 | |
| 307 | /** @type {number} */ |
| 308 | FileException.SECURITY_ERR = 2; |
| 309 | |
| 310 | /** |
| 311 | * @see http://www.w3.org/TR/FileAPI/#widl-FileException-ABORT_ERR |
| 312 | * @type {number} |
| 313 | */ |
| 314 | FileException.prototype.ABORT_ERR = 3; |
| 315 | |
| 316 | /** @type {number} */ |
| 317 | FileException.ABORT_ERR = 3; |
| 318 | |
| 319 | /** |
| 320 | * @see http://www.w3.org/TR/FileAPI/#widl-FileException-NOT_READABLE_ERR |
| 321 | * @type {number} |
| 322 | */ |
| 323 | FileException.prototype.NOT_READABLE_ERR = 4; |
| 324 | |
| 325 | /** @type {number} */ |
| 326 | FileException.NOT_READABLE_ERR = 4; |
| 327 | |
| 328 | /** |
| 329 | * @see http://www.w3.org/TR/FileAPI/#widl-FileException-ENCODING_ERR |
| 330 | * @type {number} |
| 331 | */ |
| 332 | FileException.prototype.ENCODING_ERR = 5; |
| 333 | |
| 334 | /** @type {number} */ |
| 335 | FileException.ENCODING_ERR = 5; |
| 336 | |
| 337 | /** |
| 338 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-NO_MODIFICATION_ALLOWED_ERR |
| 339 | * @type {number} |
| 340 | */ |
| 341 | FileException.prototype.NO_MODIFICATION_ALLOWED_ERR = 6; |
| 342 | |
| 343 | /** @type {number} */ |
| 344 | FileException.NO_MODIFICATION_ALLOWED_ERR = 6; |
| 345 | |
| 346 | /** |
| 347 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-INVALID_STATE_ERR |
| 348 | * @type {number} |
| 349 | */ |
| 350 | FileException.prototype.INVALID_STATE_ERR = 7; |
| 351 | |
| 352 | /** @type {number} */ |
| 353 | FileException.INVALID_STATE_ERR = 7; |
| 354 | |
| 355 | /** |
| 356 | * @see http://www.w3.org/TR/file-writer-api/#widl-FileException-SYNTAX_ERR |
| 357 | * @type {number} |
| 358 | */ |
| 359 | FileException.prototype.SYNTAX_ERR = 8; |
| 360 | |
| 361 | /** @type {number} */ |
| 362 | FileException.SYNTAX_ERR = 8; |
| 363 | |
| 364 | /** |
| 365 | * @see http://www.w3.org/TR/file-system-api/#widl-FileException-INVALID_MODIFICATION_ERR |
| 366 | * @type {number} |
| 367 | */ |
| 368 | FileException.prototype.INVALID_MODIFICATION_ERR = 9; |
| 369 | |
| 370 | /** @type {number} */ |
| 371 | FileException.INVALID_MODIFICATION_ERR = 9; |
| 372 | |
| 373 | /** |
| 374 | * @see http://www.w3.org/TR/file-system-api/#widl-FileException-QUOTA_EXCEEDED_ERR |
| 375 | * @type {number} |
| 376 | */ |
| 377 | FileException.prototype.QUOTA_EXCEEDED_ERR = 10; |
| 378 | |
| 379 | /** @type {number} */ |
| 380 | FileException.QUOTA_EXCEEDED_ERR = 10; |
| 381 | |
| 382 | /** |
| 383 | * @see http://www.w3.org/TR/file-system-api/#widl-FileException-TYPE_MISMATCH_ERR |
| 384 | * @type {number} |
| 385 | */ |
| 386 | FileException.prototype.TYPE_MISMATCH_ERR = 11; |
| 387 | |
| 388 | /** @type {number} */ |
| 389 | FileException.TYPE_MISMATCH_ERR = 11; |
| 390 | |
| 391 | /** |
| 392 | * @see http://www.w3.org/TR/file-system-api/#widl-FileException-PATH_EXISTS_ERR |
| 393 | * @type {number} |
| 394 | */ |
| 395 | FileException.prototype.PATH_EXISTS_ERR = 12; |
| 396 | |
| 397 | /** @type {number} */ |
| 398 | FileException.PATH_EXISTS_ERR = 12; |
| 399 | |
| 400 | /** |
| 401 | * @see http://www.w3.org/TR/FileAPI/#dfn-code-exception |
| 402 | * @type {number} |
| 403 | */ |
| 404 | FileException.prototype.code; |