| Index: tools/dom/src/chrome/file_system.dart
|
| diff --git a/tools/dom/src/chrome/file_system.dart b/tools/dom/src/chrome/file_system.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7871e685b847dfed126e5861ac8edbb3eb4c65ff
|
| --- /dev/null
|
| +++ b/tools/dom/src/chrome/file_system.dart
|
| @@ -0,0 +1,181 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Generated from namespace: fileSystem
|
| +
|
| +part of chrome;
|
| +
|
| +/**
|
| + * Types
|
| + */
|
| +
|
| +class FilesystemAcceptOption extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + FilesystemAcceptOption({String description, List<String> mimeTypes, List<String> extensions}) {
|
| + if (?description)
|
| + this.description = description;
|
| + if (?mimeTypes)
|
| + this.mimeTypes = mimeTypes;
|
| + if (?extensions)
|
| + this.extensions = extensions;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + FilesystemAcceptOption._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// This is the optional text description for this option. If not present, a
|
| + /// description will be automatically generated; typically containing an
|
| + /// expanded list of valid extensions (e.g. "text/html" may expand to "*.html,
|
| + /// *.htm").
|
| + String get description => JS('String', '#.description', this._jsObject);
|
| +
|
| + void set description(String description) {
|
| + JS('void', '#.description = #', this._jsObject, description);
|
| + }
|
| +
|
| + /// Mime-types to accept, e.g. "image/jpeg" or "audio/*". One of mimeTypes or
|
| + /// extensions must contain at least one valid element.
|
| + List<String> get mimeTypes => JS('List<String>', '#.mimeTypes', this._jsObject);
|
| +
|
| + void set mimeTypes(List<String> mimeTypes) {
|
| + JS('void', '#.mimeTypes = #', this._jsObject, mimeTypes);
|
| + }
|
| +
|
| + /// Extensions to accept, e.g. "jpg", "gif", "crx".
|
| + List<String> get extensions => JS('List<String>', '#.extensions', this._jsObject);
|
| +
|
| + void set extensions(List<String> extensions) {
|
| + JS('void', '#.extensions = #', this._jsObject, extensions);
|
| + }
|
| +
|
| +}
|
| +
|
| +class FilesystemChooseEntryOptions extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + FilesystemChooseEntryOptions({String type, String suggestedName, List<FilesystemAcceptOption> accepts, bool acceptsAllTypes}) {
|
| + if (?type)
|
| + this.type = type;
|
| + if (?suggestedName)
|
| + this.suggestedName = suggestedName;
|
| + if (?accepts)
|
| + this.accepts = accepts;
|
| + if (?acceptsAllTypes)
|
| + this.acceptsAllTypes = acceptsAllTypes;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + FilesystemChooseEntryOptions._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// Type of the prompt to show. Valid types are 'openFile', 'openWritableFile'
|
| + /// or 'saveFile'.<br/><br/> Both 'openFile' and 'openWritableFile' will prompt
|
| + /// the user to open an existing file, with 'openFile' returning a read-only
|
| + /// FileEntry on success. 'saveFile' will prompt the user to choose an existing
|
| + /// file or a new file, and will return a writable FileEntry. Calls to
|
| + /// chooseFile with either 'openWritableFile' or 'saveFile' will fail unless
|
| + /// the application has the 'write' permission under 'fileSystem'.<br/><br/>
|
| + /// The default is 'openFile'.
|
| + String get type => JS('String', '#.type', this._jsObject);
|
| +
|
| + void set type(String type) {
|
| + JS('void', '#.type = #', this._jsObject, type);
|
| + }
|
| +
|
| + /// The suggested file name that will be presented to the user as the default
|
| + /// name to read or write. This is optional.
|
| + String get suggestedName => JS('String', '#.suggestedName', this._jsObject);
|
| +
|
| + void set suggestedName(String suggestedName) {
|
| + JS('void', '#.suggestedName = #', this._jsObject, suggestedName);
|
| + }
|
| +
|
| + /// The optional list of accept options for this file opener. Each option will
|
| + /// be presented as a unique group to the end-user.
|
| + List<FilesystemAcceptOption> get accepts {
|
| + List<FilesystemAcceptOption> __proxy_accepts = new List<FilesystemAcceptOption>();
|
| + for (var o in JS('List', '#.accepts', this._jsObject)) {
|
| + __proxy_accepts.add(new FilesystemAcceptOption._proxy(o));
|
| + }
|
| + return __proxy_accepts;
|
| + }
|
| +
|
| + void set accepts(List<FilesystemAcceptOption> accepts) {
|
| + JS('void', '#.accepts = #', this._jsObject, convertArgument(accepts));
|
| + }
|
| +
|
| + /// Whether to accept all file types, in addition to the options specified in
|
| + /// the accepts argument. The default is true. If the accepts field is unset or
|
| + /// contains no valid entries, this will always be reset to true.
|
| + bool get acceptsAllTypes => JS('bool', '#.acceptsAllTypes', this._jsObject);
|
| +
|
| + void set acceptsAllTypes(bool acceptsAllTypes) {
|
| + JS('void', '#.acceptsAllTypes = #', this._jsObject, acceptsAllTypes);
|
| + }
|
| +
|
| +}
|
| +
|
| +/**
|
| + * Functions
|
| + */
|
| +
|
| +class API_file_system {
|
| + /*
|
| + * API connection
|
| + */
|
| + Object _jsObject;
|
| +
|
| + /*
|
| + * Functions
|
| + */
|
| + /// Get the display path of a FileEntry object. The display path is based on
|
| + /// the full path of the file on the local file system, but may be made more
|
| + /// readable for display purposes.
|
| + void getDisplayPath(FileEntry fileEntry, void callback(String displayPath)) => JS('void', '#.getDisplayPath(#, #)', this._jsObject, convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
|
| +
|
| + /// Get a writable FileEntry from another FileEntry. This call will fail if the
|
| + /// application does not have the 'write' permission under 'fileSystem'.
|
| + void getWritableEntry(FileEntry fileEntry, void callback(FileEntry fileEntry)) {
|
| + void __proxy_callback(fileEntry) {
|
| + if (?callback) {
|
| + callback(fileEntry);
|
| + }
|
| + }
|
| + JS('void', '#.getWritableEntry(#, #)', this._jsObject, convertArgument(fileEntry), convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Gets whether this FileEntry is writable or not.
|
| + void isWritableEntry(FileEntry fileEntry, void callback(bool isWritable)) => JS('void', '#.isWritableEntry(#, #)', this._jsObject, convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
|
| +
|
| + /// Ask the user to choose a file.
|
| + void chooseEntry(void callback(FileEntry fileEntry), [FilesystemChooseEntryOptions options]) {
|
| + void __proxy_callback(fileEntry) {
|
| + if (?callback) {
|
| + callback(fileEntry);
|
| + }
|
| + }
|
| + JS('void', '#.chooseEntry(#, #)', this._jsObject, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Returns the file entry with the given id.
|
| + FileEntry getEntryById(String id) => new FileEntry._proxy(JS('', '#.getEntryById(#)', this._jsObject, id));
|
| +
|
| + /// Returns the id of the given file entry.
|
| + String getEntryId(FileEntry fileEntry) => JS('String', '#.getEntryId(#)', this._jsObject, convertArgument(fileEntry));
|
| +
|
| + API_file_system(this._jsObject) {
|
| + }
|
| +}
|
|
|