| 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: syncFileSystem |
| 6 |
| 7 part of chrome; |
| 8 |
| 9 /** |
| 10 * Types |
| 11 */ |
| 12 |
| 13 class SyncfilesystemFileInfo extends ChromeObject { |
| 14 /* |
| 15 * Public constructor |
| 16 */ |
| 17 SyncfilesystemFileInfo({FileEntry fileEntry, String status, String action, Str
ing direction}) { |
| 18 if (?fileEntry) |
| 19 this.fileEntry = fileEntry; |
| 20 if (?status) |
| 21 this.status = status; |
| 22 if (?action) |
| 23 this.action = action; |
| 24 if (?direction) |
| 25 this.direction = direction; |
| 26 } |
| 27 |
| 28 /* |
| 29 * Private constructor |
| 30 */ |
| 31 SyncfilesystemFileInfo._proxy(_jsObject) : super._proxy(_jsObject); |
| 32 |
| 33 /* |
| 34 * Public accessors |
| 35 */ |
| 36 /// |fileEntry| will contain name and path information of synchronized file. O
n |
| 37 /// file deletion, fileEntry information will still be available but file will |
| 38 /// no longer exist. |
| 39 FileEntry get fileEntry => JS('FileEntry', '#.fileEntry', this._jsObject); |
| 40 |
| 41 void set fileEntry(FileEntry fileEntry) { |
| 42 JS('void', '#.fileEntry = #', this._jsObject, convertArgument(fileEntry)); |
| 43 } |
| 44 |
| 45 String get status => JS('String', '#.status', this._jsObject); |
| 46 |
| 47 void set status(String status) { |
| 48 JS('void', '#.status = #', this._jsObject, status); |
| 49 } |
| 50 |
| 51 /// Only applies if status is synced. |
| 52 String get action => JS('String', '#.action', this._jsObject); |
| 53 |
| 54 void set action(String action) { |
| 55 JS('void', '#.action = #', this._jsObject, action); |
| 56 } |
| 57 |
| 58 /// Only applies if status is synced. |
| 59 String get direction => JS('String', '#.direction', this._jsObject); |
| 60 |
| 61 void set direction(String direction) { |
| 62 JS('void', '#.direction = #', this._jsObject, direction); |
| 63 } |
| 64 |
| 65 } |
| 66 |
| 67 class SyncfilesystemStorageInfo extends ChromeObject { |
| 68 /* |
| 69 * Public constructor |
| 70 */ |
| 71 SyncfilesystemStorageInfo({int usageBytes, int quotaBytes}) { |
| 72 if (?usageBytes) |
| 73 this.usageBytes = usageBytes; |
| 74 if (?quotaBytes) |
| 75 this.quotaBytes = quotaBytes; |
| 76 } |
| 77 |
| 78 /* |
| 79 * Private constructor |
| 80 */ |
| 81 SyncfilesystemStorageInfo._proxy(_jsObject) : super._proxy(_jsObject); |
| 82 |
| 83 /* |
| 84 * Public accessors |
| 85 */ |
| 86 int get usageBytes => JS('int', '#.usageBytes', this._jsObject); |
| 87 |
| 88 void set usageBytes(int usageBytes) { |
| 89 JS('void', '#.usageBytes = #', this._jsObject, usageBytes); |
| 90 } |
| 91 |
| 92 int get quotaBytes => JS('int', '#.quotaBytes', this._jsObject); |
| 93 |
| 94 void set quotaBytes(int quotaBytes) { |
| 95 JS('void', '#.quotaBytes = #', this._jsObject, quotaBytes); |
| 96 } |
| 97 |
| 98 } |
| 99 |
| 100 class SyncfilesystemServiceInfo extends ChromeObject { |
| 101 /* |
| 102 * Public constructor |
| 103 */ |
| 104 SyncfilesystemServiceInfo({String state, String description}) { |
| 105 if (?state) |
| 106 this.state = state; |
| 107 if (?description) |
| 108 this.description = description; |
| 109 } |
| 110 |
| 111 /* |
| 112 * Private constructor |
| 113 */ |
| 114 SyncfilesystemServiceInfo._proxy(_jsObject) : super._proxy(_jsObject); |
| 115 |
| 116 /* |
| 117 * Public accessors |
| 118 */ |
| 119 String get state => JS('String', '#.state', this._jsObject); |
| 120 |
| 121 void set state(String state) { |
| 122 JS('void', '#.state = #', this._jsObject, state); |
| 123 } |
| 124 |
| 125 String get description => JS('String', '#.description', this._jsObject); |
| 126 |
| 127 void set description(String description) { |
| 128 JS('void', '#.description = #', this._jsObject, description); |
| 129 } |
| 130 |
| 131 } |
| 132 |
| 133 /** |
| 134 * Events |
| 135 */ |
| 136 |
| 137 /// Fired when an error or other status change has happened in the sync |
| 138 /// backend. (e.g. the sync is temporarily disabled due to network or |
| 139 /// authentication error etc). |
| 140 class Event_sync_file_system_onServiceStatusChanged extends Event { |
| 141 void addListener(void callback(SyncfilesystemServiceInfo detail)) { |
| 142 void __proxy_callback(detail) { |
| 143 if (?callback) { |
| 144 callback(new SyncfilesystemServiceInfo._proxy(detail)); |
| 145 } |
| 146 } |
| 147 super.addListener(callback); |
| 148 } |
| 149 |
| 150 void removeListener(void callback(SyncfilesystemServiceInfo detail)) { |
| 151 void __proxy_callback(detail) { |
| 152 if (?callback) { |
| 153 callback(new SyncfilesystemServiceInfo._proxy(detail)); |
| 154 } |
| 155 } |
| 156 super.removeListener(callback); |
| 157 } |
| 158 |
| 159 bool hasListener(void callback(SyncfilesystemServiceInfo detail)) { |
| 160 void __proxy_callback(detail) { |
| 161 if (?callback) { |
| 162 callback(new SyncfilesystemServiceInfo._proxy(detail)); |
| 163 } |
| 164 } |
| 165 super.hasListener(callback); |
| 166 } |
| 167 |
| 168 Event_sync_file_system_onServiceStatusChanged(jsObject) : super._(jsObject, 1)
; |
| 169 } |
| 170 |
| 171 /// Fired when a file has been updated by the background sync service. |
| 172 class Event_sync_file_system_onFileStatusChanged extends Event { |
| 173 void addListener(void callback(SyncfilesystemFileInfo detail)) { |
| 174 void __proxy_callback(detail) { |
| 175 if (?callback) { |
| 176 callback(new SyncfilesystemFileInfo._proxy(detail)); |
| 177 } |
| 178 } |
| 179 super.addListener(callback); |
| 180 } |
| 181 |
| 182 void removeListener(void callback(SyncfilesystemFileInfo detail)) { |
| 183 void __proxy_callback(detail) { |
| 184 if (?callback) { |
| 185 callback(new SyncfilesystemFileInfo._proxy(detail)); |
| 186 } |
| 187 } |
| 188 super.removeListener(callback); |
| 189 } |
| 190 |
| 191 bool hasListener(void callback(SyncfilesystemFileInfo detail)) { |
| 192 void __proxy_callback(detail) { |
| 193 if (?callback) { |
| 194 callback(new SyncfilesystemFileInfo._proxy(detail)); |
| 195 } |
| 196 } |
| 197 super.hasListener(callback); |
| 198 } |
| 199 |
| 200 Event_sync_file_system_onFileStatusChanged(jsObject) : super._(jsObject, 1); |
| 201 } |
| 202 |
| 203 /** |
| 204 * Functions |
| 205 */ |
| 206 |
| 207 class API_sync_file_system { |
| 208 /* |
| 209 * API connection |
| 210 */ |
| 211 Object _jsObject; |
| 212 |
| 213 /* |
| 214 * Events |
| 215 */ |
| 216 Event_sync_file_system_onServiceStatusChanged onServiceStatusChanged; |
| 217 Event_sync_file_system_onFileStatusChanged onFileStatusChanged; |
| 218 |
| 219 /* |
| 220 * Functions |
| 221 */ |
| 222 /// Returns a syncable filesystem backed by Google Drive. The returned |
| 223 /// DOMFileSystem instance can be operated on in the same way as the Temporary |
| 224 /// and Persistant file systems. (http://www.w3.org/TR/file-system-api/). |
| 225 /// Calling this multiple times from the same app will return the same handle |
| 226 /// to the same file system. |
| 227 void requestFileSystem(void callback(DOMFileSystem fileSystem)) { |
| 228 void __proxy_callback(fileSystem) { |
| 229 if (?callback) { |
| 230 callback(fileSystem); |
| 231 } |
| 232 } |
| 233 JS('void', '#.requestFileSystem(#)', this._jsObject, convertDartClosureToJS(
__proxy_callback, 1)); |
| 234 } |
| 235 |
| 236 /// Get usage and quota in bytes for sync file system with |serviceName|. |
| 237 void getUsageAndQuota(DOMFileSystem fileSystem, void callback(SyncfilesystemSt
orageInfo info)) { |
| 238 void __proxy_callback(info) { |
| 239 if (?callback) { |
| 240 callback(new SyncfilesystemStorageInfo._proxy(info)); |
| 241 } |
| 242 } |
| 243 JS('void', '#.getUsageAndQuota(#, #)', this._jsObject, convertArgument(fileS
ystem), convertDartClosureToJS(__proxy_callback, 1)); |
| 244 } |
| 245 |
| 246 /// Deletes everything in the syncable filesystem. |
| 247 void deleteFileSystem(DOMFileSystem fileSystem, void callback(bool result)) =>
JS('void', '#.deleteFileSystem(#, #)', this._jsObject, convertArgument(fileSyst
em), convertDartClosureToJS(callback, 1)); |
| 248 |
| 249 /// Get the FileStatus for the given |fileEntry|. |
| 250 void getFileStatus(FileEntry fileEntry, void callback(String status)) => JS('v
oid', '#.getFileStatus(#, #)', this._jsObject, convertArgument(fileEntry), conve
rtDartClosureToJS(callback, 1)); |
| 251 |
| 252 API_sync_file_system(this._jsObject) { |
| 253 onServiceStatusChanged = new Event_sync_file_system_onServiceStatusChanged(J
S('', '#.onServiceStatusChanged', this._jsObject)); |
| 254 onFileStatusChanged = new Event_sync_file_system_onFileStatusChanged(JS('',
'#.onFileStatusChanged', this._jsObject)); |
| 255 } |
| 256 } |
| OLD | NEW |