| 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) | 18 if (?entry) |
| 61 this.entry = entry; | 19 this.entry = entry; |
| 62 if (?type) | 20 if (?type) |
| 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) | |
| 96 this.intent = intent; | |
| 97 if (?id) | 53 if (?id) |
| 98 this.id = id; | 54 this.id = id; |
| 99 if (?items) | 55 if (?items) |
| 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 for (var o in JS('List', '#.items', this._jsObject)) { |
| 127 __proxy_items.add(new AppRuntimeLaunchItem._proxy(o)); | 77 __proxy_items.add(new AppRuntimeLaunchItem._proxy(o)); |
| 128 } | 78 } |
| 129 return __proxy_items; | 79 return __proxy_items; |
| 130 } | 80 } |
| 131 | 81 |
| 132 void set items(List<AppRuntimeLaunchItem> items) { | 82 void set items(List<AppRuntimeLaunchItem> items) { |
| 133 JS('void', '#.items = #', this._jsObject, convertArgument(items)); | 83 JS('void', '#.items = #', this._jsObject, convertArgument(items)); |
| 134 } | 84 } |
| 135 | 85 |
| 136 } | 86 } |
| 137 | 87 |
| 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 /** | 88 /** |
| 183 * Events | 89 * Events |
| 184 */ | 90 */ |
| 185 | 91 |
| 186 /// Fired when an app is launched from the launcher or in response to a web | 92 /// Fired when an app is launched from the launcher. |
| 187 /// intent. | |
| 188 class Event_app_runtime_onLaunched extends Event { | 93 class Event_app_runtime_onLaunched extends Event { |
| 189 void addListener(void callback(AppRuntimeLaunchData launchData)) { | 94 void addListener(void callback(AppRuntimeLaunchData launchData)) { |
| 190 void __proxy_callback(launchData) { | 95 void __proxy_callback(launchData) { |
| 191 if (?callback) { | 96 if (?callback) { |
| 192 callback(new AppRuntimeLaunchData._proxy(launchData)); | 97 callback(new AppRuntimeLaunchData._proxy(launchData)); |
| 193 } | 98 } |
| 194 } | 99 } |
| 195 super.addListener(callback); | 100 super.addListener(callback); |
| 196 } | 101 } |
| 197 | 102 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 /* | 141 /* |
| 237 * API connection | 142 * API connection |
| 238 */ | 143 */ |
| 239 Object _jsObject; | 144 Object _jsObject; |
| 240 | 145 |
| 241 /* | 146 /* |
| 242 * Events | 147 * Events |
| 243 */ | 148 */ |
| 244 Event_app_runtime_onLaunched onLaunched; | 149 Event_app_runtime_onLaunched onLaunched; |
| 245 Event_app_runtime_onRestarted onRestarted; | 150 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) { | 151 API_app_runtime(this._jsObject) { |
| 256 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); | 152 onLaunched = new Event_app_runtime_onLaunched(JS('', '#.onLaunched', this._j
sObject)); |
| 257 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); | 153 onRestarted = new Event_app_runtime_onRestarted(JS('', '#.onRestarted', this
._jsObject)); |
| 258 } | 154 } |
| 259 } | 155 } |
| OLD | NEW |