| OLD | NEW |
| 1 /// Native wrappers for the Chrome Packaged App APIs. | 1 /// Native wrappers for the Chrome packaged app APIs. |
| 2 /// | 2 /// |
| 3 /// These functions allow direct access to the Packaged App APIs, allowing | 3 /// These functions allow direct access to the chrome.* APIs, allowing |
| 4 /// Chrome Packaged Apps to be written using Dart. | 4 /// Chrome packaged apps to be written using Dart. |
| 5 /// | 5 /// |
| 6 /// For more information on these APIs, see the Chrome.* APIs Documentation: | 6 /// For more information on these APIs, see the |
| 7 /// http://developer.chrome.com/extensions/api_index.html | 7 /// [chrome.* API documentation](http://developer.chrome.com/apps/api_index.html
). |
| 8 library chrome; | 8 library chrome; |
| 9 | 9 |
| 10 import 'dart:_foreign_helper' show JS; | 10 import 'dart:_foreign_helper' show JS; |
| 11 import 'dart:_js_helper'; | 11 import 'dart:_js_helper'; |
| 12 import 'dart:html_common'; | 12 import 'dart:html_common'; |
| 13 import 'dart:html'; | 13 import 'dart:html'; |
| 14 | 14 |
| 15 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 15 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 16 // for details. All rights reserved. Use of this source code is governed by a | 16 // for details. All rights reserved. Use of this source code is governed by a |
| 17 // BSD-style license that can be found in the LICENSE file. | 17 // BSD-style license that can be found in the LICENSE file. |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 class API_Chrome { | 356 class API_Chrome { |
| 357 /* | 357 /* |
| 358 * JS Variable | 358 * JS Variable |
| 359 */ | 359 */ |
| 360 Object _jsObject; | 360 Object _jsObject; |
| 361 | 361 |
| 362 /* | 362 /* |
| 363 * Members | 363 * Members |
| 364 */ | 364 */ |
| 365 API_ChromeApp app; | 365 API_ChromeApp app; |
| 366 API_file_system fileSystem; |
| 366 | 367 |
| 367 /* | 368 /* |
| 368 * Constructor | 369 * Constructor |
| 369 */ | 370 */ |
| 370 API_Chrome() { | 371 API_Chrome() { |
| 371 this._jsObject = JS("Object", "chrome"); | 372 this._jsObject = JS("Object", "chrome"); |
| 372 if (this._jsObject == null) | 373 if (this._jsObject == null) |
| 373 throw new UnsupportedError('Not supported by current browser.'); | 374 throw new UnsupportedError('Not supported by current browser.'); |
| 374 | 375 |
| 375 var app_object = JS('', '#.app', this._jsObject); | 376 var app_object = JS('', '#.app', this._jsObject); |
| 376 if (app_object == null) | 377 if (app_object == null) |
| 377 throw new UnsupportedError('Not supported by current browser.'); | 378 throw new UnsupportedError('Not supported by current browser.'); |
| 378 app = new API_ChromeApp(app_object); | 379 app = new API_ChromeApp(app_object); |
| 380 |
| 381 var file_system_object = JS('', '#.fileSystem', this._jsObject); |
| 382 if (file_system_object == null) |
| 383 throw new UnsupportedError('Not supported by current browser.'); |
| 384 fileSystem = new API_file_system(file_system_object); |
| 379 } | 385 } |
| 380 } | 386 } |
| 381 | 387 |
| 382 // The final chrome objects | 388 // The final chrome objects |
| 383 final API_Chrome chrome = new API_Chrome(); | 389 final API_Chrome chrome = new API_Chrome(); |
| 384 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 390 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 385 // for details. All rights reserved. Use of this source code is governed by a | 391 // for details. All rights reserved. Use of this source code is governed by a |
| 386 // BSD-style license that can be found in the LICENSE file. | 392 // BSD-style license that can be found in the LICENSE file. |
| 387 | 393 |
| 388 // Generated from namespace: app.window | 394 // Generated from namespace: app.window |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1237 /// given file entry. Only the 500 most recently used entries are retained, | 1243 /// given file entry. Only the 500 most recently used entries are retained, |
| 1238 /// where calls to retainEntry and restoreEntry count as use. If the app has | 1244 /// where calls to retainEntry and restoreEntry count as use. If the app has |
| 1239 /// the 'retainEntries' permission under 'fileSystem', entries are retained | 1245 /// the 'retainEntries' permission under 'fileSystem', entries are retained |
| 1240 /// indefinitely. Otherwise, entries are retained only while the app is runnin
g | 1246 /// indefinitely. Otherwise, entries are retained only while the app is runnin
g |
| 1241 /// and across restarts. | 1247 /// and across restarts. |
| 1242 String retainEntry(FileEntry fileEntry) => JS('String', '#.retainEntry(#)', th
is._jsObject, convertArgument(fileEntry)); | 1248 String retainEntry(FileEntry fileEntry) => JS('String', '#.retainEntry(#)', th
is._jsObject, convertArgument(fileEntry)); |
| 1243 | 1249 |
| 1244 API_file_system(this._jsObject) { | 1250 API_file_system(this._jsObject) { |
| 1245 } | 1251 } |
| 1246 } | 1252 } |
| OLD | NEW |