| OLD | NEW |
| 1 library chrome; | 1 library chrome; |
| 2 | 2 |
| 3 import 'dart:_foreign_helper' show JS; | 3 import 'dart:_foreign_helper' show JS; |
| 4 import 'dart:_js_helper'; |
| 4 import 'dart:html_common'; | 5 import 'dart:html_common'; |
| 5 import 'dart:html'; | 6 import 'dart:html'; |
| 7 |
| 6 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 8 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 7 // for details. All rights reserved. Use of this source code is governed by a | 9 // for details. All rights reserved. Use of this source code is governed by a |
| 8 // BSD-style license that can be found in the LICENSE file. | 10 // BSD-style license that can be found in the LICENSE file. |
| 9 | 11 |
| 10 // DO NOT EDIT | 12 // DO NOT EDIT |
| 11 // Auto-generated dart:chrome library. | 13 // Auto-generated dart:chrome library. |
| 12 | 14 |
| 15 /// Native wrappers for the Chrome Packaged App APIs. |
| 16 /// |
| 17 /// These functions allow direct access to the Packaged App APIs, allowing |
| 18 /// Chrome Packaged Apps to be written using Dart. |
| 19 /// |
| 20 /// For more information on these APIs, see the Chrome.* APIs Documentation: |
| 21 /// http://developer.chrome.com/extensions/api_index.html |
| 22 |
| 23 /* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */ |
| 13 | 24 |
| 14 | 25 |
| 15 | 26 // Generated files below this line. |
| 16 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 27 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 17 // for details. All rights reserved. Use of this source code is governed by a | 28 // for details. All rights reserved. Use of this source code is governed by a |
| 18 // BSD-style license that can be found in the LICENSE file. | 29 // BSD-style license that can be found in the LICENSE file. |
| 19 | 30 |
| 20 /** | 31 /** |
| 21 * A set of utilities for use with the Chrome Extension APIs. | 32 * A set of utilities for use with the Chrome Extension APIs. |
| 22 * | 33 * |
| 23 * Allows for easy access to required JS objects. | 34 * Allows for easy access to required JS objects. |
| 24 */ | 35 */ |
| 25 | 36 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // chrome.app | 326 // chrome.app |
| 316 class API_ChromeApp { | 327 class API_ChromeApp { |
| 317 /* | 328 /* |
| 318 * JS Variable | 329 * JS Variable |
| 319 */ | 330 */ |
| 320 Object _jsObject; | 331 Object _jsObject; |
| 321 | 332 |
| 322 /* | 333 /* |
| 323 * Members | 334 * Members |
| 324 */ | 335 */ |
| 325 API_ChromeAppWindow window; | 336 API_app_window window; |
| 326 API_ChromeAppRuntime runtime; | 337 API_app_runtime runtime; |
| 327 | 338 |
| 328 /* | 339 /* |
| 329 * Constructor | 340 * Constructor |
| 330 */ | 341 */ |
| 331 API_ChromeApp(this._jsObject) { | 342 API_ChromeApp(this._jsObject) { |
| 332 var window_object = JS('', '#.window', this._jsObject); | 343 var window_object = JS('', '#.window', this._jsObject); |
| 333 if (window_object == null) | 344 if (window_object == null) |
| 334 throw new UnsupportedError('Not supported by current browser.'); | 345 throw new UnsupportedError('Not supported by current browser.'); |
| 335 window = new API_ChromeAppWindow(window_object); | 346 window = new API_app_window(window_object); |
| 336 | 347 |
| 337 var runtime_object = JS('', '#.runtime', this._jsObject); | 348 var runtime_object = JS('', '#.runtime', this._jsObject); |
| 338 if (runtime_object == null) | 349 if (runtime_object == null) |
| 339 throw new UnsupportedError('Not supported by current browser.'); | 350 throw new UnsupportedError('Not supported by current browser.'); |
| 340 runtime = new API_ChromeAppRuntime(runtime_object); | 351 runtime = new API_app_runtime(runtime_object); |
| 341 } | 352 } |
| 342 } | 353 } |
| 343 | 354 |
| 344 // chrome | 355 // chrome |
| 345 class API_Chrome { | 356 class API_Chrome { |
| 346 /* | 357 /* |
| 347 * JS Variable | 358 * JS Variable |
| 348 */ | 359 */ |
| 349 Object _jsObject; | 360 Object _jsObject; |
| 350 | 361 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 367 app = new API_ChromeApp(app_object); | 378 app = new API_ChromeApp(app_object); |
| 368 } | 379 } |
| 369 } | 380 } |
| 370 | 381 |
| 371 // The final chrome objects | 382 // The final chrome objects |
| 372 final API_Chrome chrome = new API_Chrome(); | 383 final API_Chrome chrome = new API_Chrome(); |
| 373 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 384 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 374 // for details. All rights reserved. Use of this source code is governed by a | 385 // for details. All rights reserved. Use of this source code is governed by a |
| 375 // BSD-style license that can be found in the LICENSE file. | 386 // BSD-style license that can be found in the LICENSE file. |
| 376 | 387 |
| 377 // from app_runtime.idl | 388 // Generated from namespace: app.window |
| 389 |
| 378 | 390 |
| 379 /** | 391 /** |
| 380 * Types | 392 * Types |
| 381 */ | 393 */ |
| 382 | 394 |
| 383 /// A WebIntents intent object. Deprecated. | 395 class AppWindowCreateWindowOptions extends ChromeObject { |
| 384 class Intent extends ChromeObject { | |
| 385 /* | |
| 386 * Public (Dart) constructor | |
| 387 */ | |
| 388 Intent({String action, String type, var data}) { | |
| 389 this.action = action; | |
| 390 this.type = type; | |
| 391 this.data = data; | |
| 392 } | |
| 393 | |
| 394 /* | |
| 395 * Private (JS) constructor | |
| 396 */ | |
| 397 Intent._proxy(_jsObject) : super._proxy(_jsObject); | |
| 398 | |
| 399 /* | |
| 400 * Public accessors | |
| 401 */ | |
| 402 | |
| 403 /// The WebIntent being invoked. | |
| 404 String get action => JS('String', '#.action', this._jsObject); | |
| 405 | |
| 406 void set action(String action) { | |
| 407 JS('void', '#.action = #', this._jsObject, action); | |
| 408 } | |
| 409 | |
| 410 /// The MIME type of the data. | |
| 411 String get type => JS('String', '#.type', this._jsObject); | |
| 412 | |
| 413 void set type(String type) { | |
| 414 JS('void', '#.type = #', this._jsObject, type); | |
| 415 } | |
| 416 | |
| 417 /// Data associated with the intent. | |
| 418 // TODO(sashab): What is the best way to serialize/return generic JS objects? | |
| 419 Object get data => JS('Object', '#.data', this._jsObject); | |
| 420 | |
| 421 void set data(Object data) { | |
| 422 JS('void', '#.data = #', this._jsObject, convertArgument(data)); | |
| 423 } | |
| 424 | |
| 425 /* | |
| 426 * TODO(sashab): What is a NullCallback() type? | |
| 427 * Add postResult and postFailure once understanding what this type is, and | |
| 428 * once there is a way to pass functions back from JS. | |
| 429 */ | |
| 430 } | |
| 431 | |
| 432 class LaunchItem extends ChromeObject { | |
| 433 /* | 396 /* |
| 434 * Public constructor | 397 * Public constructor |
| 435 */ | 398 */ |
| 436 LaunchItem({FileEntry entry, String type}) { | 399 AppWindowCreateWindowOptions({String id, int defaultWidth, int defaultHeight,
int defaultLeft, int defaultTop, int width, int height, int left, int top, int m
inWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame,
AppWindowBounds bounds, bool transparentBackground, bool hidden, bool singleton}
) { |
| 437 this.entry = entry; | 400 if (?id) |
| 438 this.type = type; | 401 this.id = id; |
| 402 if (?defaultWidth) |
| 403 this.defaultWidth = defaultWidth; |
| 404 if (?defaultHeight) |
| 405 this.defaultHeight = defaultHeight; |
| 406 if (?defaultLeft) |
| 407 this.defaultLeft = defaultLeft; |
| 408 if (?defaultTop) |
| 409 this.defaultTop = defaultTop; |
| 410 if (?width) |
| 411 this.width = width; |
| 412 if (?height) |
| 413 this.height = height; |
| 414 if (?left) |
| 415 this.left = left; |
| 416 if (?top) |
| 417 this.top = top; |
| 418 if (?minWidth) |
| 419 this.minWidth = minWidth; |
| 420 if (?minHeight) |
| 421 this.minHeight = minHeight; |
| 422 if (?maxWidth) |
| 423 this.maxWidth = maxWidth; |
| 424 if (?maxHeight) |
| 425 this.maxHeight = maxHeight; |
| 426 if (?type) |
| 427 this.type = type; |
| 428 if (?frame) |
| 429 this.frame = frame; |
| 430 if (?bounds) |
| 431 this.bounds = bounds; |
| 432 if (?transparentBackground) |
| 433 this.transparentBackground = transparentBackground; |
| 434 if (?hidden) |
| 435 this.hidden = hidden; |
| 436 if (?singleton) |
| 437 this.singleton = singleton; |
| 439 } | 438 } |
| 440 | 439 |
| 441 /* | 440 /* |
| 442 * Private constructor | 441 * Private constructor |
| 443 */ | 442 */ |
| 444 LaunchItem._proxy(_jsObject) : super._proxy(_jsObject); | 443 AppWindowCreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject); |
| 445 | 444 |
| 446 /* | 445 /* |
| 447 * Public accessors | 446 * Public accessors |
| 448 */ | 447 */ |
| 449 | 448 /// Id to identify the window. This will be used to remember the size and |
| 450 /// FileEntry for the file. | 449 /// position of the window and restore that geometry when a window with the |
| 451 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject); | 450 /// same id (and no explicit size or position) is later opened. |
| 452 | |
| 453 void set entry(FileEntry entry) { | |
| 454 JS('void', '#.entry = #', this._jsObject, entry); | |
| 455 } | |
| 456 | |
| 457 /// The MIME type of the file. | |
| 458 String get type => JS('String', '#.type', this._jsObject); | |
| 459 | |
| 460 void set type(String type) { | |
| 461 JS('void', '#.type = #', this._jsObject, type); | |
| 462 } | |
| 463 } | |
| 464 | |
| 465 /// Optional data for the launch. | |
| 466 class LaunchData extends ChromeObject { | |
| 467 /* | |
| 468 * Public constructor | |
| 469 */ | |
| 470 LaunchData({Intent intent, String id, List<LaunchItem> items}) { | |
| 471 this.intent = intent; | |
| 472 this.id = id; | |
| 473 this.items = items; | |
| 474 } | |
| 475 | |
| 476 /* | |
| 477 * Private constructor | |
| 478 */ | |
| 479 LaunchData._proxy(_jsObject) : super._proxy(_jsObject); | |
| 480 | |
| 481 /* | |
| 482 * Public accessors | |
| 483 */ | |
| 484 Intent get intent => new Intent._proxy(JS('', '#.intent', this._jsObject)); | |
| 485 | |
| 486 void set intent(Intent intent) { | |
| 487 JS('void', '#.intent = #', this._jsObject, convertArgument(intent)); | |
| 488 } | |
| 489 | |
| 490 /// The id of the file handler that the app is being invoked with. | |
| 491 String get id => JS('String', '#.id', this._jsObject); | 451 String get id => JS('String', '#.id', this._jsObject); |
| 492 | 452 |
| 493 void set id(String id) { | 453 void set id(String id) { |
| 494 JS('void', '#.id = #', this._jsObject, id); | |
| 495 } | |
| 496 | |
| 497 List<LaunchItem> get items() { | |
| 498 List<LaunchItem> items_final = new List<LaunchItem>(); | |
| 499 for (var o in JS('List', '#.items', this._jsObject)) { | |
| 500 items_final.add(new LaunchItem._proxy(o)); | |
| 501 } | |
| 502 return items_final; | |
| 503 } | |
| 504 | |
| 505 void set items(List<LaunchItem> items) { | |
| 506 JS('void', '#.items = #', this._jsObject, convertArgument(items)); | |
| 507 } | |
| 508 } | |
| 509 | |
| 510 class IntentResponse extends ChromeObject { | |
| 511 /* | |
| 512 * Public constructor | |
| 513 */ | |
| 514 IntentResponse({int intentId, bool success, Object data}) { | |
| 515 this.intentId = intentId; | |
| 516 this.success = success; | |
| 517 this.data = data; | |
| 518 } | |
| 519 | |
| 520 /* | |
| 521 * Private constructor | |
| 522 */ | |
| 523 IntentResponse._proxy(_jsObject) : super._proxy(_jsObject); | |
| 524 | |
| 525 /* | |
| 526 * Public accessors | |
| 527 */ | |
| 528 | |
| 529 /// Identifies the intent. | |
| 530 int get intentId => JS('int', '#.intentId', this._jsObject); | |
| 531 | |
| 532 void set intentId(int intentId) { | |
| 533 JS('void', '#.intentId = #', this._jsObject, intentId); | |
| 534 } | |
| 535 | |
| 536 /// Was this intent successful? (i.e., postSuccess vs postFailure). | |
| 537 bool get success => JS('bool', '#.success', this._jsObject); | |
| 538 | |
| 539 void set success(bool success) { | |
| 540 JS('void', '#.success = #', this._jsObject, success); | |
| 541 } | |
| 542 | |
| 543 /// Data associated with the intent response. | |
| 544 // TODO(sashab): What's the best way to serialize/return generic JS objects? | |
| 545 Object get data => JS('Object', '#.data', this._jsObject); | |
| 546 | |
| 547 void set data(Object data) { | |
| 548 JS('void', '#.data = #', this._jsObject, convertArgument(data)); | |
| 549 } | |
| 550 } | |
| 551 | |
| 552 /** | |
| 553 * Events | |
| 554 */ | |
| 555 | |
| 556 /// Fired at Chrome startup to apps that were running when Chrome last shut | |
| 557 /// down. | |
| 558 class Event_ChromeAppRuntimeOnRestarted extends Event { | |
| 559 /* | |
| 560 * Override callback type definitions | |
| 561 */ | |
| 562 void addListener(void callback()) | |
| 563 => super.addListener(callback); | |
| 564 void removeListener(void callback()) | |
| 565 => super.removeListener(callback); | |
| 566 bool hasListener(void callback()) | |
| 567 => super.hasListener(callback); | |
| 568 | |
| 569 /* | |
| 570 * Constructor | |
| 571 */ | |
| 572 Event_ChromeAppRuntimeOnRestarted(jsObject) : super._(jsObject, 0); | |
| 573 } | |
| 574 | |
| 575 /// Fired when an app is launched from the launcher or in response to a web | |
| 576 /// intent. | |
| 577 class Event_ChromeAppRuntimeOnLaunched extends Event { | |
| 578 /* | |
| 579 * Override callback type definitions | |
| 580 */ | |
| 581 void addListener(void callback(LaunchData launchData)) | |
| 582 => super.addListener(callback); | |
| 583 void removeListener(void callback(LaunchData launchData)) | |
| 584 => super.removeListener(callback); | |
| 585 bool hasListener(void callback(LaunchData launchData)) | |
| 586 => super.hasListener(callback); | |
| 587 | |
| 588 /* | |
| 589 * Constructor | |
| 590 */ | |
| 591 Event_ChromeAppRuntimeOnLaunched(jsObject) : super._(jsObject, 1); | |
| 592 } | |
| 593 | |
| 594 /** | |
| 595 * Functions | |
| 596 */ | |
| 597 class API_ChromeAppRuntime { | |
| 598 /* | |
| 599 * API connection | |
| 600 */ | |
| 601 Object _jsObject; | |
| 602 | |
| 603 /* | |
| 604 * Events | |
| 605 */ | |
| 606 Event_ChromeAppRuntimeOnRestarted onRestarted; | |
| 607 Event_ChromeAppRuntimeOnLaunched onLaunched; | |
| 608 | |
| 609 /* | |
| 610 * Functions | |
| 611 */ | |
| 612 void postIntentResponse(IntentResponse intentResponse) => | |
| 613 JS('void', '#.postIntentResponse(#)', this._jsObject, | |
| 614 convertArgument(intentResponse)); | |
| 615 | |
| 616 /* | |
| 617 * Constructor | |
| 618 */ | |
| 619 API_ChromeAppRuntime(this._jsObject) { | |
| 620 onRestarted = new Event_ChromeAppRuntimeOnRestarted(JS('Object', | |
| 621 '#.onRestarted', | |
| 622 this._jsObject)); | |
| 623 onLaunched = new Event_ChromeAppRuntimeOnLaunched(JS('Object', | |
| 624 '#.onLaunched', | |
| 625 this._jsObject)); | |
| 626 } | |
| 627 } | |
| 628 | |
| 629 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
| 630 // for details. All rights reserved. Use of this source code is governed by a | |
| 631 // BSD-style license that can be found in the LICENSE file. | |
| 632 | |
| 633 // from app.window.idl | |
| 634 | |
| 635 /** | |
| 636 * Types | |
| 637 */ | |
| 638 class CreateWindowOptions extends ChromeObject { | |
| 639 /* | |
| 640 * Public constructor | |
| 641 */ | |
| 642 CreateWindowOptions({String id, int defaultWidth, int defaultHeight, | |
| 643 int defaultLeft, int defaultTop, int width, int height, int left, int top, | |
| 644 int minWidth, int minHeight, int maxWidth, int maxHeight, String type, | |
| 645 String frame, Bounds bounds, bool hidden}) { | |
| 646 this.id = id; | |
| 647 this.defaultWidth = defaultWidth; | |
| 648 this.defaultHeight = defaultHeight; | |
| 649 this.defaultLeft = defaultLeft; | |
| 650 this.defaultTop = defaultTop; | |
| 651 this.width = width; | |
| 652 this.height = height; | |
| 653 this.left = left; | |
| 654 this.top = top; | |
| 655 this.minWidth = minWidth; | |
| 656 this.minHeight = minHeight; | |
| 657 this.maxWidth = maxWidth; | |
| 658 this.maxHeight = maxHeight; | |
| 659 this.type = type; | |
| 660 this.frame = frame; | |
| 661 this.bounds = bounds; | |
| 662 this.hidden = hidden; | |
| 663 } | |
| 664 | |
| 665 /* | |
| 666 * Private constructor | |
| 667 */ | |
| 668 CreateWindowOptions._proxy(_jsObject) : super._proxy(_jsObject); | |
| 669 | |
| 670 /* | |
| 671 * Public accessors | |
| 672 */ | |
| 673 /// Id to identify the window. This will be used to remember the size | |
| 674 /// and position of the window and restore that geometry when a window | |
| 675 /// with the same id (and no explicit size or position) is later opened. | |
| 676 String get id => JS('String', '#.id', this._jsObject); | |
| 677 | |
| 678 void set id(String id) { | |
| 679 JS('void', '#.id = #', this._jsObject, id); | 454 JS('void', '#.id = #', this._jsObject, id); |
| 680 } | 455 } |
| 681 | 456 |
| 682 /// Default width of the window. (Deprecated; regular bounds act like this | 457 /// Default width of the window. (Deprecated; regular bounds act like this |
| 683 /// now.) | 458 /// now.) |
| 684 int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject); | 459 int get defaultWidth => JS('int', '#.defaultWidth', this._jsObject); |
| 685 | 460 |
| 686 void set defaultWidth(int defaultWidth) { | 461 void set defaultWidth(int defaultWidth) { |
| 687 JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth); | 462 JS('void', '#.defaultWidth = #', this._jsObject, defaultWidth); |
| 688 } | 463 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 JS('void', '#.left = #', this._jsObject, left); | 507 JS('void', '#.left = #', this._jsObject, left); |
| 733 } | 508 } |
| 734 | 509 |
| 735 /// Y coordinate of the window. (Deprecated; use 'bounds'.) | 510 /// Y coordinate of the window. (Deprecated; use 'bounds'.) |
| 736 int get top => JS('int', '#.top', this._jsObject); | 511 int get top => JS('int', '#.top', this._jsObject); |
| 737 | 512 |
| 738 void set top(int top) { | 513 void set top(int top) { |
| 739 JS('void', '#.top = #', this._jsObject, top); | 514 JS('void', '#.top = #', this._jsObject, top); |
| 740 } | 515 } |
| 741 | 516 |
| 742 /// Minimium width of the window. | 517 /// Minimum width of the window. |
| 743 int get minWidth => JS('int', '#.minWidth', this._jsObject); | 518 int get minWidth => JS('int', '#.minWidth', this._jsObject); |
| 744 | 519 |
| 745 void set minWidth(int minWidth) { | 520 void set minWidth(int minWidth) { |
| 746 JS('void', '#.minWidth = #', this._jsObject, minWidth); | 521 JS('void', '#.minWidth = #', this._jsObject, minWidth); |
| 747 } | 522 } |
| 748 | 523 |
| 749 /// Minimum height of the window. | 524 /// Minimum height of the window. |
| 750 int get minHeight => JS('int', '#.minHeight', this._jsObject); | 525 int get minHeight => JS('int', '#.minHeight', this._jsObject); |
| 751 | 526 |
| 752 void set minHeight(int minHeight) { | 527 void set minHeight(int minHeight) { |
| 753 JS('void', '#.minHeight = #', this._jsObject, minHeight); | 528 JS('void', '#.minHeight = #', this._jsObject, minHeight); |
| 754 } | 529 } |
| 755 | 530 |
| 756 /// Maximum width of the window. | 531 /// Maximum width of the window. |
| 757 int get maxWidth => JS('int', '#.maxWidth', this._jsObject); | 532 int get maxWidth => JS('int', '#.maxWidth', this._jsObject); |
| 758 | 533 |
| 759 void set maxWidth(int maxWidth) { | 534 void set maxWidth(int maxWidth) { |
| 760 JS('void', '#.maxWidth = #', this._jsObject, maxWidth); | 535 JS('void', '#.maxWidth = #', this._jsObject, maxWidth); |
| 761 } | 536 } |
| 762 | 537 |
| 763 /// Maximum height of the window. | 538 /// Maximum height of the window. |
| 764 int get maxHeight => JS('int', '#.maxHeight', this._jsObject); | 539 int get maxHeight => JS('int', '#.maxHeight', this._jsObject); |
| 765 | 540 |
| 766 void set maxHeight(int maxHeight) { | 541 void set maxHeight(int maxHeight) { |
| 767 JS('void', '#.maxHeight = #', this._jsObject, maxHeight); | 542 JS('void', '#.maxHeight = #', this._jsObject, maxHeight); |
| 768 } | 543 } |
| 769 | 544 |
| 770 /// Window type: 'shell' (the default) is the only currently supported value. | 545 /// Window type: 'shell' - the default window type 'panel' - a panel, manage
d |
| 546 /// by the OS (Currently experimental, Ash only) |
| 771 String get type => JS('String', '#.type', this._jsObject); | 547 String get type => JS('String', '#.type', this._jsObject); |
| 772 | 548 |
| 773 void set type(String type) { | 549 void set type(String type) { |
| 774 JS('void', '#.type = #', this._jsObject, type); | 550 JS('void', '#.type = #', this._jsObject, type); |
| 775 } | 551 } |
| 776 | 552 |
| 777 /// Frame type: 'none' or 'chrome' (defaults to 'chrome'). | 553 /// Frame type: 'none' or 'chrome' (defaults to 'chrome'). |
| 778 String get frame => JS('String', '#.frame', this._jsObject); | 554 String get frame => JS('String', '#.frame', this._jsObject); |
| 779 | 555 |
| 780 void set frame(String frame) { | 556 void set frame(String frame) { |
| 781 JS('void', '#.frame = #', this._jsObject, frame); | 557 JS('void', '#.frame = #', this._jsObject, frame); |
| 782 } | 558 } |
| 783 | 559 |
| 784 /// Size of the content in the window (excluding the titlebar). If specified | 560 /// Size of the content in the window (excluding the titlebar). If specified i
n |
| 785 /// in addition to any of the left/top/width/height parameters, this field | 561 /// addition to any of the left/top/width/height parameters, this field takes |
| 786 /// takes precedence. If a frameBounds is specified, the frameBounds take | 562 /// precedence. If a frameBounds is specified, the frameBounds take precedence
. |
| 787 /// precedence. | 563 AppWindowBounds get bounds => new AppWindowBounds._proxy(JS('', '#.bounds', th
is._jsObject)); |
| 788 Bounds get bounds => | |
| 789 new Bounds._proxy(JS('Bounds', '#.bounds', this._jsObject)); | |
| 790 | 564 |
| 791 void set bounds(Bounds bounds) { | 565 void set bounds(AppWindowBounds bounds) { |
| 792 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds)); | 566 JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds)); |
| 793 } | 567 } |
| 794 | 568 |
| 795 /// If true, the window will be created in a hidden state. Call show() on | 569 /// Enable window background transparency. Only supported in ash. Requires |
| 796 /// the window to show it once it has been created. Defaults to false. | 570 /// experimental API permission. |
| 571 bool get transparentBackground => JS('bool', '#.transparentBackground', this._
jsObject); |
| 572 |
| 573 void set transparentBackground(bool transparentBackground) { |
| 574 JS('void', '#.transparentBackground = #', this._jsObject, transparentBackgro
und); |
| 575 } |
| 576 |
| 577 /// If true, the window will be created in a hidden state. Call show() on the |
| 578 /// window to show it once it has been created. Defaults to false. |
| 797 bool get hidden => JS('bool', '#.hidden', this._jsObject); | 579 bool get hidden => JS('bool', '#.hidden', this._jsObject); |
| 798 | 580 |
| 799 void set hidden(bool hidden) { | 581 void set hidden(bool hidden) { |
| 800 JS('void', '#.hidden = #', this._jsObject, hidden); | 582 JS('void', '#.hidden = #', this._jsObject, hidden); |
| 801 } | 583 } |
| 584 |
| 585 /// By default if you specify an id for the window, the window will only be |
| 586 /// created if another window with the same id doesn't already exist. If a |
| 587 /// window with the same id already exists that window is activated instead. I
f |
| 588 /// you do want to create multiple windows with the same id, you can set this |
| 589 /// property to false. |
| 590 bool get singleton => JS('bool', '#.singleton', this._jsObject); |
| 591 |
| 592 void set singleton(bool singleton) { |
| 593 JS('void', '#.singleton = #', this._jsObject, singleton); |
| 594 } |
| 595 |
| 802 } | 596 } |
| 803 | 597 |
| 804 class Bounds extends ChromeObject { | 598 class AppWindowBounds extends ChromeObject { |
| 805 /* | 599 /* |
| 806 * Public constructor | 600 * Public constructor |
| 807 */ | 601 */ |
| 808 Bounds({int left, int top, int width, int height}) { | 602 AppWindowBounds({int left, int top, int width, int height}) { |
| 809 this.left = left; | 603 if (?left) |
| 810 this.top = top; | 604 this.left = left; |
| 811 this.width = width; | 605 if (?top) |
| 812 this.height = height; | 606 this.top = top; |
| 607 if (?width) |
| 608 this.width = width; |
| 609 if (?height) |
| 610 this.height = height; |
| 813 } | 611 } |
| 814 | 612 |
| 815 /* | 613 /* |
| 816 * Private constructor | 614 * Private constructor |
| 817 */ | 615 */ |
| 818 Bounds._proxy(_jsObject) : super._proxy(_jsObject); | 616 AppWindowBounds._proxy(_jsObject) : super._proxy(_jsObject); |
| 819 | 617 |
| 820 /* | 618 /* |
| 821 * Public accessors | 619 * Public accessors |
| 822 */ | 620 */ |
| 823 int get left => JS('int', '#.left', this._jsObject); | 621 int get left => JS('int', '#.left', this._jsObject); |
| 824 | 622 |
| 825 void set left(int left) { | 623 void set left(int left) { |
| 826 JS('void', '#.left = #', this._jsObject, left); | 624 JS('void', '#.left = #', this._jsObject, left); |
| 827 } | 625 } |
| 828 | 626 |
| 829 int get top => JS('int', '#.top', this._jsObject); | 627 int get top => JS('int', '#.top', this._jsObject); |
| 830 | 628 |
| 831 void set top(int top) { | 629 void set top(int top) { |
| 832 JS('void', '#.top = #', this._jsObject, top); | 630 JS('void', '#.top = #', this._jsObject, top); |
| 833 } | 631 } |
| 834 | 632 |
| 835 int get width => JS('int', '#.width', this._jsObject); | 633 int get width => JS('int', '#.width', this._jsObject); |
| 836 | 634 |
| 837 void set width(int width) { | 635 void set width(int width) { |
| 838 JS('void', '#.width = #', this._jsObject, width); | 636 JS('void', '#.width = #', this._jsObject, width); |
| 839 } | 637 } |
| 840 | 638 |
| 841 int get height => JS('int', '#.height', this._jsObject); | 639 int get height => JS('int', '#.height', this._jsObject); |
| 842 | 640 |
| 843 void set height(int height) { | 641 void set height(int height) { |
| 844 JS('void', '#.height = #', this._jsObject, height); | 642 JS('void', '#.height = #', this._jsObject, height); |
| 845 } | 643 } |
| 846 } | 644 |
| 847 | 645 } |
| 848 class AppWindow extends ChromeObject { | 646 |
| 849 /* | 647 class AppWindowAppWindow extends ChromeObject { |
| 850 * Public constructor | |
| 851 * TODO(sashab): Does it make sense to be able to create a new AppWindow this | |
| 852 * way? | |
| 853 */ | |
| 854 //AppWindow(); | |
| 855 | |
| 856 /* | 648 /* |
| 857 * Private constructor | 649 * Private constructor |
| 858 */ | 650 */ |
| 859 AppWindow._proxy(jsObject) : super._proxy(jsObject); | 651 AppWindowAppWindow._proxy(_jsObject) : super._proxy(_jsObject); |
| 860 | 652 |
| 861 /* | 653 /* |
| 862 * Public accessors | 654 * Public accessors |
| 863 */ | 655 */ |
| 864 /// The JavaScript 'window' object for the created child. | 656 /// The JavaScript 'window' object for the created child. |
| 657 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 658 // for details. All rights reserved. Use of this source code is governed by a |
| 659 // BSD-style license that can be found in the LICENSE file. |
| 660 |
| 865 // TODO(sashab, sra): Detect whether this is the current window, or an | 661 // TODO(sashab, sra): Detect whether this is the current window, or an |
| 866 // external one, and return an appropriately-typed object | 662 // external one, and return an appropriately-typed object |
| 867 WindowBase get contentWindow => | 663 WindowBase get contentWindow => |
| 868 JS("Window", "#.contentWindow", this._jsObject); | 664 JS("Window", "#.contentWindow", this._jsObject); |
| 869 | 665 |
| 870 /* | 666 /* |
| 871 * Functions | 667 * Methods |
| 872 */ | 668 */ |
| 873 | |
| 874 /// Focus the window. | 669 /// Focus the window. |
| 875 void focus() => JS("void", "#.focus()", this._jsObject); | 670 void focus() => JS('void', '#.focus()', this._jsObject); |
| 876 | 671 |
| 877 /// Minimize the window. | 672 /// Minimize the window. |
| 878 void minimize() => JS("void", "#.minimize()", this._jsObject); | 673 void minimize() => JS('void', '#.minimize()', this._jsObject); |
| 879 | 674 |
| 880 /// Is the window minimized? | 675 /// Is the window minimized? |
| 881 bool isMinimized() => JS("bool", "#.isMinimized()", this._jsObject); | 676 void isMinimized() => JS('void', '#.isMinimized()', this._jsObject); |
| 882 | 677 |
| 883 /// Maximize the window. | 678 /// Maximize the window. |
| 884 void maximize() => JS("void", "#.maximize()", this._jsObject); | 679 void maximize() => JS('void', '#.maximize()', this._jsObject); |
| 885 | 680 |
| 886 /// Is the window maximized? | 681 /// Is the window maximized? |
| 887 bool isMaximized() => JS("bool", "c#.isMaximized()", this._jsObject); | 682 void isMaximized() => JS('void', '#.isMaximized()', this._jsObject); |
| 888 | 683 |
| 889 /// Restore the window. | 684 /// Restore the window. |
| 890 void restore() => JS("void", "#.restore()", this._jsObject); | 685 void restore() => JS('void', '#.restore()', this._jsObject); |
| 891 | 686 |
| 892 /// Move the window to the position (|left|, |top|). | 687 /// Move the window to the position (|left|, |top|). |
| 893 void moveTo(int left, int top) => | 688 void moveTo(int left, int top) => JS('void', '#.moveTo(#, #)', this._jsObject,
left, top); |
| 894 JS("void", "#.moveTo(#, #)", this._jsObject, left, top); | |
| 895 | 689 |
| 896 /// Resize the window to |width|x|height| pixels in size. | 690 /// Resize the window to |width|x|height| pixels in size. |
| 897 void resizeTo(int width, int height) => | 691 void resizeTo(int width, int height) => JS('void', '#.resizeTo(#, #)', this._j
sObject, width, height); |
| 898 JS("void", "#.resizeTo(#, #)", this._jsObject, width, height); | |
| 899 | 692 |
| 900 /// Draw attention to the window. | 693 /// Draw attention to the window. |
| 901 void drawAttention() => JS("void", "#.drawAttention()", this._jsObject); | 694 void drawAttention() => JS('void', '#.drawAttention()', this._jsObject); |
| 902 | 695 |
| 903 /// Clear attention to the window. | 696 /// Clear attention to the window. |
| 904 void clearAttention() => JS("void", "#.clearAttention()", this._jsObject); | 697 void clearAttention() => JS('void', '#.clearAttention()', this._jsObject); |
| 905 | 698 |
| 906 /// Close the window. | 699 /// Close the window. |
| 907 void close() => JS("void", "#.close()", this._jsObject); | 700 void close() => JS('void', '#.close()', this._jsObject); |
| 908 | 701 |
| 909 /// Show the window. Does nothing if the window is already visible. | 702 /// Show the window. Does nothing if the window is already visible. |
| 910 void show() => JS("void", "#.show()", this._jsObject); | 703 void show() => JS('void', '#.show()', this._jsObject); |
| 911 | 704 |
| 912 /// Hide the window. Does nothing if the window is already hidden. | 705 /// Hide the window. Does nothing if the window is already hidden. |
| 913 void hide() => JS("void", "#.hide()", this._jsObject); | 706 void hide() => JS('void', '#.hide()', this._jsObject); |
| 707 |
| 708 /// Get the window's bounds as a $ref:Bounds object. |
| 709 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 710 // for details. All rights reserved. Use of this source code is governed by a |
| 711 // BSD-style license that can be found in the LICENSE file. |
| 712 |
| 713 // TODO(sashab, kalman): Fix IDL parser to read function return values |
| 714 // correctly. Currently, it just reads void for all functions. |
| 715 AppWindowBounds getBounds() => |
| 716 new AppWindowBounds._proxy(JS('void', '#.getBounds()', this._jsObject)); |
| 914 | 717 |
| 915 /// Set the window's bounds. | 718 /// Set the window's bounds. |
| 916 void setBounds(Bounds bounds) => | 719 void setBounds(AppWindowBounds bounds) => JS('void', '#.setBounds(#)', this._j
sObject, convertArgument(bounds)); |
| 917 JS("void", "#.setBounds(#)", this._jsObject, convertArgument(bounds)); | 720 |
| 918 | 721 /// Set the app icon for the window (experimental). Currently this is only |
| 722 /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on |
| 723 /// Windows and OSX. |
| 724 void setIcon(String icon_url) => JS('void', '#.setIcon(#)', this._jsObject, ic
on_url); |
| 725 |
| 726 } |
| 727 |
| 728 /** |
| 729 * Events |
| 730 */ |
| 731 |
| 732 /// Fired when the window is resized. |
| 733 class Event_app_window_onBoundsChanged extends Event { |
| 734 void addListener(void callback()) => super.addListener(callback); |
| 735 |
| 736 void removeListener(void callback()) => super.removeListener(callback); |
| 737 |
| 738 bool hasListener(void callback()) => super.hasListener(callback); |
| 739 |
| 740 Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0); |
| 741 } |
| 742 |
| 743 /// Fired when the window is closed. |
| 744 class Event_app_window_onClosed extends Event { |
| 745 void addListener(void callback()) => super.addListener(callback); |
| 746 |
| 747 void removeListener(void callback()) => super.removeListener(callback); |
| 748 |
| 749 bool hasListener(void callback()) => super.hasListener(callback); |
| 750 |
| 751 Event_app_window_onClosed(jsObject) : super._(jsObject, 0); |
| 752 } |
| 753 |
| 754 /// Fired when the window is maximized. |
| 755 class Event_app_window_onMaximized extends Event { |
| 756 void addListener(void callback()) => super.addListener(callback); |
| 757 |
| 758 void removeListener(void callback()) => super.removeListener(callback); |
| 759 |
| 760 bool hasListener(void callback()) => super.hasListener(callback); |
| 761 |
| 762 Event_app_window_onMaximized(jsObject) : super._(jsObject, 0); |
| 763 } |
| 764 |
| 765 /// Fired when the window is minimized. |
| 766 class Event_app_window_onMinimized extends Event { |
| 767 void addListener(void callback()) => super.addListener(callback); |
| 768 |
| 769 void removeListener(void callback()) => super.removeListener(callback); |
| 770 |
| 771 bool hasListener(void callback()) => super.hasListener(callback); |
| 772 |
| 773 Event_app_window_onMinimized(jsObject) : super._(jsObject, 0); |
| 774 } |
| 775 |
| 776 /// Fired when the window is restored from being minimized or maximized. |
| 777 class Event_app_window_onRestored extends Event { |
| 778 void addListener(void callback()) => super.addListener(callback); |
| 779 |
| 780 void removeListener(void callback()) => super.removeListener(callback); |
| 781 |
| 782 bool hasListener(void callback()) => super.hasListener(callback); |
| 783 |
| 784 Event_app_window_onRestored(jsObject) : super._(jsObject, 0); |
| 919 } | 785 } |
| 920 | 786 |
| 921 /** | 787 /** |
| 922 * Functions | 788 * Functions |
| 923 */ | 789 */ |
| 924 class API_ChromeAppWindow { | 790 |
| 925 /** | 791 class API_app_window { |
| 926 * JS object | 792 /* |
| 793 * API connection |
| 927 */ | 794 */ |
| 928 Object _jsObject; | 795 Object _jsObject; |
| 929 | 796 |
| 930 /** | 797 /* |
| 931 * Constructor | 798 * Events |
| 932 */ | 799 */ |
| 933 API_ChromeAppWindow(this._jsObject); | 800 Event_app_window_onBoundsChanged onBoundsChanged; |
| 934 | 801 Event_app_window_onClosed onClosed; |
| 935 /** | 802 Event_app_window_onMaximized onMaximized; |
| 803 Event_app_window_onMinimized onMinimized; |
| 804 Event_app_window_onRestored onRestored; |
| 805 |
| 806 /* |
| 936 * Functions | 807 * Functions |
| 937 */ | 808 */ |
| 938 | 809 /// The size and position of a window can be specified in a number of differen
t |
| 939 /// Returns an <a href="#type-AppWindow">AppWindow</a> object for the | 810 /// ways. The most simple option is not specifying anything at all, in which |
| 940 /// current script context (ie JavaScript 'window' object). This can also be | 811 /// case a default size and platform dependent position will be used.<br/><br/
> |
| 941 /// called on a handle to a script context for another page, for example: | 812 /// Another option is to use the top/left and width/height properties, which |
| 813 /// will always put the window at the specified coordinates with the specified |
| 814 /// size.<br/><br/> Yet another option is to give the window a (unique) id. |
| 815 /// This id is then used to remember the size and position of the window |
| 816 /// whenever it is moved or resized. This size and position is then used |
| 817 /// instead of the specified bounds on subsequent opening of a window with the |
| 818 /// same id. If you need to open a window with an id at a location other than |
| 819 /// the remembered default, you can create it hidden, move it to the desired |
| 820 /// location, then show it.<br/><br/> You can also combine these various |
| 821 /// options, explicitly specifying for example the size while having the |
| 822 /// position be remembered or other combinations like that. Size and position |
| 823 /// are dealt with seperately, but individual coordinates are not. So if you |
| 824 /// specify a top (or left) coordinate, you should also specify a left (or top
) |
| 825 /// coordinate, and similar for size.<br/><br/> If you specify both a regular |
| 826 /// and a default value for the same option the regular value is the only one |
| 827 /// that takes effect. |
| 828 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 829 // for details. All rights reserved. Use of this source code is governed by a |
| 830 // BSD-style license that can be found in the LICENSE file. |
| 831 |
| 832 // TODO(sashab): This override is no longer needed once prefixes are removed. |
| 833 void create(String url, |
| 834 [AppWindowCreateWindowOptions options, |
| 835 void callback(AppWindowAppWindow created_window)]) { |
| 836 void __proxy_callback(created_window) { |
| 837 if (?callback) |
| 838 callback(new AppWindowAppWindow._proxy(created_window)); |
| 839 } |
| 840 JS('void', '#.create(#, #, #)', this._jsObject, url, convertArgument(options
), |
| 841 convertDartClosureToJS(__proxy_callback, 1)); |
| 842 } |
| 843 |
| 844 /// Returns an $ref:AppWindow object for the current script context (ie |
| 845 /// JavaScript 'window' object). This can also be called on a handle to a |
| 846 /// script context for another page, for example: |
| 942 /// otherWindow.chrome.app.window.current(). | 847 /// otherWindow.chrome.app.window.current(). |
| 943 AppWindow current() => | 848 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 944 new AppWindow._proxy(JS("Object", "#.current()", this._jsObject)); | 849 // for details. All rights reserved. Use of this source code is governed by a |
| 945 | 850 // BSD-style license that can be found in the LICENSE file. |
| 946 /// The size and position of a window can be specified in a number of | 851 |
| 947 /// different ways. The most simple option is not specifying anything at | 852 // TODO(sashab, kalman): Fix IDL parser to read function return values |
| 948 /// all, in which case a default size and platform dependent position will | 853 // correctly. Currently, it just reads void for all functions. |
| 949 /// be used. | 854 AppWindowAppWindow current() => |
| 950 /// | 855 new AppWindowAppWindow._proxy(JS('void', '#.current()', this._jsObject)); |
| 951 /// Another option is to use the top/left and width/height properties, | 856 |
| 952 /// which will always put the window at the specified coordinates with the | 857 void initializeAppWindow(Object state) => JS('void', '#.initializeAppWindow(#)
', this._jsObject, convertArgument(state)); |
| 953 /// specified size. | 858 |
| 954 /// | 859 API_app_window(this._jsObject) { |
| 955 /// Yet another option is to give the window a (unique) id. This id is then | 860 onBoundsChanged = new Event_app_window_onBoundsChanged(JS('', '#.onBoundsCha
nged', this._jsObject)); |
| 956 /// used to remember the size and position of the window whenever it is | 861 onClosed = new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject
)); |
| 957 /// moved or resized. This size and position is then used instead of the | 862 onMaximized = new Event_app_window_onMaximized(JS('', '#.onMaximized', this.
_jsObject)); |
| 958 /// specified bounds on subsequent opening of a window with the same id. If | 863 onMinimized = new Event_app_window_onMinimized(JS('', '#.onMinimized', this.
_jsObject)); |
| 959 /// you need to open a window with an id at a location other than the | 864 onRestored = new Event_app_window_onRestored(JS('', '#.onRestored', this._js
Object)); |
| 960 /// remembered default, you can create it hidden, move it to the desired | 865 } |
| 961 /// location, then show it. | 866 } |
| 962 /// | 867 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 963 /// You can also combine these various options, explicitly specifying for | 868 // for details. All rights reserved. Use of this source code is governed by a |
| 964 /// example the size while having the position be remembered or other | 869 // BSD-style license that can be found in the LICENSE file. |
| 965 /// combinations like that. Size and position are dealt with seperately, | 870 |
| 966 /// but individual coordinates are not. So if you specify a top (or left) | 871 // Generated from namespace: app.runtime |
| 967 /// coordinate, you should also specify a left (or top) coordinate, and | 872 |
| 968 /// similar for size. | 873 |
| 969 /// | 874 /** |
| 970 /// If you specify both a regular and a default value for the same option | 875 * Types |
| 971 /// the regular value is the only one that takes effect. | 876 */ |
| 972 void create(String url, [CreateWindowOptions options, | 877 |
| 973 void callback(AppWindow created_window)]) { | 878 class AppRuntimeIntent extends ChromeObject { |
| 974 void __proxy_callback(Object created_window) { | 879 /* |
| 975 if (?callback) | 880 * Private constructor |
| 976 callback(new AppWindow._proxy(created_window)); | 881 */ |
| 882 AppRuntimeIntent._proxy(_jsObject) : super._proxy(_jsObject); |
| 883 |
| 884 /* |
| 885 * Public accessors |
| 886 */ |
| 887 /// The WebIntent being invoked. |
| 888 String get action => JS('String', '#.action', this._jsObject); |
| 889 |
| 890 void set action(String action) { |
| 891 JS('void', '#.action = #', this._jsObject, action); |
| 892 } |
| 893 |
| 894 /// The MIME type of the data. |
| 895 String get type => JS('String', '#.type', this._jsObject); |
| 896 |
| 897 void set type(String type) { |
| 898 JS('void', '#.type = #', this._jsObject, type); |
| 899 } |
| 900 |
| 901 /// Data associated with the intent. |
| 902 Object get data => JS('Object', '#.data', this._jsObject); |
| 903 |
| 904 void set data(Object data) { |
| 905 JS('void', '#.data = #', this._jsObject, convertArgument(data)); |
| 906 } |
| 907 |
| 908 |
| 909 /* |
| 910 * Methods |
| 911 */ |
| 912 /// Callback to be compatible with WebIntents. |
| 913 void postResult() => JS('void', '#.postResult()', this._jsObject); |
| 914 |
| 915 /// Callback to be compatible with WebIntents. |
| 916 void postFailure() => JS('void', '#.postFailure()', this._jsObject); |
| 917 |
| 918 } |
| 919 |
| 920 class AppRuntimeLaunchItem extends ChromeObject { |
| 921 /* |
| 922 * Public constructor |
| 923 */ |
| 924 AppRuntimeLaunchItem({FileEntry entry, String type}) { |
| 925 if (?entry) |
| 926 this.entry = entry; |
| 927 if (?type) |
| 928 this.type = type; |
| 929 } |
| 930 |
| 931 /* |
| 932 * Private constructor |
| 933 */ |
| 934 AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject); |
| 935 |
| 936 /* |
| 937 * Public accessors |
| 938 */ |
| 939 /// FileEntry for the file. |
| 940 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject); |
| 941 |
| 942 void set entry(FileEntry entry) { |
| 943 JS('void', '#.entry = #', this._jsObject, convertArgument(entry)); |
| 944 } |
| 945 |
| 946 /// The MIME type of the file. |
| 947 String get type => JS('String', '#.type', this._jsObject); |
| 948 |
| 949 void set type(String type) { |
| 950 JS('void', '#.type = #', this._jsObject, type); |
| 951 } |
| 952 |
| 953 } |
| 954 |
| 955 class AppRuntimeLaunchData extends ChromeObject { |
| 956 /* |
| 957 * Public constructor |
| 958 */ |
| 959 AppRuntimeLaunchData({AppRuntimeIntent intent, String id, List<AppRuntimeLaunc
hItem> items}) { |
| 960 if (?intent) |
| 961 this.intent = intent; |
| 962 if (?id) |
| 963 this.id = id; |
| 964 if (?items) |
| 965 this.items = items; |
| 966 } |
| 967 |
| 968 /* |
| 969 * Private constructor |
| 970 */ |
| 971 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); |
| 972 |
| 973 /* |
| 974 * Public accessors |
| 975 */ |
| 976 AppRuntimeIntent get intent => new AppRuntimeIntent._proxy(JS('', '#.intent',
this._jsObject)); |
| 977 |
| 978 void set intent(AppRuntimeIntent intent) { |
| 979 JS('void', '#.intent = #', this._jsObject, convertArgument(intent)); |
| 980 } |
| 981 |
| 982 /// The id of the file handler that the app is being invoked with. |
| 983 String get id => JS('String', '#.id', this._jsObject); |
| 984 |
| 985 void set id(String id) { |
| 986 JS('void', '#.id = #', this._jsObject, id); |
| 987 } |
| 988 |
| 989 List<AppRuntimeLaunchItem> get items { |
| 990 List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>(); |
| 991 for (var o in JS('List', '#.items', this._jsObject)) { |
| 992 __proxy_items.add(new AppRuntimeLaunchItem._proxy(o)); |
| 977 } | 993 } |
| 978 | 994 return __proxy_items; |
| 979 JS("void", "#.create(#, #, #)", | 995 } |
| 980 this._jsObject, | 996 |
| 981 url, | 997 void set items(List<AppRuntimeLaunchItem> items) { |
| 982 convertArgument(options), | 998 JS('void', '#.items = #', this._jsObject, convertArgument(items)); |
| 983 convertDartClosureToJS(__proxy_callback, 1) | 999 } |
| 984 ); | 1000 |
| 985 } | 1001 } |
| 986 } | 1002 |
| 1003 class AppRuntimeIntentResponse extends ChromeObject { |
| 1004 /* |
| 1005 * Public constructor |
| 1006 */ |
| 1007 AppRuntimeIntentResponse({int intentId, bool success, Object data}) { |
| 1008 if (?intentId) |
| 1009 this.intentId = intentId; |
| 1010 if (?success) |
| 1011 this.success = success; |
| 1012 if (?data) |
| 1013 this.data = data; |
| 1014 } |
| 1015 |
| 1016 /* |
| 1017 * Private constructor |
| 1018 */ |
| 1019 AppRuntimeIntentResponse._proxy(_jsObject) : super._proxy(_jsObject); |
| 1020 |
| 1021 /* |
| 1022 * Public accessors |
| 1023 */ |
| 1024 /// Identifies the intent. |
| 1025 int get intentId => JS('int', '#.intentId', this._jsObject); |
| 1026 |
| 1027 void set intentId(int intentId) { |
| 1028 JS('void', '#.intentId = #', this._jsObject, intentId); |
| 1029 } |
| 1030 |
| 1031 /// Was this intent successful? (i.e., postSuccess vs postFailure). |
| 1032 bool get success => JS('bool', '#.success', this._jsObject); |
| 1033 |
| 1034 void set success(bool success) { |
| 1035 JS('void', '#.success = #', this._jsObject, success); |
| 1036 } |
| 1037 |
| 1038 /// Data associated with the intent response. |
| 1039 Object get data => JS('Object', '#.data', this._jsObject); |
| 1040 |
| 1041 void set data(Object data) { |
| 1042 JS('void', '#.data = #', this._jsObject, convertArgument(data)); |
| 1043 } |
| 1044 |
| 1045 } |
| 1046 |
| 1047 /** |
| 1048 * Events |
| 1049 */ |
| 1050 |
| 1051 /// Fired when an app is launched from the launcher or in response to a web |
| 1052 /// intent. |
| 1053 class Event_app_runtime_onLaunched extends Event { |
| 1054 void addListener(void callback(AppRuntimeLaunchData launchData)) { |
| 1055 void __proxy_callback(launchData) { |
| 1056 if (?callback) { |
| 1057 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 1058 } |
| 1059 } |
| 1060 super.addListener(callback); |
| 1061 } |
| 1062 |
| 1063 void removeListener(void callback(AppRuntimeLaunchData launchData)) { |
| 1064 void __proxy_callback(launchData) { |
| 1065 if (?callback) { |
| 1066 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 1067 } |
| 1068 } |
| 1069 super.removeListener(callback); |
| 1070 } |
| 1071 |
| 1072 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { |
| 1073 void __proxy_callback(launchData) { |
| 1074 if (?callback) { |
| 1075 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 1076 } |
| 1077 } |
| 1078 super.hasListener(callback); |
| 1079 } |
| 1080 |
| 1081 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); |
| 1082 } |
| 1083 |
| 1084 /// Fired at Chrome startup to apps that were running when Chrome last shut |
| 1085 /// down. |
| 1086 class Event_app_runtime_onRestarted extends Event { |
| 1087 void addListener(void callback()) => super.addListener(callback); |
| 1088 |
| 1089 void removeListener(void callback()) => super.removeListener(callback); |
| 1090 |
| 1091 bool hasListener(void callback()) => super.hasListener(callback); |
| 1092 |
| 1093 Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0); |
| 1094 } |
| 1095 |
| 1096 /** |
| 1097 * Functions |
| 1098 */ |
| 1099 |
| 1100 class API_app_runtime { |
| 1101 /* |
| 1102 * API connection |
| 1103 */ |
| 1104 Object _jsObject; |
| 1105 |
| 1106 /* |
| 1107 * Events |
| 1108 */ |
| 1109 Event_app_runtime_onLaunched onLaunched; |
| 1110 Event_app_runtime_onRestarted onRestarted; |
| 1111 |
| 1112 /* |
| 1113 * Functions |
| 1114 */ |
| 1115 /// postIntentResponse is an internal method to responds to an intent |
| 1116 /// previously sent to a packaged app. This is identified by intentId, and |
| 1117 /// should only be invoked at most once per intentId. |
| 1118 void postIntentResponse(AppRuntimeIntentResponse intentResponse) => JS('void',
'#.postIntentResponse(#)', this._jsObject, convertArgument(intentResponse)); |
| 1119 |
| 1120 API_app_runtime(this._jsObject) { |
| 1121 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); |
| 1122 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); |
| 1123 } |
| 1124 } |
| OLD | NEW |