| 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 http_server_mojom; | 5 library http_server_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/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
| 11 import 'package:mojo_services/mojo/http_connection.mojom.dart' as http_connectio
n_mojom; | 13 import 'package:mojo_services/mojo/http_connection.mojom.dart' as http_connectio
n_mojom; |
| 12 | 14 |
| 13 | 15 |
| 14 | 16 |
| 15 class HttpServerDelegateOnConnectedParams extends bindings.Struct { | 17 class HttpServerDelegateOnConnectedParams extends bindings.Struct { |
| 16 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
| 17 const bindings.StructDataHeader(24, 0) | 19 const bindings.StructDataHeader(24, 0) |
| 18 ]; | 20 ]; |
| 19 Object connection = null; | 21 Object connection = null; |
| 20 Object delegate = null; | 22 Object delegate = null; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 "connection: $connection" ", " | 80 "connection: $connection" ", " |
| 79 "delegate: $delegate" ")"; | 81 "delegate: $delegate" ")"; |
| 80 } | 82 } |
| 81 | 83 |
| 82 Map toJson() { | 84 Map toJson() { |
| 83 throw new bindings.MojoCodecError( | 85 throw new bindings.MojoCodecError( |
| 84 'Object containing handles cannot be encoded to JSON.'); | 86 'Object containing handles cannot be encoded to JSON.'); |
| 85 } | 87 } |
| 86 } | 88 } |
| 87 | 89 |
| 90 mojom_types.MojomStruct _http_server_HttpServerDelegate_OnConnected_Params__() { |
| 91 return new mojom_types.MojomStruct() |
| 92 ..declData = (new mojom_types.DeclarationData()..shortName = 'HttpServerDele
gateOnConnectedParams') |
| 93 ..fields = <mojom_types.StructField>[ |
| 94 new mojom_types.StructField() |
| 95 ..declData = (new mojom_types.DeclarationData()..shortName = 'Connection
') |
| 96 ..type = (new mojom_types.Type() |
| 97 ..typeReference = (new mojom_types.TypeReference() |
| 98 |
| 99 ..identifier = '_http_connection_HttpConnection__' |
| 100 ..typeKey = '_http_connection_HttpConnection__' |
| 101 )), |
| 102 |
| 103 new mojom_types.StructField() |
| 104 ..declData = (new mojom_types.DeclarationData()..shortName = 'Delegate') |
| 105 ..type = (new mojom_types.Type() |
| 106 ..typeReference = (new mojom_types.TypeReference() |
| 107 |
| 108 ..isInterfaceRequest = true |
| 109 ..identifier = '_http_connection_HttpConnectionDelegate__' |
| 110 ..typeKey = '_http_connection_HttpConnectionDelegate__' |
| 111 )), |
| 112 ]; |
| 113 } |
| 114 |
| 115 |
| 88 const int kHttpServerDelegate_onConnected_name = 0; | 116 const int kHttpServerDelegate_onConnected_name = 0; |
| 89 | 117 |
| 90 const String HttpServerDelegateName = | 118 const String HttpServerDelegateName = |
| 91 'mojo::HttpServerDelegate'; | 119 'mojo::HttpServerDelegate'; |
| 92 | 120 |
| 121 mojom_types.MojomInterface _http_server_HttpServerDelegate__() { |
| 122 return new mojom_types.MojomInterface() |
| 123 ..declData = (new mojom_types.DeclarationData()..shortName = "HttpServerDele
gate") |
| 124 ..interfaceName = "HttpServerDelegate" |
| 125 ..methods = <int, mojom_types.MojomMethod>{ |
| 126 kHttpServerDelegate_onConnected_name: new mojom_types.MojomMethod() |
| 127 ..declData = (new mojom_types.DeclarationData()..shortName = "OnConnecte
d") |
| 128 ..ordinal = kHttpServerDelegate_onConnected_name..parameters = _http_ser
ver_HttpServerDelegate_OnConnected_Params__(), |
| 129 }; |
| 130 } |
| 131 |
| 132 class _HttpServerDelegateServiceDescription extends service_describer.ServiceDes
cription { |
| 133 // Avoid infinite loop by overriding serviceDescription field. |
| 134 final service_describer.ServiceDescription serviceDescription = null; |
| 135 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 136 return _http_server_HttpServerDelegate__(); |
| 137 } |
| 138 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 139 return getAllMojomTypeDefinitions()[typeKey]; |
| 140 } |
| 141 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 142 return getAllMojomTypeDefinitions(); |
| 143 } |
| 144 } |
| 145 |
| 93 abstract class HttpServerDelegate { | 146 abstract class HttpServerDelegate { |
| 94 void onConnected(Object connection, Object delegate); | 147 void onConnected(Object connection, Object delegate); |
| 95 | 148 |
| 96 } | 149 } |
| 97 | 150 |
| 98 | 151 |
| 99 class HttpServerDelegateProxyImpl extends bindings.Proxy { | 152 class HttpServerDelegateProxyImpl extends bindings.Proxy { |
| 100 HttpServerDelegateProxyImpl.fromEndpoint( | 153 HttpServerDelegateProxyImpl.fromEndpoint( |
| 101 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 154 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 102 | 155 |
| 103 HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) : | 156 HttpServerDelegateProxyImpl.fromHandle(core.MojoHandle handle) : |
| 104 super.fromHandle(handle); | 157 super.fromHandle(handle); |
| 105 | 158 |
| 106 HttpServerDelegateProxyImpl.unbound() : super.unbound(); | 159 HttpServerDelegateProxyImpl.unbound() : super.unbound(); |
| 107 | 160 |
| 108 static HttpServerDelegateProxyImpl newFromEndpoint( | 161 static HttpServerDelegateProxyImpl newFromEndpoint( |
| 109 core.MojoMessagePipeEndpoint endpoint) { | 162 core.MojoMessagePipeEndpoint endpoint) { |
| 110 assert(endpoint.setDescription("For HttpServerDelegateProxyImpl")); | 163 assert(endpoint.setDescription("For HttpServerDelegateProxyImpl")); |
| 111 return new HttpServerDelegateProxyImpl.fromEndpoint(endpoint); | 164 return new HttpServerDelegateProxyImpl.fromEndpoint(endpoint); |
| 112 } | 165 } |
| 113 | 166 |
| 114 String get name => HttpServerDelegateName; | 167 String get name => HttpServerDelegateName; |
| 115 | 168 |
| 169 service_describer.ServiceDescription get serviceDescription => |
| 170 new _HttpServerDelegateServiceDescription(); |
| 171 |
| 116 void handleResponse(bindings.ServiceMessage message) { | 172 void handleResponse(bindings.ServiceMessage message) { |
| 117 switch (message.header.type) { | 173 switch (message.header.type) { |
| 118 default: | 174 default: |
| 119 proxyError("Unexpected message type: ${message.header.type}"); | 175 proxyError("Unexpected message type: ${message.header.type}"); |
| 120 close(immediate: true); | 176 close(immediate: true); |
| 121 break; | 177 break; |
| 122 } | 178 } |
| 123 } | 179 } |
| 124 | 180 |
| 125 String toString() { | 181 String toString() { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 assert(_impl == null); | 308 assert(_impl == null); |
| 253 _impl = d; | 309 _impl = d; |
| 254 } | 310 } |
| 255 | 311 |
| 256 String toString() { | 312 String toString() { |
| 257 var superString = super.toString(); | 313 var superString = super.toString(); |
| 258 return "HttpServerDelegateStub($superString)"; | 314 return "HttpServerDelegateStub($superString)"; |
| 259 } | 315 } |
| 260 | 316 |
| 261 int get version => 0; | 317 int get version => 0; |
| 318 |
| 319 service_describer.ServiceDescription get serviceDescription => |
| 320 new _HttpServerDelegateServiceDescription(); |
| 262 } | 321 } |
| 263 | 322 |
| 264 | 323 |
| 324 |
| 325 |
| 326 |
| 327 |
| 328 |
| 329 |
| 330 var _MojomDesc__ = _initDescriptions(); |
| 331 |
| 332 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 333 var map = new Map<String, mojom_types.UserDefinedType>(); |
| 334 |
| 335 map["_http_server_HttpServerDelegate_OnConnected_Params__"] = |
| 336 new mojom_types.UserDefinedType() |
| 337 ..structType = _http_server_HttpServerDelegate_OnConnected_Params__(); |
| 338 |
| 339 |
| 340 |
| 341 |
| 342 |
| 343 |
| 344 |
| 345 map["_http_server_HttpServerDelegate__"] = |
| 346 new mojom_types.UserDefinedType() |
| 347 ..interfaceType = _http_server_HttpServerDelegate__(); |
| 348 |
| 349 http_connection_mojom.getAllMojomTypeDefinitions().forEach((String s, mojom_type
s.UserDefinedType udt) { |
| 350 map[s] = udt; |
| 351 }); |
| 352 return map; |
| 353 } |
| 354 |
| 355 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 356 return _MojomDesc__; |
| 357 } |
| 358 |
| 359 |
| OLD | NEW |