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_connection_mojom; | 5 library http_connection_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/network_error.mojom.dart' as network_error_mojom; | 13 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
12 import 'package:mojo_services/mojo/http_message.mojom.dart' as http_message_mojo
m; | 14 import 'package:mojo_services/mojo/http_message.mojom.dart' as http_message_mojo
m; |
13 import 'package:mojo_services/mojo/web_socket.mojom.dart' as web_socket_mojom; | 15 import 'package:mojo_services/mojo/web_socket.mojom.dart' as web_socket_mojom; |
14 | 16 |
15 | 17 |
16 | 18 |
17 class _HttpConnectionSetSendBufferSizeParams extends bindings.Struct { | 19 class _HttpConnectionSetSendBufferSizeParams extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 20 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(16, 0) | 21 const bindings.StructDataHeader(16, 0) |
20 ]; | 22 ]; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 76 } |
75 | 77 |
76 Map toJson() { | 78 Map toJson() { |
77 Map map = new Map(); | 79 Map map = new Map(); |
78 map["size"] = size; | 80 map["size"] = size; |
79 return map; | 81 return map; |
80 } | 82 } |
81 } | 83 } |
82 | 84 |
83 | 85 |
| 86 |
| 87 |
84 class HttpConnectionSetSendBufferSizeResponseParams extends bindings.Struct { | 88 class HttpConnectionSetSendBufferSizeResponseParams extends bindings.Struct { |
85 static const List<bindings.StructDataHeader> kVersions = const [ | 89 static const List<bindings.StructDataHeader> kVersions = const [ |
86 const bindings.StructDataHeader(16, 0) | 90 const bindings.StructDataHeader(16, 0) |
87 ]; | 91 ]; |
88 network_error_mojom.NetworkError result = null; | 92 network_error_mojom.NetworkError result = null; |
89 | 93 |
90 HttpConnectionSetSendBufferSizeResponseParams() : super(kVersions.last.size); | 94 HttpConnectionSetSendBufferSizeResponseParams() : super(kVersions.last.size); |
91 | 95 |
92 static HttpConnectionSetSendBufferSizeResponseParams deserialize(bindings.Mess
age message) { | 96 static HttpConnectionSetSendBufferSizeResponseParams deserialize(bindings.Mess
age message) { |
93 var decoder = new bindings.Decoder(message); | 97 var decoder = new bindings.Decoder(message); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 146 } |
143 | 147 |
144 Map toJson() { | 148 Map toJson() { |
145 Map map = new Map(); | 149 Map map = new Map(); |
146 map["result"] = result; | 150 map["result"] = result; |
147 return map; | 151 return map; |
148 } | 152 } |
149 } | 153 } |
150 | 154 |
151 | 155 |
| 156 |
| 157 |
152 class _HttpConnectionSetReceiveBufferSizeParams extends bindings.Struct { | 158 class _HttpConnectionSetReceiveBufferSizeParams extends bindings.Struct { |
153 static const List<bindings.StructDataHeader> kVersions = const [ | 159 static const List<bindings.StructDataHeader> kVersions = const [ |
154 const bindings.StructDataHeader(16, 0) | 160 const bindings.StructDataHeader(16, 0) |
155 ]; | 161 ]; |
156 int size = 0; | 162 int size = 0; |
157 | 163 |
158 _HttpConnectionSetReceiveBufferSizeParams() : super(kVersions.last.size); | 164 _HttpConnectionSetReceiveBufferSizeParams() : super(kVersions.last.size); |
159 | 165 |
160 static _HttpConnectionSetReceiveBufferSizeParams deserialize(bindings.Message
message) { | 166 static _HttpConnectionSetReceiveBufferSizeParams deserialize(bindings.Message
message) { |
161 var decoder = new bindings.Decoder(message); | 167 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 215 } |
210 | 216 |
211 Map toJson() { | 217 Map toJson() { |
212 Map map = new Map(); | 218 Map map = new Map(); |
213 map["size"] = size; | 219 map["size"] = size; |
214 return map; | 220 return map; |
215 } | 221 } |
216 } | 222 } |
217 | 223 |
218 | 224 |
| 225 |
| 226 |
219 class HttpConnectionSetReceiveBufferSizeResponseParams extends bindings.Struct { | 227 class HttpConnectionSetReceiveBufferSizeResponseParams extends bindings.Struct { |
220 static const List<bindings.StructDataHeader> kVersions = const [ | 228 static const List<bindings.StructDataHeader> kVersions = const [ |
221 const bindings.StructDataHeader(16, 0) | 229 const bindings.StructDataHeader(16, 0) |
222 ]; | 230 ]; |
223 network_error_mojom.NetworkError result = null; | 231 network_error_mojom.NetworkError result = null; |
224 | 232 |
225 HttpConnectionSetReceiveBufferSizeResponseParams() : super(kVersions.last.size
); | 233 HttpConnectionSetReceiveBufferSizeResponseParams() : super(kVersions.last.size
); |
226 | 234 |
227 static HttpConnectionSetReceiveBufferSizeResponseParams deserialize(bindings.M
essage message) { | 235 static HttpConnectionSetReceiveBufferSizeResponseParams deserialize(bindings.M
essage message) { |
228 var decoder = new bindings.Decoder(message); | 236 var decoder = new bindings.Decoder(message); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 285 } |
278 | 286 |
279 Map toJson() { | 287 Map toJson() { |
280 Map map = new Map(); | 288 Map map = new Map(); |
281 map["result"] = result; | 289 map["result"] = result; |
282 return map; | 290 return map; |
283 } | 291 } |
284 } | 292 } |
285 | 293 |
286 | 294 |
| 295 |
| 296 |
287 class _HttpConnectionDelegateOnReceivedRequestParams extends bindings.Struct { | 297 class _HttpConnectionDelegateOnReceivedRequestParams extends bindings.Struct { |
288 static const List<bindings.StructDataHeader> kVersions = const [ | 298 static const List<bindings.StructDataHeader> kVersions = const [ |
289 const bindings.StructDataHeader(16, 0) | 299 const bindings.StructDataHeader(16, 0) |
290 ]; | 300 ]; |
291 http_message_mojom.HttpRequest request = null; | 301 http_message_mojom.HttpRequest request = null; |
292 | 302 |
293 _HttpConnectionDelegateOnReceivedRequestParams() : super(kVersions.last.size); | 303 _HttpConnectionDelegateOnReceivedRequestParams() : super(kVersions.last.size); |
294 | 304 |
295 static _HttpConnectionDelegateOnReceivedRequestParams deserialize(bindings.Mes
sage message) { | 305 static _HttpConnectionDelegateOnReceivedRequestParams deserialize(bindings.Mes
sage message) { |
296 var decoder = new bindings.Decoder(message); | 306 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 "request: $request" ")"; | 354 "request: $request" ")"; |
345 } | 355 } |
346 | 356 |
347 Map toJson() { | 357 Map toJson() { |
348 throw new bindings.MojoCodecError( | 358 throw new bindings.MojoCodecError( |
349 'Object containing handles cannot be encoded to JSON.'); | 359 'Object containing handles cannot be encoded to JSON.'); |
350 } | 360 } |
351 } | 361 } |
352 | 362 |
353 | 363 |
| 364 |
| 365 |
354 class HttpConnectionDelegateOnReceivedRequestResponseParams extends bindings.Str
uct { | 366 class HttpConnectionDelegateOnReceivedRequestResponseParams extends bindings.Str
uct { |
355 static const List<bindings.StructDataHeader> kVersions = const [ | 367 static const List<bindings.StructDataHeader> kVersions = const [ |
356 const bindings.StructDataHeader(16, 0) | 368 const bindings.StructDataHeader(16, 0) |
357 ]; | 369 ]; |
358 http_message_mojom.HttpResponse response = null; | 370 http_message_mojom.HttpResponse response = null; |
359 | 371 |
360 HttpConnectionDelegateOnReceivedRequestResponseParams() : super(kVersions.last
.size); | 372 HttpConnectionDelegateOnReceivedRequestResponseParams() : super(kVersions.last
.size); |
361 | 373 |
362 static HttpConnectionDelegateOnReceivedRequestResponseParams deserialize(bindi
ngs.Message message) { | 374 static HttpConnectionDelegateOnReceivedRequestResponseParams deserialize(bindi
ngs.Message message) { |
363 var decoder = new bindings.Decoder(message); | 375 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 "response: $response" ")"; | 423 "response: $response" ")"; |
412 } | 424 } |
413 | 425 |
414 Map toJson() { | 426 Map toJson() { |
415 throw new bindings.MojoCodecError( | 427 throw new bindings.MojoCodecError( |
416 'Object containing handles cannot be encoded to JSON.'); | 428 'Object containing handles cannot be encoded to JSON.'); |
417 } | 429 } |
418 } | 430 } |
419 | 431 |
420 | 432 |
| 433 |
| 434 |
421 class _HttpConnectionDelegateOnReceivedWebSocketRequestParams extends bindings.S
truct { | 435 class _HttpConnectionDelegateOnReceivedWebSocketRequestParams extends bindings.S
truct { |
422 static const List<bindings.StructDataHeader> kVersions = const [ | 436 static const List<bindings.StructDataHeader> kVersions = const [ |
423 const bindings.StructDataHeader(16, 0) | 437 const bindings.StructDataHeader(16, 0) |
424 ]; | 438 ]; |
425 http_message_mojom.HttpRequest request = null; | 439 http_message_mojom.HttpRequest request = null; |
426 | 440 |
427 _HttpConnectionDelegateOnReceivedWebSocketRequestParams() : super(kVersions.la
st.size); | 441 _HttpConnectionDelegateOnReceivedWebSocketRequestParams() : super(kVersions.la
st.size); |
428 | 442 |
429 static _HttpConnectionDelegateOnReceivedWebSocketRequestParams deserialize(bin
dings.Message message) { | 443 static _HttpConnectionDelegateOnReceivedWebSocketRequestParams deserialize(bin
dings.Message message) { |
430 var decoder = new bindings.Decoder(message); | 444 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 "request: $request" ")"; | 492 "request: $request" ")"; |
479 } | 493 } |
480 | 494 |
481 Map toJson() { | 495 Map toJson() { |
482 throw new bindings.MojoCodecError( | 496 throw new bindings.MojoCodecError( |
483 'Object containing handles cannot be encoded to JSON.'); | 497 'Object containing handles cannot be encoded to JSON.'); |
484 } | 498 } |
485 } | 499 } |
486 | 500 |
487 | 501 |
| 502 |
| 503 |
488 class HttpConnectionDelegateOnReceivedWebSocketRequestResponseParams extends bin
dings.Struct { | 504 class HttpConnectionDelegateOnReceivedWebSocketRequestResponseParams extends bin
dings.Struct { |
489 static const List<bindings.StructDataHeader> kVersions = const [ | 505 static const List<bindings.StructDataHeader> kVersions = const [ |
490 const bindings.StructDataHeader(24, 0) | 506 const bindings.StructDataHeader(24, 0) |
491 ]; | 507 ]; |
492 Object webSocket = null; | 508 Object webSocket = null; |
493 core.MojoDataPipeConsumer sendStream = null; | 509 core.MojoDataPipeConsumer sendStream = null; |
494 Object client = null; | 510 Object client = null; |
495 | 511 |
496 HttpConnectionDelegateOnReceivedWebSocketRequestResponseParams() : super(kVers
ions.last.size); | 512 HttpConnectionDelegateOnReceivedWebSocketRequestResponseParams() : super(kVers
ions.last.size); |
497 | 513 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 "sendStream: $sendStream" ", " | 575 "sendStream: $sendStream" ", " |
560 "client: $client" ")"; | 576 "client: $client" ")"; |
561 } | 577 } |
562 | 578 |
563 Map toJson() { | 579 Map toJson() { |
564 throw new bindings.MojoCodecError( | 580 throw new bindings.MojoCodecError( |
565 'Object containing handles cannot be encoded to JSON.'); | 581 'Object containing handles cannot be encoded to JSON.'); |
566 } | 582 } |
567 } | 583 } |
568 | 584 |
| 585 |
| 586 |
| 587 |
569 const int _HttpConnection_setSendBufferSizeName = 0; | 588 const int _HttpConnection_setSendBufferSizeName = 0; |
570 const int _HttpConnection_setReceiveBufferSizeName = 1; | 589 const int _HttpConnection_setReceiveBufferSizeName = 1; |
571 | 590 |
| 591 |
| 592 |
| 593 class _HttpConnectionServiceDescription implements service_describer.ServiceDesc
ription { |
| 594 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 595 |
| 596 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 597 |
| 598 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 599 } |
| 600 |
572 abstract class HttpConnection { | 601 abstract class HttpConnection { |
573 static const String serviceName = null; | 602 static const String serviceName = null; |
574 dynamic setSendBufferSize(int size,[Function responseFactory = null]); | 603 dynamic setSendBufferSize(int size,[Function responseFactory = null]); |
575 dynamic setReceiveBufferSize(int size,[Function responseFactory = null]); | 604 dynamic setReceiveBufferSize(int size,[Function responseFactory = null]); |
576 } | 605 } |
577 | 606 |
578 | 607 |
579 class _HttpConnectionProxyImpl extends bindings.Proxy { | 608 class _HttpConnectionProxyImpl extends bindings.Proxy { |
580 _HttpConnectionProxyImpl.fromEndpoint( | 609 _HttpConnectionProxyImpl.fromEndpoint( |
581 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 610 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
582 | 611 |
583 _HttpConnectionProxyImpl.fromHandle(core.MojoHandle handle) : | 612 _HttpConnectionProxyImpl.fromHandle(core.MojoHandle handle) : |
584 super.fromHandle(handle); | 613 super.fromHandle(handle); |
585 | 614 |
586 _HttpConnectionProxyImpl.unbound() : super.unbound(); | 615 _HttpConnectionProxyImpl.unbound() : super.unbound(); |
587 | 616 |
588 static _HttpConnectionProxyImpl newFromEndpoint( | 617 static _HttpConnectionProxyImpl newFromEndpoint( |
589 core.MojoMessagePipeEndpoint endpoint) { | 618 core.MojoMessagePipeEndpoint endpoint) { |
590 assert(endpoint.setDescription("For _HttpConnectionProxyImpl")); | 619 assert(endpoint.setDescription("For _HttpConnectionProxyImpl")); |
591 return new _HttpConnectionProxyImpl.fromEndpoint(endpoint); | 620 return new _HttpConnectionProxyImpl.fromEndpoint(endpoint); |
592 } | 621 } |
593 | 622 |
| 623 service_describer.ServiceDescription get serviceDescription => |
| 624 new _HttpConnectionServiceDescription(); |
| 625 |
594 void handleResponse(bindings.ServiceMessage message) { | 626 void handleResponse(bindings.ServiceMessage message) { |
595 switch (message.header.type) { | 627 switch (message.header.type) { |
596 case _HttpConnection_setSendBufferSizeName: | 628 case _HttpConnection_setSendBufferSizeName: |
597 var r = HttpConnectionSetSendBufferSizeResponseParams.deserialize( | 629 var r = HttpConnectionSetSendBufferSizeResponseParams.deserialize( |
598 message.payload); | 630 message.payload); |
599 if (!message.header.hasRequestId) { | 631 if (!message.header.hasRequestId) { |
600 proxyError("Expected a message with a valid request Id."); | 632 proxyError("Expected a message with a valid request Id."); |
601 return; | 633 return; |
602 } | 634 } |
603 Completer c = completerMap[message.header.requestId]; | 635 Completer c = completerMap[message.header.requestId]; |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 assert(_impl == null); | 857 assert(_impl == null); |
826 _impl = d; | 858 _impl = d; |
827 } | 859 } |
828 | 860 |
829 String toString() { | 861 String toString() { |
830 var superString = super.toString(); | 862 var superString = super.toString(); |
831 return "HttpConnectionStub($superString)"; | 863 return "HttpConnectionStub($superString)"; |
832 } | 864 } |
833 | 865 |
834 int get version => 0; | 866 int get version => 0; |
| 867 |
| 868 service_describer.ServiceDescription get serviceDescription => |
| 869 new _HttpConnectionServiceDescription(); |
835 } | 870 } |
836 | 871 |
837 const int _HttpConnectionDelegate_onReceivedRequestName = 0; | 872 const int _HttpConnectionDelegate_onReceivedRequestName = 0; |
838 const int _HttpConnectionDelegate_onReceivedWebSocketRequestName = 1; | 873 const int _HttpConnectionDelegate_onReceivedWebSocketRequestName = 1; |
839 | 874 |
| 875 |
| 876 |
| 877 class _HttpConnectionDelegateServiceDescription implements service_describer.Ser
viceDescription { |
| 878 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 879 |
| 880 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 881 |
| 882 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 883 } |
| 884 |
840 abstract class HttpConnectionDelegate { | 885 abstract class HttpConnectionDelegate { |
841 static const String serviceName = null; | 886 static const String serviceName = null; |
842 dynamic onReceivedRequest(http_message_mojom.HttpRequest request,[Function res
ponseFactory = null]); | 887 dynamic onReceivedRequest(http_message_mojom.HttpRequest request,[Function res
ponseFactory = null]); |
843 dynamic onReceivedWebSocketRequest(http_message_mojom.HttpRequest request,[Fun
ction responseFactory = null]); | 888 dynamic onReceivedWebSocketRequest(http_message_mojom.HttpRequest request,[Fun
ction responseFactory = null]); |
844 } | 889 } |
845 | 890 |
846 | 891 |
847 class _HttpConnectionDelegateProxyImpl extends bindings.Proxy { | 892 class _HttpConnectionDelegateProxyImpl extends bindings.Proxy { |
848 _HttpConnectionDelegateProxyImpl.fromEndpoint( | 893 _HttpConnectionDelegateProxyImpl.fromEndpoint( |
849 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 894 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
850 | 895 |
851 _HttpConnectionDelegateProxyImpl.fromHandle(core.MojoHandle handle) : | 896 _HttpConnectionDelegateProxyImpl.fromHandle(core.MojoHandle handle) : |
852 super.fromHandle(handle); | 897 super.fromHandle(handle); |
853 | 898 |
854 _HttpConnectionDelegateProxyImpl.unbound() : super.unbound(); | 899 _HttpConnectionDelegateProxyImpl.unbound() : super.unbound(); |
855 | 900 |
856 static _HttpConnectionDelegateProxyImpl newFromEndpoint( | 901 static _HttpConnectionDelegateProxyImpl newFromEndpoint( |
857 core.MojoMessagePipeEndpoint endpoint) { | 902 core.MojoMessagePipeEndpoint endpoint) { |
858 assert(endpoint.setDescription("For _HttpConnectionDelegateProxyImpl")); | 903 assert(endpoint.setDescription("For _HttpConnectionDelegateProxyImpl")); |
859 return new _HttpConnectionDelegateProxyImpl.fromEndpoint(endpoint); | 904 return new _HttpConnectionDelegateProxyImpl.fromEndpoint(endpoint); |
860 } | 905 } |
861 | 906 |
| 907 service_describer.ServiceDescription get serviceDescription => |
| 908 new _HttpConnectionDelegateServiceDescription(); |
| 909 |
862 void handleResponse(bindings.ServiceMessage message) { | 910 void handleResponse(bindings.ServiceMessage message) { |
863 switch (message.header.type) { | 911 switch (message.header.type) { |
864 case _HttpConnectionDelegate_onReceivedRequestName: | 912 case _HttpConnectionDelegate_onReceivedRequestName: |
865 var r = HttpConnectionDelegateOnReceivedRequestResponseParams.deserializ
e( | 913 var r = HttpConnectionDelegateOnReceivedRequestResponseParams.deserializ
e( |
866 message.payload); | 914 message.payload); |
867 if (!message.header.hasRequestId) { | 915 if (!message.header.hasRequestId) { |
868 proxyError("Expected a message with a valid request Id."); | 916 proxyError("Expected a message with a valid request Id."); |
869 return; | 917 return; |
870 } | 918 } |
871 Completer c = completerMap[message.header.requestId]; | 919 Completer c = completerMap[message.header.requestId]; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 assert(_impl == null); | 1143 assert(_impl == null); |
1096 _impl = d; | 1144 _impl = d; |
1097 } | 1145 } |
1098 | 1146 |
1099 String toString() { | 1147 String toString() { |
1100 var superString = super.toString(); | 1148 var superString = super.toString(); |
1101 return "HttpConnectionDelegateStub($superString)"; | 1149 return "HttpConnectionDelegateStub($superString)"; |
1102 } | 1150 } |
1103 | 1151 |
1104 int get version => 0; | 1152 int get version => 0; |
| 1153 |
| 1154 service_describer.ServiceDescription get serviceDescription => |
| 1155 new _HttpConnectionDelegateServiceDescription(); |
1105 } | 1156 } |
1106 | 1157 |
1107 | 1158 |
| 1159 |
OLD | NEW |