| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Generated from namespace: app.runtime | 5 // Generated from namespace: app.runtime |
| 6 | 6 |
| 7 part of chrome; | 7 part of chrome; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * Types | 10 * Types |
| 11 */ | 11 */ |
| 12 | 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 { | 13 class AppRuntimeLaunchItem extends ChromeObject { |
| 56 /* | 14 /* |
| 57 * Public constructor | 15 * Public constructor |
| 58 */ | 16 */ |
| 59 AppRuntimeLaunchItem({FileEntry entry, String type}) { | 17 AppRuntimeLaunchItem({FileEntry entry, String type}) { |
| 60 if (entry != null) | 18 if (entry != null) |
| 61 this.entry = entry; | 19 this.entry = entry; |
| 62 if (type != null) | 20 if (type != null) |
| 63 this.type = type; | 21 this.type = type; |
| 64 } | 22 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 84 void set type(String type) { | 42 void set type(String type) { |
| 85 JS('void', '#.type = #', this._jsObject, type); | 43 JS('void', '#.type = #', this._jsObject, type); |
| 86 } | 44 } |
| 87 | 45 |
| 88 } | 46 } |
| 89 | 47 |
| 90 class AppRuntimeLaunchData extends ChromeObject { | 48 class AppRuntimeLaunchData extends ChromeObject { |
| 91 /* | 49 /* |
| 92 * Public constructor | 50 * Public constructor |
| 93 */ | 51 */ |
| 94 AppRuntimeLaunchData({AppRuntimeIntent intent, String id, List<AppRuntimeLaunc
hItem> items}) { | 52 AppRuntimeLaunchData({String id, List<AppRuntimeLaunchItem> items}) { |
| 95 if (intent != null) | |
| 96 this.intent = intent; | |
| 97 if (id != null) | 53 if (id != null) |
| 98 this.id = id; | 54 this.id = id; |
| 99 if (items != null) | 55 if (items != null) |
| 100 this.items = items; | 56 this.items = items; |
| 101 } | 57 } |
| 102 | 58 |
| 103 /* | 59 /* |
| 104 * Private constructor | 60 * Private constructor |
| 105 */ | 61 */ |
| 106 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); | 62 AppRuntimeLaunchData._proxy(_jsObject) : super._proxy(_jsObject); |
| 107 | 63 |
| 108 /* | 64 /* |
| 109 * Public accessors | 65 * Public accessors |
| 110 */ | 66 */ |
| 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. | 67 /// The id of the file handler that the app is being invoked with. |
| 118 String get id => JS('String', '#.id', this._jsObject); | 68 String get id => JS('String', '#.id', this._jsObject); |
| 119 | 69 |
| 120 void set id(String id) { | 70 void set id(String id) { |
| 121 JS('void', '#.id = #', this._jsObject, id); | 71 JS('void', '#.id = #', this._jsObject, id); |
| 122 } | 72 } |
| 123 | 73 |
| 124 List<AppRuntimeLaunchItem> get items { | 74 List<AppRuntimeLaunchItem> get items { |
| 125 List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>(); | 75 List<AppRuntimeLaunchItem> __proxy_items = new List<AppRuntimeLaunchItem>(); |
| 126 for (var o in JS('List', '#.items', this._jsObject)) { | 76 int count = JS('int', '#.items.length', this._jsObject); |
| 127 __proxy_items.add(new AppRuntimeLaunchItem._proxy(o)); | 77 for (int i = 0; i < count; i++) { |
| 78 var item = JS('', '#.items[#]', this._jsObject, i); |
| 79 __proxy_items.add(new AppRuntimeLaunchItem._proxy(item)); |
| 128 } | 80 } |
| 129 return __proxy_items; | 81 return __proxy_items; |
| 130 } | 82 } |
| 131 | 83 |
| 132 void set items(List<AppRuntimeLaunchItem> items) { | 84 void set items(List<AppRuntimeLaunchItem> items) { |
| 133 JS('void', '#.items = #', this._jsObject, convertArgument(items)); | 85 JS('void', '#.items = #', this._jsObject, convertArgument(items)); |
| 134 } | 86 } |
| 135 | 87 |
| 136 } | 88 } |
| 137 | 89 |
| 138 class AppRuntimeIntentResponse extends ChromeObject { | |
| 139 /* | |
| 140 * Public constructor | |
| 141 */ | |
| 142 AppRuntimeIntentResponse({int intentId, bool success, Object data}) { | |
| 143 if (intentId != null) | |
| 144 this.intentId = intentId; | |
| 145 if (success != null) | |
| 146 this.success = success; | |
| 147 if (data != null) | |
| 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 /** | 90 /** |
| 183 * Events | 91 * Events |
| 184 */ | 92 */ |
| 185 | 93 |
| 186 /// Fired when an app is launched from the launcher or in response to a web | 94 /// Fired when an app is launched from the launcher. |
| 187 /// intent. | |
| 188 class Event_app_runtime_onLaunched extends Event { | 95 class Event_app_runtime_onLaunched extends Event { |
| 189 void addListener(void callback(AppRuntimeLaunchData launchData)) { | 96 void addListener(void callback(AppRuntimeLaunchData launchData)) { |
| 190 void __proxy_callback(launchData) { | 97 void __proxy_callback(launchData) { |
| 191 if (callback != null) { | 98 if (callback != null) { |
| 192 callback(new AppRuntimeLaunchData._proxy(launchData)); | 99 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 193 } | 100 } |
| 194 } | 101 } |
| 195 super.addListener(callback); | 102 super.addListener(__proxy_callback); |
| 196 } | 103 } |
| 197 | 104 |
| 198 void removeListener(void callback(AppRuntimeLaunchData launchData)) { | 105 void removeListener(void callback(AppRuntimeLaunchData launchData)) { |
| 199 void __proxy_callback(launchData) { | 106 void __proxy_callback(launchData) { |
| 200 if (callback != null) { | 107 if (callback != null) { |
| 201 callback(new AppRuntimeLaunchData._proxy(launchData)); | 108 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 202 } | 109 } |
| 203 } | 110 } |
| 204 super.removeListener(callback); | 111 super.removeListener(__proxy_callback); |
| 205 } | 112 } |
| 206 | 113 |
| 207 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { | 114 bool hasListener(void callback(AppRuntimeLaunchData launchData)) { |
| 208 void __proxy_callback(launchData) { | 115 void __proxy_callback(launchData) { |
| 209 if (callback != null) { | 116 if (callback != null) { |
| 210 callback(new AppRuntimeLaunchData._proxy(launchData)); | 117 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 211 } | 118 } |
| 212 } | 119 } |
| 213 super.hasListener(callback); | 120 super.hasListener(__proxy_callback); |
| 214 } | 121 } |
| 215 | 122 |
| 216 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); | 123 Event_app_runtime_onLaunched(jsObject) : super._(jsObject, 1); |
| 217 } | 124 } |
| 218 | 125 |
| 219 /// Fired at Chrome startup to apps that were running when Chrome last shut | 126 /// Fired at Chrome startup to apps that were running when Chrome last shut |
| 220 /// down. | 127 /// down. |
| 221 class Event_app_runtime_onRestarted extends Event { | 128 class Event_app_runtime_onRestarted extends Event { |
| 222 void addListener(void callback()) => super.addListener(callback); | 129 void addListener(void callback()) => super.addListener(callback); |
| 223 | 130 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 236 /* | 143 /* |
| 237 * API connection | 144 * API connection |
| 238 */ | 145 */ |
| 239 Object _jsObject; | 146 Object _jsObject; |
| 240 | 147 |
| 241 /* | 148 /* |
| 242 * Events | 149 * Events |
| 243 */ | 150 */ |
| 244 Event_app_runtime_onLaunched onLaunched; | 151 Event_app_runtime_onLaunched onLaunched; |
| 245 Event_app_runtime_onRestarted onRestarted; | 152 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) { | 153 API_app_runtime(this._jsObject) { |
| 256 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); | 154 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); |
| 257 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); | 155 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); |
| 258 } | 156 } |
| 259 } | 157 } |
| OLD | NEW |