| Index: tools/dom/src/chrome/sync_file_system.dart
|
| diff --git a/tools/dom/src/chrome/sync_file_system.dart b/tools/dom/src/chrome/sync_file_system.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..74dec53aa4c563e1048ff753ac5dda8fa7095889
|
| --- /dev/null
|
| +++ b/tools/dom/src/chrome/sync_file_system.dart
|
| @@ -0,0 +1,256 @@
|
| +// 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: syncFileSystem
|
| +
|
| +part of chrome;
|
| +
|
| +/**
|
| + * Types
|
| + */
|
| +
|
| +class SyncfilesystemFileInfo extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + SyncfilesystemFileInfo({FileEntry fileEntry, String status, String action, String direction}) {
|
| + if (?fileEntry)
|
| + this.fileEntry = fileEntry;
|
| + if (?status)
|
| + this.status = status;
|
| + if (?action)
|
| + this.action = action;
|
| + if (?direction)
|
| + this.direction = direction;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + SyncfilesystemFileInfo._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + /// |fileEntry| will contain name and path information of synchronized file. On
|
| + /// file deletion, fileEntry information will still be available but file will
|
| + /// no longer exist.
|
| + FileEntry get fileEntry => JS('FileEntry', '#.fileEntry', this._jsObject);
|
| +
|
| + void set fileEntry(FileEntry fileEntry) {
|
| + JS('void', '#.fileEntry = #', this._jsObject, convertArgument(fileEntry));
|
| + }
|
| +
|
| + String get status => JS('String', '#.status', this._jsObject);
|
| +
|
| + void set status(String status) {
|
| + JS('void', '#.status = #', this._jsObject, status);
|
| + }
|
| +
|
| + /// Only applies if status is synced.
|
| + String get action => JS('String', '#.action', this._jsObject);
|
| +
|
| + void set action(String action) {
|
| + JS('void', '#.action = #', this._jsObject, action);
|
| + }
|
| +
|
| + /// Only applies if status is synced.
|
| + String get direction => JS('String', '#.direction', this._jsObject);
|
| +
|
| + void set direction(String direction) {
|
| + JS('void', '#.direction = #', this._jsObject, direction);
|
| + }
|
| +
|
| +}
|
| +
|
| +class SyncfilesystemStorageInfo extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + SyncfilesystemStorageInfo({int usageBytes, int quotaBytes}) {
|
| + if (?usageBytes)
|
| + this.usageBytes = usageBytes;
|
| + if (?quotaBytes)
|
| + this.quotaBytes = quotaBytes;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + SyncfilesystemStorageInfo._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + int get usageBytes => JS('int', '#.usageBytes', this._jsObject);
|
| +
|
| + void set usageBytes(int usageBytes) {
|
| + JS('void', '#.usageBytes = #', this._jsObject, usageBytes);
|
| + }
|
| +
|
| + int get quotaBytes => JS('int', '#.quotaBytes', this._jsObject);
|
| +
|
| + void set quotaBytes(int quotaBytes) {
|
| + JS('void', '#.quotaBytes = #', this._jsObject, quotaBytes);
|
| + }
|
| +
|
| +}
|
| +
|
| +class SyncfilesystemServiceInfo extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + SyncfilesystemServiceInfo({String state, String description}) {
|
| + if (?state)
|
| + this.state = state;
|
| + if (?description)
|
| + this.description = description;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + SyncfilesystemServiceInfo._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| + String get state => JS('String', '#.state', this._jsObject);
|
| +
|
| + void set state(String state) {
|
| + JS('void', '#.state = #', this._jsObject, state);
|
| + }
|
| +
|
| + String get description => JS('String', '#.description', this._jsObject);
|
| +
|
| + void set description(String description) {
|
| + JS('void', '#.description = #', this._jsObject, description);
|
| + }
|
| +
|
| +}
|
| +
|
| +/**
|
| + * Events
|
| + */
|
| +
|
| +/// Fired when an error or other status change has happened in the sync
|
| +/// backend. (e.g. the sync is temporarily disabled due to network or
|
| +/// authentication error etc).
|
| +class Event_sync_file_system_onServiceStatusChanged extends Event {
|
| + void addListener(void callback(SyncfilesystemServiceInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemServiceInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.addListener(callback);
|
| + }
|
| +
|
| + void removeListener(void callback(SyncfilesystemServiceInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemServiceInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.removeListener(callback);
|
| + }
|
| +
|
| + bool hasListener(void callback(SyncfilesystemServiceInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemServiceInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.hasListener(callback);
|
| + }
|
| +
|
| + Event_sync_file_system_onServiceStatusChanged(jsObject) : super._(jsObject, 1);
|
| +}
|
| +
|
| +/// Fired when a file has been updated by the background sync service.
|
| +class Event_sync_file_system_onFileStatusChanged extends Event {
|
| + void addListener(void callback(SyncfilesystemFileInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemFileInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.addListener(callback);
|
| + }
|
| +
|
| + void removeListener(void callback(SyncfilesystemFileInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemFileInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.removeListener(callback);
|
| + }
|
| +
|
| + bool hasListener(void callback(SyncfilesystemFileInfo detail)) {
|
| + void __proxy_callback(detail) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemFileInfo._proxy(detail));
|
| + }
|
| + }
|
| + super.hasListener(callback);
|
| + }
|
| +
|
| + Event_sync_file_system_onFileStatusChanged(jsObject) : super._(jsObject, 1);
|
| +}
|
| +
|
| +/**
|
| + * Functions
|
| + */
|
| +
|
| +class API_sync_file_system {
|
| + /*
|
| + * API connection
|
| + */
|
| + Object _jsObject;
|
| +
|
| + /*
|
| + * Events
|
| + */
|
| + Event_sync_file_system_onServiceStatusChanged onServiceStatusChanged;
|
| + Event_sync_file_system_onFileStatusChanged onFileStatusChanged;
|
| +
|
| + /*
|
| + * Functions
|
| + */
|
| + /// Returns a syncable filesystem backed by Google Drive. The returned
|
| + /// DOMFileSystem instance can be operated on in the same way as the Temporary
|
| + /// and Persistant file systems. (http://www.w3.org/TR/file-system-api/).
|
| + /// Calling this multiple times from the same app will return the same handle
|
| + /// to the same file system.
|
| + void requestFileSystem(void callback(DOMFileSystem fileSystem)) {
|
| + void __proxy_callback(fileSystem) {
|
| + if (?callback) {
|
| + callback(fileSystem);
|
| + }
|
| + }
|
| + JS('void', '#.requestFileSystem(#)', this._jsObject, convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Get usage and quota in bytes for sync file system with |serviceName|.
|
| + void getUsageAndQuota(DOMFileSystem fileSystem, void callback(SyncfilesystemStorageInfo info)) {
|
| + void __proxy_callback(info) {
|
| + if (?callback) {
|
| + callback(new SyncfilesystemStorageInfo._proxy(info));
|
| + }
|
| + }
|
| + JS('void', '#.getUsageAndQuota(#, #)', this._jsObject, convertArgument(fileSystem), convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
| +
|
| + /// Deletes everything in the syncable filesystem.
|
| + void deleteFileSystem(DOMFileSystem fileSystem, void callback(bool result)) => JS('void', '#.deleteFileSystem(#, #)', this._jsObject, convertArgument(fileSystem), convertDartClosureToJS(callback, 1));
|
| +
|
| + /// Get the FileStatus for the given |fileEntry|.
|
| + void getFileStatus(FileEntry fileEntry, void callback(String status)) => JS('void', '#.getFileStatus(#, #)', this._jsObject, convertArgument(fileEntry), convertDartClosureToJS(callback, 1));
|
| +
|
| + API_sync_file_system(this._jsObject) {
|
| + onServiceStatusChanged = new Event_sync_file_system_onServiceStatusChanged(JS('', '#.onServiceStatusChanged', this._jsObject));
|
| + onFileStatusChanged = new Event_sync_file_system_onFileStatusChanged(JS('', '#.onFileStatusChanged', this._jsObject));
|
| + }
|
| +}
|
|
|