OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library shell_mojom; | 5 library shell_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:mojo/bindings.dart' as bindings; | 9 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 10 import 'package:mojo/core.dart' as core; |
| 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 import 'package:mojo/mojo/application_connector.mojom.dart' as application_conne
ctor_mojom; | 13 import 'package:mojo/mojo/application_connector.mojom.dart' as application_conne
ctor_mojom; |
12 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom
; | 14 import 'package:mojo/mojo/service_provider.mojom.dart' as service_provider_mojom
; |
13 | 15 |
14 | 16 |
15 | 17 |
16 class _ShellConnectToApplicationParams extends bindings.Struct { | 18 class _ShellConnectToApplicationParams extends bindings.Struct { |
17 static const List<bindings.StructDataHeader> kVersions = const [ | 19 static const List<bindings.StructDataHeader> kVersions = const [ |
18 const bindings.StructDataHeader(32, 0) | 20 const bindings.StructDataHeader(32, 0) |
19 ]; | 21 ]; |
20 String applicationUrl = null; | 22 String applicationUrl = null; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 "exposedServices: $exposedServices" ")"; | 90 "exposedServices: $exposedServices" ")"; |
89 } | 91 } |
90 | 92 |
91 Map toJson() { | 93 Map toJson() { |
92 throw new bindings.MojoCodecError( | 94 throw new bindings.MojoCodecError( |
93 'Object containing handles cannot be encoded to JSON.'); | 95 'Object containing handles cannot be encoded to JSON.'); |
94 } | 96 } |
95 } | 97 } |
96 | 98 |
97 | 99 |
| 100 |
| 101 |
98 class _ShellCreateApplicationConnectorParams extends bindings.Struct { | 102 class _ShellCreateApplicationConnectorParams extends bindings.Struct { |
99 static const List<bindings.StructDataHeader> kVersions = const [ | 103 static const List<bindings.StructDataHeader> kVersions = const [ |
100 const bindings.StructDataHeader(16, 0) | 104 const bindings.StructDataHeader(16, 0) |
101 ]; | 105 ]; |
102 Object applicationConnectorRequest = null; | 106 Object applicationConnectorRequest = null; |
103 | 107 |
104 _ShellCreateApplicationConnectorParams() : super(kVersions.last.size); | 108 _ShellCreateApplicationConnectorParams() : super(kVersions.last.size); |
105 | 109 |
106 static _ShellCreateApplicationConnectorParams deserialize(bindings.Message mes
sage) { | 110 static _ShellCreateApplicationConnectorParams deserialize(bindings.Message mes
sage) { |
107 var decoder = new bindings.Decoder(message); | 111 var decoder = new bindings.Decoder(message); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return "_ShellCreateApplicationConnectorParams(" | 157 return "_ShellCreateApplicationConnectorParams(" |
154 "applicationConnectorRequest: $applicationConnectorRequest" ")"; | 158 "applicationConnectorRequest: $applicationConnectorRequest" ")"; |
155 } | 159 } |
156 | 160 |
157 Map toJson() { | 161 Map toJson() { |
158 throw new bindings.MojoCodecError( | 162 throw new bindings.MojoCodecError( |
159 'Object containing handles cannot be encoded to JSON.'); | 163 'Object containing handles cannot be encoded to JSON.'); |
160 } | 164 } |
161 } | 165 } |
162 | 166 |
| 167 |
| 168 |
| 169 |
163 const int _Shell_connectToApplicationName = 0; | 170 const int _Shell_connectToApplicationName = 0; |
164 const int _Shell_createApplicationConnectorName = 1; | 171 const int _Shell_createApplicationConnectorName = 1; |
165 | 172 |
| 173 |
| 174 |
| 175 class _ShellServiceDescription implements service_describer.ServiceDescription { |
| 176 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 177 |
| 178 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 179 |
| 180 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 181 } |
| 182 |
166 abstract class Shell { | 183 abstract class Shell { |
167 static const String serviceName = null; | 184 static const String serviceName = null; |
168 void connectToApplication(String applicationUrl, Object services, Object expos
edServices); | 185 void connectToApplication(String applicationUrl, Object services, Object expos
edServices); |
169 void createApplicationConnector(Object applicationConnectorRequest); | 186 void createApplicationConnector(Object applicationConnectorRequest); |
170 } | 187 } |
171 | 188 |
172 | 189 |
173 class _ShellProxyImpl extends bindings.Proxy { | 190 class _ShellProxyImpl extends bindings.Proxy { |
174 _ShellProxyImpl.fromEndpoint( | 191 _ShellProxyImpl.fromEndpoint( |
175 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 192 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
176 | 193 |
177 _ShellProxyImpl.fromHandle(core.MojoHandle handle) : | 194 _ShellProxyImpl.fromHandle(core.MojoHandle handle) : |
178 super.fromHandle(handle); | 195 super.fromHandle(handle); |
179 | 196 |
180 _ShellProxyImpl.unbound() : super.unbound(); | 197 _ShellProxyImpl.unbound() : super.unbound(); |
181 | 198 |
182 static _ShellProxyImpl newFromEndpoint( | 199 static _ShellProxyImpl newFromEndpoint( |
183 core.MojoMessagePipeEndpoint endpoint) { | 200 core.MojoMessagePipeEndpoint endpoint) { |
184 assert(endpoint.setDescription("For _ShellProxyImpl")); | 201 assert(endpoint.setDescription("For _ShellProxyImpl")); |
185 return new _ShellProxyImpl.fromEndpoint(endpoint); | 202 return new _ShellProxyImpl.fromEndpoint(endpoint); |
186 } | 203 } |
187 | 204 |
| 205 service_describer.ServiceDescription get serviceDescription => |
| 206 new _ShellServiceDescription(); |
| 207 |
188 void handleResponse(bindings.ServiceMessage message) { | 208 void handleResponse(bindings.ServiceMessage message) { |
189 switch (message.header.type) { | 209 switch (message.header.type) { |
190 default: | 210 default: |
191 proxyError("Unexpected message type: ${message.header.type}"); | 211 proxyError("Unexpected message type: ${message.header.type}"); |
192 close(immediate: true); | 212 close(immediate: true); |
193 break; | 213 break; |
194 } | 214 } |
195 } | 215 } |
196 | 216 |
197 String toString() { | 217 String toString() { |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 assert(_impl == null); | 357 assert(_impl == null); |
338 _impl = d; | 358 _impl = d; |
339 } | 359 } |
340 | 360 |
341 String toString() { | 361 String toString() { |
342 var superString = super.toString(); | 362 var superString = super.toString(); |
343 return "ShellStub($superString)"; | 363 return "ShellStub($superString)"; |
344 } | 364 } |
345 | 365 |
346 int get version => 0; | 366 int get version => 0; |
| 367 |
| 368 service_describer.ServiceDescription get serviceDescription => |
| 369 new _ShellServiceDescription(); |
347 } | 370 } |
348 | 371 |
349 | 372 |
| 373 |
OLD | NEW |