| 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 AppRuntimeIntent extends ChromeObject { |
| 14 /* |
| 15 * Private constructor |
| 16 */ |
| 17 AppRuntimeIntent._proxy(_jsObject) : super._proxy(_jsObject); |
| 18 |
| 19 /* |
| 20 * Public accessors |
| 21 */ |
| 22 /// The WebIntent being invoked. |
| 23 String get action => JS('String', '#.action', this._jsObject); |
| 24 |
| 25 void set action(String action) { |
| 26 JS('void', '#.action = #', this._jsObject, action); |
| 27 } |
| 28 |
| 29 /// The MIME type of the data. |
| 30 String get type => JS('String', '#.type', this._jsObject); |
| 31 |
| 32 void set type(String type) { |
| 33 JS('void', '#.type = #', this._jsObject, type); |
| 34 } |
| 35 |
| 36 /// Data associated with the intent. |
| 37 Object get data => JS('Object', '#.data', this._jsObject); |
| 38 |
| 39 void set data(Object data) { |
| 40 JS('void', '#.data = #', this._jsObject, convertArgument(data)); |
| 41 } |
| 42 |
| 43 |
| 44 /* |
| 45 * Methods |
| 46 */ |
| 47 /// Callback to be compatible with WebIntents. |
| 48 void postResult() => JS('void', '#.postResult()', this._jsObject); |
| 49 |
| 50 /// Callback to be compatible with WebIntents. |
| 51 void postFailure() => JS('void', '#.postFailure()', this._jsObject); |
| 52 |
| 53 } |
| 54 |
| 55 class AppRuntimeLaunchItem extends ChromeObject { |
| 56 /* |
| 57 * Public constructor |
| 58 */ |
| 59 AppRuntimeLaunchItem({FileEntry entry, String type}) { |
| 60 if (?entry) |
| 61 this.entry = entry; |
| 62 if (?type) |
| 63 this.type = type; |
| 64 } |
| 65 |
| 66 /* |
| 67 * Private constructor |
| 68 */ |
| 69 AppRuntimeLaunchItem._proxy(_jsObject) : super._proxy(_jsObject); |
| 70 |
| 71 /* |
| 72 * Public accessors |
| 73 */ |
| 74 /// FileEntry for the file. |
| 75 FileEntry get entry => JS('FileEntry', '#.entry', this._jsObject); |
| 76 |
| 77 void set entry(FileEntry entry) { |
| 78 JS('void', '#.entry = #', this._jsObject, convertArgument(entry)); |
| 79 } |
| 80 |
| 81 /// The MIME type of the file. |
| 82 String get type => JS('String', '#.type', this._jsObject); |
| 83 |
| 84 void set type(String type) { |
| 85 JS('void', '#.type = #', this._jsObject, type); |
| 86 } |
| 87 |
| 88 } |
| 89 |
| 90 class AppRuntimeLaunchData extends ChromeObject { |
| 91 /* |
| 92 * Public constructor |
| 93 */ |
| 94 AppRuntimeLaunchData({AppRuntimeIntent intent, String id, List<AppRuntimeLaunc
hItem> items}) { |
| 95 if (?intent) |
| 96 this.intent = intent; |
| 97 if (?id) |
| 98 this.id = id; |
| 99 if (?items) |
| 100 this.items = items; |
| 101 } |
| 102 |
| 103 /* |
| 104 * Private constructor |
| 105 */ |
| 106 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); |
| 107 |
| 108 /* |
| 109 * Public accessors |
| 110 */ |
| 111 AppRuntimeIntent get intent => new AppRuntimeIntent._proxy(JS('', '#.intent',
this._jsObject)); |
| 112 |
| 113 void set intent(AppRuntimeIntent intent) { |
| 114 JS('void', '#.intent = #', this._jsObject, convertArgument(intent)); |
| 115 } |
| 116 |
| 117 /// The id of the file handler that the app is being invoked with. |
| 118 String get id => JS('String', '#.id', this._jsObject); |
| 119 |
| 120 void set id(String id) { |
| 121 JS('void', '#.id = #', this._jsObject, id); |
| 122 } |
| 123 |
| 124 List<AppRuntimeLaunchItem> get items { |
| 125 List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>(); |
| 126 for (var o in JS('List', '#.items', this._jsObject)) { |
| 127 __proxy_items.add(new AppRuntimeLaunchItem._proxy(o)); |
| 128 } |
| 129 return __proxy_items; |
| 130 } |
| 131 |
| 132 void set items(List<AppRuntimeLaunchItem> items) { |
| 133 JS('void', '#.items = #', this._jsObject, convertArgument(items)); |
| 134 } |
| 135 |
| 136 } |
| 137 |
| 138 class AppRuntimeIntentResponse extends ChromeObject { |
| 139 /* |
| 140 * Public constructor |
| 141 */ |
| 142 AppRuntimeIntentResponse({int intentId, bool success, Object data}) { |
| 143 if (?intentId) |
| 144 this.intentId = intentId; |
| 145 if (?success) |
| 146 this.success = success; |
| 147 if (?data) |
| 148 this.data = data; |
| 149 } |
| 150 |
| 151 /* |
| 152 * Private constructor |
| 153 */ |
| 154 AppRuntimeIntentResponse._proxy(_jsObject) : super._proxy(_jsObject); |
| 155 |
| 156 /* |
| 157 * Public accessors |
| 158 */ |
| 159 /// Identifies the intent. |
| 160 int get intentId => JS('int', '#.intentId', this._jsObject); |
| 161 |
| 162 void set intentId(int intentId) { |
| 163 JS('void', '#.intentId = #', this._jsObject, intentId); |
| 164 } |
| 165 |
| 166 /// Was this intent successful? (i.e., postSuccess vs postFailure). |
| 167 bool get success => JS('bool', '#.success', this._jsObject); |
| 168 |
| 169 void set success(bool success) { |
| 170 JS('void', '#.success = #', this._jsObject, success); |
| 171 } |
| 172 |
| 173 /// Data associated with the intent response. |
| 174 Object get data => JS('Object', '#.data', this._jsObject); |
| 175 |
| 176 void set data(Object data) { |
| 177 JS('void', '#.data = #', this._jsObject, convertArgument(data)); |
| 178 } |
| 179 |
| 180 } |
| 181 |
| 182 /** |
| 183 * Events |
| 184 */ |
| 185 |
| 186 /// Fired when an app is launched from the launcher or in response to a web |
| 187 /// intent. |
| 188 class Event_app_runtime_onLaunched extends Event { |
| 189 void addListener(void callback(AppRuntimeLaunchData launchData)) { |
| 190 void __proxy_callback(launchData) { |
| 191 if (?callback) { |
| 192 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 193 } |
| 194 } |
| 195 super.addListener(callback); |
| 196 } |
| 197 |
| 198 void removeListener(void callback(AppRuntimeLaunchData launchData)) { |
| 199 void __proxy_callback(launchData) { |
| 200 if (?callback) { |
| 201 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 202 } |
| 203 } |
| 204 super.removeListener(callback); |
| 205 } |
| 206 |
| 207 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { |
| 208 void __proxy_callback(launchData) { |
| 209 if (?callback) { |
| 210 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 211 } |
| 212 } |
| 213 super.hasListener(callback); |
| 214 } |
| 215 |
| 216 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); |
| 217 } |
| 218 |
| 219 /// Fired at Chrome startup to apps that were running when Chrome last shut |
| 220 /// down. |
| 221 class Event_app_runtime_onRestarted extends Event { |
| 222 void addListener(void callback()) => super.addListener(callback); |
| 223 |
| 224 void removeListener(void callback()) => super.removeListener(callback); |
| 225 |
| 226 bool hasListener(void callback()) => super.hasListener(callback); |
| 227 |
| 228 Event_app_runtime_onRestarted(jsObject) : super._(jsObject, 0); |
| 229 } |
| 230 |
| 231 /** |
| 232 * Functions |
| 233 */ |
| 234 |
| 235 class API_app_runtime { |
| 236 /* |
| 237 * API connection |
| 238 */ |
| 239 Object _jsObject; |
| 240 |
| 241 /* |
| 242 * Events |
| 243 */ |
| 244 Event_app_runtime_onLaunched onLaunched; |
| 245 Event_app_runtime_onRestarted onRestarted; |
| 246 |
| 247 /* |
| 248 * Functions |
| 249 */ |
| 250 /// postIntentResponse is an internal method to responds to an intent |
| 251 /// previously sent to a packaged app. This is identified by intentId, and |
| 252 /// should only be invoked at most once per intentId. |
| 253 void postIntentResponse(AppRuntimeIntentResponse intentResponse) => JS('void',
'#.postIntentResponse(#)', this._jsObject, convertArgument(intentResponse)); |
| 254 |
| 255 API_app_runtime(this._jsObject) { |
| 256 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); |
| 257 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); |
| 258 } |
| 259 } |
| OLD | NEW |