| 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: app.runtime | |
| 6 | |
| 7 part of chrome; | |
| 8 | |
| 9 /** | |
| 10 * Types | |
| 11 */ | |
| 12 | |
| 13 class AppRuntimeLaunchItem extends ChromeObject { | |
| 14 /* | |
| 15 * Public constructor | |
| 16 */ | |
| 17 AppRuntimeLaunchItem({FileEntry entry, String type}) { | |
| 18 if (entry != null) | |
| 19 this.entry = entry; | |
| 20 if (type != null) | |
| 21 this.type = type; | |
| 22 } | |
| 23 | |
| 24 /* | |
| 25 * Private constructor | |
| 26 */ | |
| 27 AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject); | |
| 28 | |
| 29 /* | |
| 30 * Public accessors | |
| 31 */ | |
| 32 /// FileEntry for the file. | |
| 33 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject); | |
| 34 | |
| 35 void set entry(FileEntry entry) { | |
| 36 JS('void', '#.entry = #', this._jsObject, convertArgument(entry)); | |
| 37 } | |
| 38 | |
| 39 /// The MIME type of the file. | |
| 40 String get type => JS('String', '#.type', this._jsObject); | |
| 41 | |
| 42 void set type(String type) { | |
| 43 JS('void', '#.type = #', this._jsObject, type); | |
| 44 } | |
| 45 | |
| 46 } | |
| 47 | |
| 48 class AppRuntimeLaunchData extends ChromeObject { | |
| 49 /* | |
| 50 * Public constructor | |
| 51 */ | |
| 52 AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) { | |
| 53 if (id != null) | |
| 54 this.id = id; | |
| 55 if (items != null) | |
| 56 this.items = items; | |
| 57 } | |
| 58 | |
| 59 /* | |
| 60 * Private constructor | |
| 61 */ | |
| 62 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); | |
| 63 | |
| 64 /* | |
| 65 * Public accessors | |
| 66 */ | |
| 67 /// The id of the file handler that the app is being invoked with. | |
| 68 String get id => JS('String', '#.id', this._jsObject); | |
| 69 | |
| 70 void set id(String id) { | |
| 71 JS('void', '#.id = #', this._jsObject, id); | |
| 72 } | |
| 73 | |
| 74 List<AppRuntimeLaunchItem> get items { | |
| 75 List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>(); | |
| 76 int count = JS('int', '#.items.length', this._jsObject); | |
| 77 for (int i = 0; i < count; i++) { | |
| 78 var item = JS('', '#.items[#]', this._jsObject, i); | |
| 79 __proxy_items.add(new AppRuntimeLaunchItem._proxy(item)); | |
| 80 } | |
| 81 return __proxy_items; | |
| 82 } | |
| 83 | |
| 84 void set items(List<AppRuntimeLaunchItem> items) { | |
| 85 JS('void', '#.items = #', this._jsObject, convertArgument(items)); | |
| 86 } | |
| 87 | |
| 88 } | |
| 89 | |
| 90 /** | |
| 91 * Events | |
| 92 */ | |
| 93 | |
| 94 /// Fired when an app is launched from the launcher. | |
| 95 class Event_app_runtime_onLaunched extends Event { | |
| 96 void addListener(void callback(AppRuntimeLaunchData launchData)) { | |
| 97 void __proxy_callback(launchData) { | |
| 98 if (callback != null) { | |
| 99 callback(new AppRuntimeLaunchData._proxy(launchData)); | |
| 100 } | |
| 101 } | |
| 102 super.addListener(__proxy_callback); | |
| 103 } | |
| 104 | |
| 105 void removeListener(void callback(AppRuntimeLaunchData launchData)) { | |
| 106 void __proxy_callback(launchData) { | |
| 107 if (callback != null) { | |
| 108 callback(new AppRuntimeLaunchData._proxy(launchData)); | |
| 109 } | |
| 110 } | |
| 111 super.removeListener(__proxy_callback); | |
| 112 } | |
| 113 | |
| 114 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { | |
| 115 void __proxy_callback(launchData) { | |
| 116 if (callback != null) { | |
| 117 callback(new AppRuntimeLaunchData._proxy(launchData)); | |
| 118 } | |
| 119 } | |
| 120 super.hasListener(__proxy_callback); | |
| 121 } | |
| 122 | |
| 123 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); | |
| 124 } | |
| 125 | |
| 126 /// Fired at Chrome startup to apps that were running when Chrome last shut | |
| 127 /// down. | |
| 128 class Event_app_runtime_onRestarted extends Event { | |
| 129 void addListener(void callback()) => super.addListener(callback); | |
| 130 | |
| 131 void removeListener(void callback()) => super.removeListener(callback); | |
| 132 | |
| 133 bool hasListener(void callback()) => super.hasListener(callback); | |
| 134 | |
| 135 Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0); | |
| 136 } | |
| 137 | |
| 138 /** | |
| 139 * Functions | |
| 140 */ | |
| 141 | |
| 142 class API_app_runtime { | |
| 143 /* | |
| 144 * API connection | |
| 145 */ | |
| 146 Object _jsObject; | |
| 147 | |
| 148 /* | |
| 149 * Events | |
| 150 */ | |
| 151 Event_app_runtime_onLaunched onLaunched; | |
| 152 Event_app_runtime_onRestarted onRestarted; | |
| 153 API_app_runtime(this._jsObject) { | |
| 154 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); | |
| 155 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); | |
| 156 } | |
| 157 } | |
| OLD | NEW |