| Index: sdk/lib/chrome/dart2js/chrome_dart2js.dart
|
| diff --git a/sdk/lib/chrome/dart2js/chrome_dart2js.dart b/sdk/lib/chrome/dart2js/chrome_dart2js.dart
|
| index 7c982f4f9b1bd143c09a11b18d532bec9bd2a54e..e69f59e3399dd88b392c41931a70f596fd35eff7 100644
|
| --- a/sdk/lib/chrome/dart2js/chrome_dart2js.dart
|
| +++ b/sdk/lib/chrome/dart2js/chrome_dart2js.dart
|
| @@ -1,6 +1,7 @@
|
| library chrome;
|
|
|
| import 'dart:_foreign_helper' show JS;
|
| +import 'dart:_js_helper';
|
| import 'dart:html_common';
|
| import 'dart:html';
|
| // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| @@ -11,8 +12,11 @@ import 'dart:html';
|
| // Auto-generated dart:chrome library.
|
|
|
|
|
| +/* TODO(sashab): Add "show convertDartClosureToJS" once 'show' works. */
|
|
|
|
|
| +// Generated files below this line.
|
| +
|
| // 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.
|
| @@ -322,8 +326,8 @@ class API_ChromeApp {
|
| /*
|
| * Members
|
| */
|
| - API_ChromeAppWindow window;
|
| - API_ChromeAppRuntime runtime;
|
| + API_app_window window;
|
| + API_app_runtime runtime;
|
|
|
| /*
|
| * Constructor
|
| @@ -332,12 +336,12 @@ class API_ChromeApp {
|
| var window_object = JS('', '#.window', this._jsObject);
|
| if (window_object == null)
|
| throw new UnsupportedError('Not supported by current browser.');
|
| - window = new API_ChromeAppWindow(window_object);
|
| + window = new API_app_window(window_object);
|
|
|
| var runtime_object = JS('', '#.runtime', this._jsObject);
|
| if (runtime_object == null)
|
| throw new UnsupportedError('Not supported by current browser.');
|
| - runtime = new API_ChromeAppRuntime(runtime_object);
|
| + runtime = new API_app_runtime(runtime_object);
|
| }
|
| }
|
|
|
| @@ -374,25 +378,16 @@ final API_Chrome chrome = new API_Chrome();
|
| // 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.
|
|
|
| -// from app_runtime.idl
|
| +// Generated from namespace: app.runtime
|
| +
|
|
|
| /**
|
| * Types
|
| */
|
|
|
| -/// A WebIntents intent object. Deprecated.
|
| class Intent extends ChromeObject {
|
| /*
|
| - * Public (Dart) constructor
|
| - */
|
| - Intent({String action, String type, var data}) {
|
| - this.action = action;
|
| - this.type = type;
|
| - this.data = data;
|
| - }
|
| -
|
| - /*
|
| - * Private (JS) constructor
|
| + * Private constructor
|
| */
|
| Intent._proxy(_jsObject) : super._proxy(_jsObject);
|
|
|
| @@ -415,7 +410,6 @@ class Intent extends ChromeObject {
|
| }
|
|
|
| /// Data associated with the intent.
|
| - // TODO(sashab): What is the best way to serialize/return generic JS objects?
|
| Object get data => JS('Object', '#.data', this._jsObject);
|
|
|
| void set data(Object data) {
|
| @@ -423,10 +417,12 @@ class Intent extends ChromeObject {
|
| }
|
|
|
| /*
|
| - * TODO(sashab): What is a NullCallback() type?
|
| - * Add postResult and postFailure once understanding what this type is, and
|
| - * once there is a way to pass functions back from JS.
|
| + * Methods
|
| */
|
| + /// Callback to be compatible with WebIntents.
|
| + void postResult() => JS('void', '#.postResult()', this._jsObject);
|
| + /// Callback to be compatible with WebIntents.
|
| + void postFailure() => JS('void', '#.postFailure()', this._jsObject);
|
| }
|
|
|
| class LaunchItem extends ChromeObject {
|
| @@ -434,8 +430,10 @@ class LaunchItem extends ChromeObject {
|
| * Public constructor
|
| */
|
| LaunchItem({FileEntry entry, String type}) {
|
| - this.entry = entry;
|
| - this.type = type;
|
| + if (?entry)
|
| + this.entry = entry;
|
| + if (?type)
|
| + this.type = type;
|
| }
|
|
|
| /*
|
| @@ -451,7 +449,7 @@ class LaunchItem extends ChromeObject {
|
| FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject);
|
|
|
| void set entry(FileEntry entry) {
|
| - JS('void', '#.entry = #', this._jsObject, entry);
|
| + JS('void', '#.entry = #', this._jsObject, convertArgument(entry));
|
| }
|
|
|
| /// The MIME type of the file.
|
| @@ -462,15 +460,17 @@ class LaunchItem extends ChromeObject {
|
| }
|
| }
|
|
|
| -/// Optional data for the launch.
|
| class LaunchData extends ChromeObject {
|
| /*
|
| * Public constructor
|
| */
|
| LaunchData({Intent intent, String id, List<LaunchItem> items}) {
|
| - this.intent = intent;
|
| - this.id = id;
|
| - this.items = items;
|
| + if (?intent)
|
| + this.intent = intent;
|
| + if (?id)
|
| + this.id = id;
|
| + if (?items)
|
| + this.items = items;
|
| }
|
|
|
| /*
|
| @@ -481,6 +481,7 @@ class LaunchData extends ChromeObject {
|
| /*
|
| * Public accessors
|
| */
|
| +
|
| Intent get intent => new Intent._proxy(JS('', '#.intent', this._jsObject));
|
|
|
| void set intent(Intent intent) {
|
| @@ -494,12 +495,12 @@ class LaunchData extends ChromeObject {
|
| JS('void', '#.id = #', this._jsObject, id);
|
| }
|
|
|
| - List<LaunchItem> get items() {
|
| - List<LaunchItem> items_final = new List<LaunchItem>();
|
| + List<LaunchItem> get items {
|
| + List<LaunchItem> __proxy_items = new List<LaunchItem>();
|
| for (var o in JS('List', '#.items', this._jsObject)) {
|
| - items_final.add(new LaunchItem._proxy(o));
|
| + __proxy_items.add(new LaunchItem._proxy(o));
|
| }
|
| - return items_final;
|
| + return __proxy_items;
|
| }
|
|
|
| void set items(List<LaunchItem> items) {
|
| @@ -512,9 +513,12 @@ class IntentResponse extends ChromeObject {
|
| * Public constructor
|
| */
|
| IntentResponse({int intentId, bool success, Object data}) {
|
| - this.intentId = intentId;
|
| - this.success = success;
|
| - this.data = data;
|
| + if (?intentId)
|
| + this.intentId = intentId;
|
| + if (?success)
|
| + this.success = success;
|
| + if (?data)
|
| + this.data = data;
|
| }
|
|
|
| /*
|
| @@ -541,7 +545,6 @@ class IntentResponse extends ChromeObject {
|
| }
|
|
|
| /// Data associated with the intent response.
|
| - // TODO(sashab): What's the best way to serialize/return generic JS objects?
|
| Object get data => JS('Object', '#.data', this._jsObject);
|
|
|
| void set data(Object data) {
|
| @@ -553,48 +556,56 @@ class IntentResponse extends ChromeObject {
|
| * Events
|
| */
|
|
|
| +/// Fired when an app is launched from the launcher or in response to a web
|
| +/// intent.
|
| +class Event_app_runtime_onLaunched extends Event {
|
| + void addListener(void callback(LaunchData launchData)) {
|
| + void __proxy_callback(launchData) {
|
| + if (?callback) {
|
| + callback(new LaunchData._proxy(launchData));
|
| + }
|
| + }
|
| + super.addListener(callback);
|
| + }
|
| +
|
| + void removeListener(void callback(LaunchData launchData)) {
|
| + void __proxy_callback(launchData) {
|
| + if (?callback) {
|
| + callback(new LaunchData._proxy(launchData));
|
| + }
|
| + }
|
| + super.removeListener(callback);
|
| + }
|
| +
|
| + bool hasListener(void callback(LaunchData launchData)) {
|
| + void __proxy_callback(launchData) {
|
| + if (?callback) {
|
| + callback(new LaunchData._proxy(launchData));
|
| + }
|
| + }
|
| + super.hasListener(callback);
|
| + }
|
| +
|
| + Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1);
|
| +}
|
| +
|
| /// Fired at Chrome startup to apps that were running when Chrome last shut
|
| /// down.
|
| -class Event_ChromeAppRuntimeOnRestarted extends Event {
|
| - /*
|
| - * Override callback type definitions
|
| - */
|
| - void addListener(void callback())
|
| - => super.addListener(callback);
|
| - void removeListener(void callback())
|
| - => super.removeListener(callback);
|
| - bool hasListener(void callback())
|
| - => super.hasListener(callback);
|
| +class Event_app_runtime_onRestarted extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
|
|
| - /*
|
| - * Constructor
|
| - */
|
| - Event_ChromeAppRuntimeOnRestarted(jsObject) : super._(jsObject, 0);
|
| -}
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
|
|
| -/// Fired when an app is launched from the launcher or in response to a web
|
| -/// intent.
|
| -class Event_ChromeAppRuntimeOnLaunched extends Event {
|
| - /*
|
| - * Override callback type definitions
|
| - */
|
| - void addListener(void callback(LaunchData launchData))
|
| - => super.addListener(callback);
|
| - void removeListener(void callback(LaunchData launchData))
|
| - => super.removeListener(callback);
|
| - bool hasListener(void callback(LaunchData launchData))
|
| - => super.hasListener(callback);
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
|
|
| - /*
|
| - * Constructor
|
| - */
|
| - Event_ChromeAppRuntimeOnLaunched(jsObject) : super._(jsObject, 1);
|
| + Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0);
|
| }
|
|
|
| /**
|
| * Functions
|
| */
|
| -class API_ChromeAppRuntime {
|
| +
|
| +class API_app_runtime {
|
| /*
|
| * API connection
|
| */
|
| @@ -603,63 +614,125 @@ class API_ChromeAppRuntime {
|
| /*
|
| * Events
|
| */
|
| - Event_ChromeAppRuntimeOnRestarted onRestarted;
|
| - Event_ChromeAppRuntimeOnLaunched onLaunched;
|
| + Event_app_runtime_onLaunched onLaunched;
|
| + Event_app_runtime_onRestarted onRestarted;
|
|
|
| /*
|
| * Functions
|
| */
|
| - void postIntentResponse(IntentResponse intentResponse) =>
|
| - JS('void', '#.postIntentResponse(#)', this._jsObject,
|
| - convertArgument(intentResponse));
|
|
|
| - /*
|
| - * Constructor
|
| - */
|
| - API_ChromeAppRuntime(this._jsObject) {
|
| - onRestarted = new Event_ChromeAppRuntimeOnRestarted(JS('Object',
|
| - '#.onRestarted',
|
| - this._jsObject));
|
| - onLaunched = new Event_ChromeAppRuntimeOnLaunched(JS('Object',
|
| - '#.onLaunched',
|
| - this._jsObject));
|
| - }
|
| -}
|
| + /// postIntentResponse is an internal method to responds to an intent
|
| + /// previously sent to a packaged app. This is identified by intentId, and
|
| + /// should only be invoked at most once per intentId.
|
| + void postIntentResponse(IntentResponse intentResponse) => JS('void', '#.postIntentResponse(#)', this._jsObject, convertArgument(intentResponse));
|
|
|
| -// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| + API_app_runtime(this._jsObject) {
|
| + onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._jsObject));
|
| + onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this._jsObject));
|
| + }
|
| +}// 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.
|
|
|
| -// from app.window.idl
|
| +// Generated from namespace: app.window
|
| +
|
|
|
| /**
|
| * Types
|
| */
|
| +
|
| +class Bounds extends ChromeObject {
|
| + /*
|
| + * Public constructor
|
| + */
|
| + Bounds({int left, int top, int width, int height}) {
|
| + if (?left)
|
| + this.left = left;
|
| + if (?top)
|
| + this.top = top;
|
| + if (?width)
|
| + this.width = width;
|
| + if (?height)
|
| + this.height = height;
|
| + }
|
| +
|
| + /*
|
| + * Private constructor
|
| + */
|
| + Bounds._proxy(_jsObject) : super._proxy(_jsObject);
|
| +
|
| + /*
|
| + * Public accessors
|
| + */
|
| +
|
| + int get left => JS('int', '#.left', this._jsObject);
|
| +
|
| + void set left(int left) {
|
| + JS('void', '#.left = #', this._jsObject, left);
|
| + }
|
| +
|
| + int get top => JS('int', '#.top', this._jsObject);
|
| +
|
| + void set top(int top) {
|
| + JS('void', '#.top = #', this._jsObject, top);
|
| + }
|
| +
|
| + int get width => JS('int', '#.width', this._jsObject);
|
| +
|
| + void set width(int width) {
|
| + JS('void', '#.width = #', this._jsObject, width);
|
| + }
|
| +
|
| + int get height => JS('int', '#.height', this._jsObject);
|
| +
|
| + void set height(int height) {
|
| + JS('void', '#.height = #', this._jsObject, height);
|
| + }
|
| +}
|
| +
|
| class CreateWindowOptions extends ChromeObject {
|
| /*
|
| * Public constructor
|
| */
|
| - CreateWindowOptions({String id, int defaultWidth, int defaultHeight,
|
| - int defaultLeft, int defaultTop, int width, int height, int left, int top,
|
| - int minWidth, int minHeight, int maxWidth, int maxHeight, String type,
|
| - String frame, Bounds bounds, bool hidden}) {
|
| - this.id = id;
|
| - this.defaultWidth = defaultWidth;
|
| - this.defaultHeight = defaultHeight;
|
| - this.defaultLeft = defaultLeft;
|
| - this.defaultTop = defaultTop;
|
| - this.width = width;
|
| - this.height = height;
|
| - this.left = left;
|
| - this.top = top;
|
| - this.minWidth = minWidth;
|
| - this.minHeight = minHeight;
|
| - this.maxWidth = maxWidth;
|
| - this.maxHeight = maxHeight;
|
| - this.type = type;
|
| - this.frame = frame;
|
| - this.bounds = bounds;
|
| - this.hidden = hidden;
|
| + CreateWindowOptions({String id, int defaultWidth, int defaultHeight, int defaultLeft, int defaultTop, int width, int height, int left, int top, int minWidth, int minHeight, int maxWidth, int maxHeight, String type, String frame, Bounds bounds, bool transparentBackground, bool hidden, bool singleton}) {
|
| + if (?id)
|
| + this.id = id;
|
| + if (?defaultWidth)
|
| + this.defaultWidth = defaultWidth;
|
| + if (?defaultHeight)
|
| + this.defaultHeight = defaultHeight;
|
| + if (?defaultLeft)
|
| + this.defaultLeft = defaultLeft;
|
| + if (?defaultTop)
|
| + this.defaultTop = defaultTop;
|
| + if (?width)
|
| + this.width = width;
|
| + if (?height)
|
| + this.height = height;
|
| + if (?left)
|
| + this.left = left;
|
| + if (?top)
|
| + this.top = top;
|
| + if (?minWidth)
|
| + this.minWidth = minWidth;
|
| + if (?minHeight)
|
| + this.minHeight = minHeight;
|
| + if (?maxWidth)
|
| + this.maxWidth = maxWidth;
|
| + if (?maxHeight)
|
| + this.maxHeight = maxHeight;
|
| + if (?type)
|
| + this.type = type;
|
| + if (?frame)
|
| + this.frame = frame;
|
| + if (?bounds)
|
| + this.bounds = bounds;
|
| + if (?transparentBackground)
|
| + this.transparentBackground = transparentBackground;
|
| + if (?hidden)
|
| + this.hidden = hidden;
|
| + if (?singleton)
|
| + this.singleton = singleton;
|
| }
|
|
|
| /*
|
| @@ -670,9 +743,10 @@ class CreateWindowOptions extends ChromeObject {
|
| /*
|
| * Public accessors
|
| */
|
| - /// Id to identify the window. This will be used to remember the size
|
| - /// and position of the window and restore that geometry when a window
|
| - /// with the same id (and no explicit size or position) is later opened.
|
| +
|
| + /// Id to identify the window. This will be used to remember the size and
|
| + /// position of the window and restore that geometry when a window with the
|
| + /// same id (and no explicit size or position) is later opened.
|
| String get id => JS('String', '#.id', this._jsObject);
|
|
|
| void set id(String id) {
|
| @@ -739,7 +813,7 @@ class CreateWindowOptions extends ChromeObject {
|
| JS('void', '#.top = #', this._jsObject, top);
|
| }
|
|
|
| - /// Minimium width of the window.
|
| + /// Minimum width of the window.
|
| int get minWidth => JS('int', '#.minWidth', this._jsObject);
|
|
|
| void set minWidth(int minWidth) {
|
| @@ -767,7 +841,8 @@ class CreateWindowOptions extends ChromeObject {
|
| JS('void', '#.maxHeight = #', this._jsObject, maxHeight);
|
| }
|
|
|
| - /// Window type: 'shell' (the default) is the only currently supported value.
|
| + /// Window type: 'shell' - the default window type 'panel' - a panel, managed
|
| + /// by the OS (Currently experimental, Ash only)
|
| String get type => JS('String', '#.type', this._jsObject);
|
|
|
| void set type(String type) {
|
| @@ -781,206 +856,221 @@ class CreateWindowOptions extends ChromeObject {
|
| JS('void', '#.frame = #', this._jsObject, frame);
|
| }
|
|
|
| - /// Size of the content in the window (excluding the titlebar). If specified
|
| - /// in addition to any of the left/top/width/height parameters, this field
|
| - /// takes precedence. If a frameBounds is specified, the frameBounds take
|
| - /// precedence.
|
| - Bounds get bounds =>
|
| - new Bounds._proxy(JS('Bounds', '#.bounds', this._jsObject));
|
| + /// Size of the content in the window (excluding the titlebar). If specified in
|
| + /// addition to any of the left/top/width/height parameters, this field takes
|
| + /// precedence. If a frameBounds is specified, the frameBounds take precedence.
|
| + Bounds get bounds => new Bounds._proxy(JS('', '#.bounds', this._jsObject));
|
|
|
| void set bounds(Bounds bounds) {
|
| JS('void', '#.bounds = #', this._jsObject, convertArgument(bounds));
|
| }
|
|
|
| - /// If true, the window will be created in a hidden state. Call show() on
|
| - /// the window to show it once it has been created. Defaults to false.
|
| - bool get hidden => JS('bool', '#.hidden', this._jsObject);
|
| -
|
| - void set hidden(bool hidden) {
|
| - JS('void', '#.hidden = #', this._jsObject, hidden);
|
| - }
|
| -}
|
| -
|
| -class Bounds extends ChromeObject {
|
| - /*
|
| - * Public constructor
|
| - */
|
| - Bounds({int left, int top, int width, int height}) {
|
| - this.left = left;
|
| - this.top = top;
|
| - this.width = width;
|
| - this.height = height;
|
| - }
|
| -
|
| - /*
|
| - * Private constructor
|
| - */
|
| - Bounds._proxy(_jsObject) : super._proxy(_jsObject);
|
| -
|
| - /*
|
| - * Public accessors
|
| - */
|
| - int get left => JS('int', '#.left', this._jsObject);
|
| -
|
| - void set left(int left) {
|
| - JS('void', '#.left = #', this._jsObject, left);
|
| - }
|
| -
|
| - int get top => JS('int', '#.top', this._jsObject);
|
| + /// Enable window background transparency. Only supported in ash. Requires
|
| + /// experimental API permission.
|
| + bool get transparentBackground => JS('bool', '#.transparentBackground', this._jsObject);
|
|
|
| - void set top(int top) {
|
| - JS('void', '#.top = #', this._jsObject, top);
|
| + void set transparentBackground(bool transparentBackground) {
|
| + JS('void', '#.transparentBackground = #', this._jsObject, transparentBackground);
|
| }
|
|
|
| - int get width => JS('int', '#.width', this._jsObject);
|
| + /// If true, the window will be created in a hidden state. Call show() on the
|
| + /// window to show it once it has been created. Defaults to false.
|
| + bool get hidden => JS('bool', '#.hidden', this._jsObject);
|
|
|
| - void set width(int width) {
|
| - JS('void', '#.width = #', this._jsObject, width);
|
| + void set hidden(bool hidden) {
|
| + JS('void', '#.hidden = #', this._jsObject, hidden);
|
| }
|
|
|
| - int get height => JS('int', '#.height', this._jsObject);
|
| + /// By default if you specify an id for the window, the window will only be
|
| + /// created if another window with the same id doesn't already exist. If a
|
| + /// window with the same id already exists that window is activated instead. If
|
| + /// you do want to create multiple windows with the same id, you can set this
|
| + /// property to false.
|
| + bool get singleton => JS('bool', '#.singleton', this._jsObject);
|
|
|
| - void set height(int height) {
|
| - JS('void', '#.height = #', this._jsObject, height);
|
| + void set singleton(bool singleton) {
|
| + JS('void', '#.singleton = #', this._jsObject, singleton);
|
| }
|
| }
|
|
|
| class AppWindow extends ChromeObject {
|
| /*
|
| - * Public constructor
|
| - * TODO(sashab): Does it make sense to be able to create a new AppWindow this
|
| - * way?
|
| - */
|
| - //AppWindow();
|
| -
|
| - /*
|
| * Private constructor
|
| */
|
| - AppWindow._proxy(jsObject) : super._proxy(jsObject);
|
| + AppWindow._proxy(_jsObject) : super._proxy(_jsObject);
|
|
|
| /*
|
| * Public accessors
|
| */
|
| +
|
| /// The JavaScript 'window' object for the created child.
|
| // TODO(sashab, sra): Detect whether this is the current window, or an
|
| // external one, and return an appropriately-typed object
|
| WindowBase get contentWindow =>
|
| - JS("Window", "#.contentWindow", this._jsObject);
|
| + JS("Window", "#.contentWindow", this._jsObject);
|
|
|
| /*
|
| - * Functions
|
| + * Methods
|
| */
|
| -
|
| /// Focus the window.
|
| - void focus() => JS("void", "#.focus()", this._jsObject);
|
| -
|
| + void focus() => JS('void', '#.focus()', this._jsObject);
|
| /// Minimize the window.
|
| - void minimize() => JS("void", "#.minimize()", this._jsObject);
|
| -
|
| + void minimize() => JS('void', '#.minimize()', this._jsObject);
|
| /// Is the window minimized?
|
| - bool isMinimized() => JS("bool", "#.isMinimized()", this._jsObject);
|
| -
|
| + void isMinimized() => JS('void', '#.isMinimized()', this._jsObject);
|
| /// Maximize the window.
|
| - void maximize() => JS("void", "#.maximize()", this._jsObject);
|
| -
|
| + void maximize() => JS('void', '#.maximize()', this._jsObject);
|
| /// Is the window maximized?
|
| - bool isMaximized() => JS("bool", "c#.isMaximized()", this._jsObject);
|
| -
|
| + void isMaximized() => JS('void', '#.isMaximized()', this._jsObject);
|
| /// Restore the window.
|
| - void restore() => JS("void", "#.restore()", this._jsObject);
|
| -
|
| + void restore() => JS('void', '#.restore()', this._jsObject);
|
| /// Move the window to the position (|left|, |top|).
|
| - void moveTo(int left, int top) =>
|
| - JS("void", "#.moveTo(#, #)", this._jsObject, left, top);
|
| -
|
| + void moveTo(int left, int top) => JS('void', '#.moveTo(#, #)', this._jsObject, left, top);
|
| /// Resize the window to |width|x|height| pixels in size.
|
| - void resizeTo(int width, int height) =>
|
| - JS("void", "#.resizeTo(#, #)", this._jsObject, width, height);
|
| -
|
| + void resizeTo(int width, int height) => JS('void', '#.resizeTo(#, #)', this._jsObject, width, height);
|
| /// Draw attention to the window.
|
| - void drawAttention() => JS("void", "#.drawAttention()", this._jsObject);
|
| -
|
| + void drawAttention() => JS('void', '#.drawAttention()', this._jsObject);
|
| /// Clear attention to the window.
|
| - void clearAttention() => JS("void", "#.clearAttention()", this._jsObject);
|
| -
|
| + void clearAttention() => JS('void', '#.clearAttention()', this._jsObject);
|
| /// Close the window.
|
| - void close() => JS("void", "#.close()", this._jsObject);
|
| -
|
| + void close() => JS('void', '#.close()', this._jsObject);
|
| /// Show the window. Does nothing if the window is already visible.
|
| - void show() => JS("void", "#.show()", this._jsObject);
|
| -
|
| + void show() => JS('void', '#.show()', this._jsObject);
|
| /// Hide the window. Does nothing if the window is already hidden.
|
| - void hide() => JS("void", "#.hide()", this._jsObject);
|
| -
|
| + void hide() => JS('void', '#.hide()', this._jsObject);
|
| + /// Get the window's bounds as a $ref:Bounds object.
|
| + void getBounds() => JS('void', '#.getBounds()', this._jsObject);
|
| /// Set the window's bounds.
|
| - void setBounds(Bounds bounds) =>
|
| - JS("void", "#.setBounds(#)", this._jsObject, convertArgument(bounds));
|
| + void setBounds(Bounds bounds) => JS('void', '#.setBounds(#)', this._jsObject, convertArgument(bounds));
|
| + /// Set the app icon for the window (experimental). Currently this is only
|
| + /// being implemented on Ash. TODO(stevenjb): Investigate implementing this on
|
| + /// Windows and OSX.
|
| + void setIcon(String icon_url) => JS('void', '#.setIcon(#)', this._jsObject, icon_url);
|
| +}
|
| +
|
| +/**
|
| + * Events
|
| + */
|
| +
|
| +/// Fired when the window is resized.
|
| +class Event_app_window_onBoundsChanged extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
| +
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
| +
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
| +
|
| + Event_app_window_onBoundsChanged(jsObject) : super._(jsObject, 0);
|
| +}
|
| +
|
| +/// Fired when the window is closed.
|
| +class Event_app_window_onClosed extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
| +
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
| +
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
| +
|
| + Event_app_window_onClosed(jsObject) : super._(jsObject, 0);
|
| +}
|
| +
|
| +/// Fired when the window is maximized.
|
| +class Event_app_window_onMaximized extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
| +
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
| +
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
| +
|
| + Event_app_window_onMaximized(jsObject) : super._(jsObject, 0);
|
| +}
|
| +
|
| +/// Fired when the window is minimized.
|
| +class Event_app_window_onMinimized extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
| +
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
| +
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
| +
|
| + Event_app_window_onMinimized(jsObject) : super._(jsObject, 0);
|
| +}
|
| +
|
| +/// Fired when the window is restored from being minimized or maximized.
|
| +class Event_app_window_onRestored extends Event {
|
| + void addListener(void callback()) => super.addListener(callback);
|
| +
|
| + void removeListener(void callback()) => super.removeListener(callback);
|
| +
|
| + bool hasListener(void callback()) => super.hasListener(callback);
|
|
|
| + Event_app_window_onRestored(jsObject) : super._(jsObject, 0);
|
| }
|
|
|
| /**
|
| * Functions
|
| */
|
| -class API_ChromeAppWindow {
|
| - /**
|
| - * JS object
|
| +
|
| +class API_app_window {
|
| + /*
|
| + * API connection
|
| */
|
| Object _jsObject;
|
|
|
| - /**
|
| - * Constructor
|
| + /*
|
| + * Events
|
| */
|
| - API_ChromeAppWindow(this._jsObject);
|
| + Event_app_window_onBoundsChanged onBoundsChanged;
|
| + Event_app_window_onClosed onClosed;
|
| + Event_app_window_onMaximized onMaximized;
|
| + Event_app_window_onMinimized onMinimized;
|
| + Event_app_window_onRestored onRestored;
|
|
|
| - /**
|
| + /*
|
| * Functions
|
| */
|
|
|
| - /// Returns an <a href="#type-AppWindow">AppWindow</a> object for the
|
| - /// current script context (ie JavaScript 'window' object). This can also be
|
| - /// called on a handle to a script context for another page, for example:
|
| - /// otherWindow.chrome.app.window.current().
|
| - AppWindow current() =>
|
| - new AppWindow._proxy(JS("Object", "#.current()", this._jsObject));
|
| -
|
| - /// The size and position of a window can be specified in a number of
|
| - /// different ways. The most simple option is not specifying anything at
|
| - /// all, in which case a default size and platform dependent position will
|
| - /// be used.
|
| - ///
|
| - /// Another option is to use the top/left and width/height properties,
|
| - /// which will always put the window at the specified coordinates with the
|
| - /// specified size.
|
| - ///
|
| - /// Yet another option is to give the window a (unique) id. This id is then
|
| - /// used to remember the size and position of the window whenever it is
|
| - /// moved or resized. This size and position is then used instead of the
|
| - /// specified bounds on subsequent opening of a window with the same id. If
|
| - /// you need to open a window with an id at a location other than the
|
| - /// remembered default, you can create it hidden, move it to the desired
|
| - /// location, then show it.
|
| - ///
|
| - /// You can also combine these various options, explicitly specifying for
|
| - /// example the size while having the position be remembered or other
|
| - /// combinations like that. Size and position are dealt with seperately,
|
| - /// but individual coordinates are not. So if you specify a top (or left)
|
| - /// coordinate, you should also specify a left (or top) coordinate, and
|
| - /// similar for size.
|
| - ///
|
| - /// If you specify both a regular and a default value for the same option
|
| - /// the regular value is the only one that takes effect.
|
| - void create(String url, [CreateWindowOptions options,
|
| - void callback(AppWindow created_window)]) {
|
| - void __proxy_callback(Object created_window) {
|
| - if (?callback)
|
| + /// The size and position of a window can be specified in a number of different
|
| + /// ways. The most simple option is not specifying anything at all, in which
|
| + /// case a default size and platform dependent position will be used.<br/><br/>
|
| + /// Another option is to use the top/left and width/height properties, which
|
| + /// will always put the window at the specified coordinates with the specified
|
| + /// size.<br/><br/> Yet another option is to give the window a (unique) id.
|
| + /// This id is then used to remember the size and position of the window
|
| + /// whenever it is moved or resized. This size and position is then used
|
| + /// instead of the specified bounds on subsequent opening of a window with the
|
| + /// same id. If you need to open a window with an id at a location other than
|
| + /// the remembered default, you can create it hidden, move it to the desired
|
| + /// location, then show it.<br/><br/> You can also combine these various
|
| + /// options, explicitly specifying for example the size while having the
|
| + /// position be remembered or other combinations like that. Size and position
|
| + /// are dealt with seperately, but individual coordinates are not. So if you
|
| + /// specify a top (or left) coordinate, you should also specify a left (or top)
|
| + /// coordinate, and similar for size.<br/><br/> If you specify both a regular
|
| + /// and a default value for the same option the regular value is the only one
|
| + /// that takes effect.
|
| + void create(String url, [CreateWindowOptions options, void callback(AppWindow created_window)]) {
|
| + void __proxy_callback(created_window) {
|
| + if (?callback) {
|
| callback(new AppWindow._proxy(created_window));
|
| + }
|
| }
|
| + JS('void', '#.create(#, #, #)', this._jsObject, url, convertArgument(options), convertDartClosureToJS(__proxy_callback, 1));
|
| + }
|
|
|
| - JS("void", "#.create(#, #, #)",
|
| - this._jsObject,
|
| - url,
|
| - convertArgument(options),
|
| - convertDartClosureToJS(__proxy_callback, 1)
|
| - );
|
| + /// Returns an $ref:AppWindow object for the current script context (ie
|
| + /// JavaScript 'window' object). This can also be called on a handle to a
|
| + /// script context for another page, for example:
|
| + /// otherWindow.chrome.app.window.current().
|
| + void current() => JS('void', '#.current()', this._jsObject);
|
| +
|
| + void initializeAppWindow(Object state) => JS('void', '#.initializeAppWindow(#)', this._jsObject, convertArgument(state));
|
| +
|
| + API_app_window(this._jsObject) {
|
| + onBoundsChanged = new Event_app_window_onBoundsChanged(JS('', '#.onBoundsChanged', this._jsObject));
|
| + onClosed = new Event_app_window_onClosed(JS('', '#.onClosed', this._jsObject));
|
| + onMaximized = new Event_app_window_onMaximized(JS('', '#.onMaximized', this._jsObject));
|
| + onMinimized = new Event_app_window_onMinimized(JS('', '#.onMinimized', this._jsObject));
|
| + onRestored = new Event_app_window_onRestored(JS('', '#.onRestored', this._jsObject));
|
| }
|
| }
|
|
|