Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/url_loader_interceptor.mojom.dart

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // WARNING: DO NOT EDIT. This file was generated by a program. 1 // WARNING: DO NOT EDIT. This file was generated by a program.
2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py.
3 3
4 library url_loader_interceptor_mojom; 4 library url_loader_interceptor_mojom;
5 import 'dart:async'; 5 import 'dart:async';
6 import 'package:mojo/bindings.dart' as bindings; 6 import 'package:mojo/bindings.dart' as bindings;
7 import 'package:mojo/core.dart' as core; 7 import 'package:mojo/core.dart' as core;
8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
9 import 'package:mojo/mojo/url_request.mojom.dart' as url_request_mojom; 9 import 'package:mojo/mojo/url_request.mojom.dart' as url_request_mojom;
10 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; 10 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom;
11 11
12 12
13 13
14 class UrlLoaderInterceptorResponse extends bindings.Struct { 14 class UrlLoaderInterceptorResponse extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 15 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(24, 0) 16 const bindings.StructDataHeader(24, 0)
17 ]; 17 ];
18 url_request_mojom.UrlRequest request = null; 18 url_request_mojom.UrlRequest request = null;
19 url_response_mojom.UrlResponse response = null; 19 url_response_mojom.UrlResponse response = null;
20 20
21 UrlLoaderInterceptorResponse() : super(kVersions.last.size); 21 UrlLoaderInterceptorResponse() : super(kVersions.last.size);
22 22
23 UrlLoaderInterceptorResponse.init(
24 url_request_mojom.UrlRequest this.request,
25 url_response_mojom.UrlResponse this.response
26 ) : super(kVersions.last.size);
27
23 static UrlLoaderInterceptorResponse deserialize(bindings.Message message) { 28 static UrlLoaderInterceptorResponse deserialize(bindings.Message message) {
24 var decoder = new bindings.Decoder(message); 29 var decoder = new bindings.Decoder(message);
25 var result = decode(decoder); 30 var result = decode(decoder);
26 if (decoder.excessHandles != null) { 31 if (decoder.excessHandles != null) {
27 decoder.excessHandles.forEach((h) => h.close()); 32 decoder.excessHandles.forEach((h) => h.close());
28 } 33 }
29 return result; 34 return result;
30 } 35 }
31 36
32 static UrlLoaderInterceptorResponse decode(bindings.Decoder decoder0) { 37 static UrlLoaderInterceptorResponse decode(bindings.Decoder decoder0) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 103
99 104
100 class _UrlLoaderInterceptorFactoryCreateParams extends bindings.Struct { 105 class _UrlLoaderInterceptorFactoryCreateParams extends bindings.Struct {
101 static const List<bindings.StructDataHeader> kVersions = const [ 106 static const List<bindings.StructDataHeader> kVersions = const [
102 const bindings.StructDataHeader(16, 0) 107 const bindings.StructDataHeader(16, 0)
103 ]; 108 ];
104 UrlLoaderInterceptorInterfaceRequest interceptor = null; 109 UrlLoaderInterceptorInterfaceRequest interceptor = null;
105 110
106 _UrlLoaderInterceptorFactoryCreateParams() : super(kVersions.last.size); 111 _UrlLoaderInterceptorFactoryCreateParams() : super(kVersions.last.size);
107 112
113 _UrlLoaderInterceptorFactoryCreateParams.init(
114 UrlLoaderInterceptorInterfaceRequest this.interceptor
115 ) : super(kVersions.last.size);
116
108 static _UrlLoaderInterceptorFactoryCreateParams deserialize(bindings.Message m essage) { 117 static _UrlLoaderInterceptorFactoryCreateParams deserialize(bindings.Message m essage) {
109 var decoder = new bindings.Decoder(message); 118 var decoder = new bindings.Decoder(message);
110 var result = decode(decoder); 119 var result = decode(decoder);
111 if (decoder.excessHandles != null) { 120 if (decoder.excessHandles != null) {
112 decoder.excessHandles.forEach((h) => h.close()); 121 decoder.excessHandles.forEach((h) => h.close());
113 } 122 }
114 return result; 123 return result;
115 } 124 }
116 125
117 static _UrlLoaderInterceptorFactoryCreateParams decode(bindings.Decoder decode r0) { 126 static _UrlLoaderInterceptorFactoryCreateParams decode(bindings.Decoder decode r0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 178
170 179
171 class _UrlLoaderInterceptorInterceptRequestParams extends bindings.Struct { 180 class _UrlLoaderInterceptorInterceptRequestParams extends bindings.Struct {
172 static const List<bindings.StructDataHeader> kVersions = const [ 181 static const List<bindings.StructDataHeader> kVersions = const [
173 const bindings.StructDataHeader(16, 0) 182 const bindings.StructDataHeader(16, 0)
174 ]; 183 ];
175 url_request_mojom.UrlRequest request = null; 184 url_request_mojom.UrlRequest request = null;
176 185
177 _UrlLoaderInterceptorInterceptRequestParams() : super(kVersions.last.size); 186 _UrlLoaderInterceptorInterceptRequestParams() : super(kVersions.last.size);
178 187
188 _UrlLoaderInterceptorInterceptRequestParams.init(
189 url_request_mojom.UrlRequest this.request
190 ) : super(kVersions.last.size);
191
179 static _UrlLoaderInterceptorInterceptRequestParams deserialize(bindings.Messag e message) { 192 static _UrlLoaderInterceptorInterceptRequestParams deserialize(bindings.Messag e message) {
180 var decoder = new bindings.Decoder(message); 193 var decoder = new bindings.Decoder(message);
181 var result = decode(decoder); 194 var result = decode(decoder);
182 if (decoder.excessHandles != null) { 195 if (decoder.excessHandles != null) {
183 decoder.excessHandles.forEach((h) => h.close()); 196 decoder.excessHandles.forEach((h) => h.close());
184 } 197 }
185 return result; 198 return result;
186 } 199 }
187 200
188 static _UrlLoaderInterceptorInterceptRequestParams decode(bindings.Decoder dec oder0) { 201 static _UrlLoaderInterceptorInterceptRequestParams decode(bindings.Decoder dec oder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 254
242 255
243 class UrlLoaderInterceptorInterceptRequestResponseParams extends bindings.Struct { 256 class UrlLoaderInterceptorInterceptRequestResponseParams extends bindings.Struct {
244 static const List<bindings.StructDataHeader> kVersions = const [ 257 static const List<bindings.StructDataHeader> kVersions = const [
245 const bindings.StructDataHeader(16, 0) 258 const bindings.StructDataHeader(16, 0)
246 ]; 259 ];
247 UrlLoaderInterceptorResponse response = null; 260 UrlLoaderInterceptorResponse response = null;
248 261
249 UrlLoaderInterceptorInterceptRequestResponseParams() : super(kVersions.last.si ze); 262 UrlLoaderInterceptorInterceptRequestResponseParams() : super(kVersions.last.si ze);
250 263
264 UrlLoaderInterceptorInterceptRequestResponseParams.init(
265 UrlLoaderInterceptorResponse this.response
266 ) : super(kVersions.last.size);
267
251 static UrlLoaderInterceptorInterceptRequestResponseParams deserialize(bindings .Message message) { 268 static UrlLoaderInterceptorInterceptRequestResponseParams deserialize(bindings .Message message) {
252 var decoder = new bindings.Decoder(message); 269 var decoder = new bindings.Decoder(message);
253 var result = decode(decoder); 270 var result = decode(decoder);
254 if (decoder.excessHandles != null) { 271 if (decoder.excessHandles != null) {
255 decoder.excessHandles.forEach((h) => h.close()); 272 decoder.excessHandles.forEach((h) => h.close());
256 } 273 }
257 return result; 274 return result;
258 } 275 }
259 276
260 static UrlLoaderInterceptorInterceptRequestResponseParams decode(bindings.Deco der decoder0) { 277 static UrlLoaderInterceptorInterceptRequestResponseParams decode(bindings.Deco der decoder0) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 } 329 }
313 330
314 331
315 class _UrlLoaderInterceptorInterceptFollowRedirectParams extends bindings.Struct { 332 class _UrlLoaderInterceptorInterceptFollowRedirectParams extends bindings.Struct {
316 static const List<bindings.StructDataHeader> kVersions = const [ 333 static const List<bindings.StructDataHeader> kVersions = const [
317 const bindings.StructDataHeader(8, 0) 334 const bindings.StructDataHeader(8, 0)
318 ]; 335 ];
319 336
320 _UrlLoaderInterceptorInterceptFollowRedirectParams() : super(kVersions.last.si ze); 337 _UrlLoaderInterceptorInterceptFollowRedirectParams() : super(kVersions.last.si ze);
321 338
339 _UrlLoaderInterceptorInterceptFollowRedirectParams.init(
340 ) : super(kVersions.last.size);
341
322 static _UrlLoaderInterceptorInterceptFollowRedirectParams deserialize(bindings .Message message) { 342 static _UrlLoaderInterceptorInterceptFollowRedirectParams deserialize(bindings .Message message) {
323 var decoder = new bindings.Decoder(message); 343 var decoder = new bindings.Decoder(message);
324 var result = decode(decoder); 344 var result = decode(decoder);
325 if (decoder.excessHandles != null) { 345 if (decoder.excessHandles != null) {
326 decoder.excessHandles.forEach((h) => h.close()); 346 decoder.excessHandles.forEach((h) => h.close());
327 } 347 }
328 return result; 348 return result;
329 } 349 }
330 350
331 static _UrlLoaderInterceptorInterceptFollowRedirectParams decode(bindings.Deco der decoder0) { 351 static _UrlLoaderInterceptorInterceptFollowRedirectParams decode(bindings.Deco der decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 391
372 392
373 class UrlLoaderInterceptorInterceptFollowRedirectResponseParams extends bindings .Struct { 393 class UrlLoaderInterceptorInterceptFollowRedirectResponseParams extends bindings .Struct {
374 static const List<bindings.StructDataHeader> kVersions = const [ 394 static const List<bindings.StructDataHeader> kVersions = const [
375 const bindings.StructDataHeader(16, 0) 395 const bindings.StructDataHeader(16, 0)
376 ]; 396 ];
377 UrlLoaderInterceptorResponse response = null; 397 UrlLoaderInterceptorResponse response = null;
378 398
379 UrlLoaderInterceptorInterceptFollowRedirectResponseParams() : super(kVersions. last.size); 399 UrlLoaderInterceptorInterceptFollowRedirectResponseParams() : super(kVersions. last.size);
380 400
401 UrlLoaderInterceptorInterceptFollowRedirectResponseParams.init(
402 UrlLoaderInterceptorResponse this.response
403 ) : super(kVersions.last.size);
404
381 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams deserialize(b indings.Message message) { 405 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams deserialize(b indings.Message message) {
382 var decoder = new bindings.Decoder(message); 406 var decoder = new bindings.Decoder(message);
383 var result = decode(decoder); 407 var result = decode(decoder);
384 if (decoder.excessHandles != null) { 408 if (decoder.excessHandles != null) {
385 decoder.excessHandles.forEach((h) => h.close()); 409 decoder.excessHandles.forEach((h) => h.close());
386 } 410 }
387 return result; 411 return result;
388 } 412 }
389 413
390 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams decode(bindin gs.Decoder decoder0) { 414 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams decode(bindin gs.Decoder decoder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 467
444 468
445 class _UrlLoaderInterceptorInterceptResponseParams extends bindings.Struct { 469 class _UrlLoaderInterceptorInterceptResponseParams extends bindings.Struct {
446 static const List<bindings.StructDataHeader> kVersions = const [ 470 static const List<bindings.StructDataHeader> kVersions = const [
447 const bindings.StructDataHeader(16, 0) 471 const bindings.StructDataHeader(16, 0)
448 ]; 472 ];
449 url_response_mojom.UrlResponse response = null; 473 url_response_mojom.UrlResponse response = null;
450 474
451 _UrlLoaderInterceptorInterceptResponseParams() : super(kVersions.last.size); 475 _UrlLoaderInterceptorInterceptResponseParams() : super(kVersions.last.size);
452 476
477 _UrlLoaderInterceptorInterceptResponseParams.init(
478 url_response_mojom.UrlResponse this.response
479 ) : super(kVersions.last.size);
480
453 static _UrlLoaderInterceptorInterceptResponseParams deserialize(bindings.Messa ge message) { 481 static _UrlLoaderInterceptorInterceptResponseParams deserialize(bindings.Messa ge message) {
454 var decoder = new bindings.Decoder(message); 482 var decoder = new bindings.Decoder(message);
455 var result = decode(decoder); 483 var result = decode(decoder);
456 if (decoder.excessHandles != null) { 484 if (decoder.excessHandles != null) {
457 decoder.excessHandles.forEach((h) => h.close()); 485 decoder.excessHandles.forEach((h) => h.close());
458 } 486 }
459 return result; 487 return result;
460 } 488 }
461 489
462 static _UrlLoaderInterceptorInterceptResponseParams decode(bindings.Decoder de coder0) { 490 static _UrlLoaderInterceptorInterceptResponseParams decode(bindings.Decoder de coder0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 543
516 544
517 class UrlLoaderInterceptorInterceptResponseResponseParams extends bindings.Struc t { 545 class UrlLoaderInterceptorInterceptResponseResponseParams extends bindings.Struc t {
518 static const List<bindings.StructDataHeader> kVersions = const [ 546 static const List<bindings.StructDataHeader> kVersions = const [
519 const bindings.StructDataHeader(16, 0) 547 const bindings.StructDataHeader(16, 0)
520 ]; 548 ];
521 UrlLoaderInterceptorResponse response = null; 549 UrlLoaderInterceptorResponse response = null;
522 550
523 UrlLoaderInterceptorInterceptResponseResponseParams() : super(kVersions.last.s ize); 551 UrlLoaderInterceptorInterceptResponseResponseParams() : super(kVersions.last.s ize);
524 552
553 UrlLoaderInterceptorInterceptResponseResponseParams.init(
554 UrlLoaderInterceptorResponse this.response
555 ) : super(kVersions.last.size);
556
525 static UrlLoaderInterceptorInterceptResponseResponseParams deserialize(binding s.Message message) { 557 static UrlLoaderInterceptorInterceptResponseResponseParams deserialize(binding s.Message message) {
526 var decoder = new bindings.Decoder(message); 558 var decoder = new bindings.Decoder(message);
527 var result = decode(decoder); 559 var result = decode(decoder);
528 if (decoder.excessHandles != null) { 560 if (decoder.excessHandles != null) {
529 decoder.excessHandles.forEach((h) => h.close()); 561 decoder.excessHandles.forEach((h) => h.close());
530 } 562 }
531 return result; 563 return result;
532 } 564 }
533 565
534 static UrlLoaderInterceptorInterceptResponseResponseParams decode(bindings.Dec oder decoder0) { 566 static UrlLoaderInterceptorInterceptResponseResponseParams decode(bindings.Dec oder decoder0) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 613
582 Map toJson() { 614 Map toJson() {
583 throw new bindings.MojoCodecError( 615 throw new bindings.MojoCodecError(
584 'Object containing handles cannot be encoded to JSON.'); 616 'Object containing handles cannot be encoded to JSON.');
585 } 617 }
586 } 618 }
587 619
588 const int _urlLoaderInterceptorFactoryMethodCreateName = 0; 620 const int _urlLoaderInterceptorFactoryMethodCreateName = 0;
589 621
590 class _UrlLoaderInterceptorFactoryServiceDescription implements service_describe r.ServiceDescription { 622 class _UrlLoaderInterceptorFactoryServiceDescription implements service_describe r.ServiceDescription {
591 dynamic getTopLevelInterface([Function responseFactory]) => 623 void getTopLevelInterface(Function responder) {
592 responseFactory(null); 624 responder(null);
625 }
593 626
594 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 627 void getTypeDefinition(String typeKey, Function responder) {
595 responseFactory(null); 628 responder(null);
629 }
596 630
597 dynamic getAllTypeDefinitions([Function responseFactory]) => 631 void getAllTypeDefinitions(Function responder) {
598 responseFactory(null); 632 responder(null);
633 }
599 } 634 }
600 635
601 abstract class UrlLoaderInterceptorFactory { 636 abstract class UrlLoaderInterceptorFactory {
602 static const String serviceName = null; 637 static const String serviceName = null;
603 638
604 static service_describer.ServiceDescription _cachedServiceDescription; 639 static service_describer.ServiceDescription _cachedServiceDescription;
605 static service_describer.ServiceDescription get serviceDescription { 640 static service_describer.ServiceDescription get serviceDescription {
606 if (_cachedServiceDescription == null) { 641 if (_cachedServiceDescription == null) {
607 _cachedServiceDescription = new _UrlLoaderInterceptorFactoryServiceDescrip tion(); 642 _cachedServiceDescription = new _UrlLoaderInterceptorFactoryServiceDescrip tion();
608 } 643 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 : super.fromHandle(handle, autoBegin: impl != null) { 773 : super.fromHandle(handle, autoBegin: impl != null) {
739 _impl = impl; 774 _impl = impl;
740 } 775 }
741 776
742 _UrlLoaderInterceptorFactoryStubControl.unbound([this._impl]) : super.unbound( ); 777 _UrlLoaderInterceptorFactoryStubControl.unbound([this._impl]) : super.unbound( );
743 778
744 String get serviceName => UrlLoaderInterceptorFactory.serviceName; 779 String get serviceName => UrlLoaderInterceptorFactory.serviceName;
745 780
746 781
747 782
748 dynamic handleMessage(bindings.ServiceMessage message) { 783 void handleMessage(bindings.ServiceMessage message) {
749 if (bindings.ControlMessageHandler.isControlMessage(message)) { 784 if (bindings.ControlMessageHandler.isControlMessage(message)) {
750 return bindings.ControlMessageHandler.handleMessage(this, 785 bindings.ControlMessageHandler.handleMessage(
751 0, 786 this, 0, message);
752 message); 787 return;
753 } 788 }
754 if (_impl == null) { 789 if (_impl == null) {
755 throw new core.MojoApiError("$this has no implementation set"); 790 throw new core.MojoApiError("$this has no implementation set");
756 } 791 }
757 switch (message.header.type) { 792 switch (message.header.type) {
758 case _urlLoaderInterceptorFactoryMethodCreateName: 793 case _urlLoaderInterceptorFactoryMethodCreateName:
759 var params = _UrlLoaderInterceptorFactoryCreateParams.deserialize( 794 var params = _UrlLoaderInterceptorFactoryCreateParams.deserialize(
760 message.payload); 795 message.payload);
761 _impl.create(params.interceptor); 796 _impl.create(params.interceptor);
762 break; 797 break;
763 default: 798 default:
764 throw new bindings.MojoCodecError("Unexpected message name"); 799 throw new bindings.MojoCodecError("Unexpected message name");
765 break; 800 break;
766 } 801 }
767 return null;
768 } 802 }
769 803
770 UrlLoaderInterceptorFactory get impl => _impl; 804 UrlLoaderInterceptorFactory get impl => _impl;
771 set impl(UrlLoaderInterceptorFactory d) { 805 set impl(UrlLoaderInterceptorFactory d) {
772 if (d == null) { 806 if (d == null) {
773 throw new core.MojoApiError("$this: Cannot set a null implementation"); 807 throw new core.MojoApiError("$this: Cannot set a null implementation");
774 } 808 }
775 if (isBound && (_impl == null)) { 809 if (isBound && (_impl == null)) {
776 beginHandlingEvents(); 810 beginHandlingEvents();
777 } 811 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 void create(UrlLoaderInterceptorInterfaceRequest interceptor) { 855 void create(UrlLoaderInterceptorInterfaceRequest interceptor) {
822 return impl.create(interceptor); 856 return impl.create(interceptor);
823 } 857 }
824 } 858 }
825 859
826 const int _urlLoaderInterceptorMethodInterceptRequestName = 0; 860 const int _urlLoaderInterceptorMethodInterceptRequestName = 0;
827 const int _urlLoaderInterceptorMethodInterceptFollowRedirectName = 1; 861 const int _urlLoaderInterceptorMethodInterceptFollowRedirectName = 1;
828 const int _urlLoaderInterceptorMethodInterceptResponseName = 2; 862 const int _urlLoaderInterceptorMethodInterceptResponseName = 2;
829 863
830 class _UrlLoaderInterceptorServiceDescription implements service_describer.Servi ceDescription { 864 class _UrlLoaderInterceptorServiceDescription implements service_describer.Servi ceDescription {
831 dynamic getTopLevelInterface([Function responseFactory]) => 865 void getTopLevelInterface(Function responder) {
832 responseFactory(null); 866 responder(null);
867 }
833 868
834 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 869 void getTypeDefinition(String typeKey, Function responder) {
835 responseFactory(null); 870 responder(null);
871 }
836 872
837 dynamic getAllTypeDefinitions([Function responseFactory]) => 873 void getAllTypeDefinitions(Function responder) {
838 responseFactory(null); 874 responder(null);
875 }
839 } 876 }
840 877
841 abstract class UrlLoaderInterceptor { 878 abstract class UrlLoaderInterceptor {
842 static const String serviceName = null; 879 static const String serviceName = null;
843 880
844 static service_describer.ServiceDescription _cachedServiceDescription; 881 static service_describer.ServiceDescription _cachedServiceDescription;
845 static service_describer.ServiceDescription get serviceDescription { 882 static service_describer.ServiceDescription get serviceDescription {
846 if (_cachedServiceDescription == null) { 883 if (_cachedServiceDescription == null) {
847 _cachedServiceDescription = new _UrlLoaderInterceptorServiceDescription(); 884 _cachedServiceDescription = new _UrlLoaderInterceptorServiceDescription();
848 } 885 }
849 return _cachedServiceDescription; 886 return _cachedServiceDescription;
850 } 887 }
851 888
852 static UrlLoaderInterceptorProxy connectToService( 889 static UrlLoaderInterceptorProxy connectToService(
853 bindings.ServiceConnector s, String url, [String serviceName]) { 890 bindings.ServiceConnector s, String url, [String serviceName]) {
854 UrlLoaderInterceptorProxy p = new UrlLoaderInterceptorProxy.unbound(); 891 UrlLoaderInterceptorProxy p = new UrlLoaderInterceptorProxy.unbound();
855 String name = serviceName ?? UrlLoaderInterceptor.serviceName; 892 String name = serviceName ?? UrlLoaderInterceptor.serviceName;
856 if ((name == null) || name.isEmpty) { 893 if ((name == null) || name.isEmpty) {
857 throw new core.MojoApiError( 894 throw new core.MojoApiError(
858 "If an interface has no ServiceName, then one must be provided."); 895 "If an interface has no ServiceName, then one must be provided.");
859 } 896 }
860 s.connectToService(url, p, name); 897 s.connectToService(url, p, name);
861 return p; 898 return p;
862 } 899 }
863 dynamic interceptRequest(url_request_mojom.UrlRequest request,[Function respon seFactory = null]); 900 void interceptRequest(url_request_mojom.UrlRequest request,void callback(UrlLo aderInterceptorResponse response));
864 dynamic interceptFollowRedirect([Function responseFactory = null]); 901 void interceptFollowRedirect(void callback(UrlLoaderInterceptorResponse respon se));
865 dynamic interceptResponse(url_response_mojom.UrlResponse response,[Function re sponseFactory = null]); 902 void interceptResponse(url_response_mojom.UrlResponse response,void callback(U rlLoaderInterceptorResponse response));
866 } 903 }
867 904
868 abstract class UrlLoaderInterceptorInterface 905 abstract class UrlLoaderInterceptorInterface
869 implements bindings.MojoInterface<UrlLoaderInterceptor>, 906 implements bindings.MojoInterface<UrlLoaderInterceptor>,
870 UrlLoaderInterceptor { 907 UrlLoaderInterceptor {
871 factory UrlLoaderInterceptorInterface([UrlLoaderInterceptor impl]) => 908 factory UrlLoaderInterceptorInterface([UrlLoaderInterceptor impl]) =>
872 new UrlLoaderInterceptorStub.unbound(impl); 909 new UrlLoaderInterceptorStub.unbound(impl);
873 910
874 factory UrlLoaderInterceptorInterface.fromEndpoint( 911 factory UrlLoaderInterceptorInterface.fromEndpoint(
875 core.MojoMessagePipeEndpoint endpoint, 912 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
905 942
906 void handleResponse(bindings.ServiceMessage message) { 943 void handleResponse(bindings.ServiceMessage message) {
907 switch (message.header.type) { 944 switch (message.header.type) {
908 case _urlLoaderInterceptorMethodInterceptRequestName: 945 case _urlLoaderInterceptorMethodInterceptRequestName:
909 var r = UrlLoaderInterceptorInterceptRequestResponseParams.deserialize( 946 var r = UrlLoaderInterceptorInterceptRequestResponseParams.deserialize(
910 message.payload); 947 message.payload);
911 if (!message.header.hasRequestId) { 948 if (!message.header.hasRequestId) {
912 proxyError("Expected a message with a valid request Id."); 949 proxyError("Expected a message with a valid request Id.");
913 return; 950 return;
914 } 951 }
915 Completer c = completerMap[message.header.requestId]; 952 Function callback = callbackMap[message.header.requestId];
916 if (c == null) { 953 if (callback == null) {
917 proxyError( 954 proxyError(
918 "Message had unknown request Id: ${message.header.requestId}"); 955 "Message had unknown request Id: ${message.header.requestId}");
919 return; 956 return;
920 } 957 }
921 completerMap.remove(message.header.requestId); 958 callbackMap.remove(message.header.requestId);
922 if (c.isCompleted) { 959 callback(r.response );
923 proxyError("Response completer already completed");
924 return;
925 }
926 c.complete(r);
927 break; 960 break;
928 case _urlLoaderInterceptorMethodInterceptFollowRedirectName: 961 case _urlLoaderInterceptorMethodInterceptFollowRedirectName:
929 var r = UrlLoaderInterceptorInterceptFollowRedirectResponseParams.deseri alize( 962 var r = UrlLoaderInterceptorInterceptFollowRedirectResponseParams.deseri alize(
930 message.payload); 963 message.payload);
931 if (!message.header.hasRequestId) { 964 if (!message.header.hasRequestId) {
932 proxyError("Expected a message with a valid request Id."); 965 proxyError("Expected a message with a valid request Id.");
933 return; 966 return;
934 } 967 }
935 Completer c = completerMap[message.header.requestId]; 968 Function callback = callbackMap[message.header.requestId];
936 if (c == null) { 969 if (callback == null) {
937 proxyError( 970 proxyError(
938 "Message had unknown request Id: ${message.header.requestId}"); 971 "Message had unknown request Id: ${message.header.requestId}");
939 return; 972 return;
940 } 973 }
941 completerMap.remove(message.header.requestId); 974 callbackMap.remove(message.header.requestId);
942 if (c.isCompleted) { 975 callback(r.response );
943 proxyError("Response completer already completed");
944 return;
945 }
946 c.complete(r);
947 break; 976 break;
948 case _urlLoaderInterceptorMethodInterceptResponseName: 977 case _urlLoaderInterceptorMethodInterceptResponseName:
949 var r = UrlLoaderInterceptorInterceptResponseResponseParams.deserialize( 978 var r = UrlLoaderInterceptorInterceptResponseResponseParams.deserialize(
950 message.payload); 979 message.payload);
951 if (!message.header.hasRequestId) { 980 if (!message.header.hasRequestId) {
952 proxyError("Expected a message with a valid request Id."); 981 proxyError("Expected a message with a valid request Id.");
953 return; 982 return;
954 } 983 }
955 Completer c = completerMap[message.header.requestId]; 984 Function callback = callbackMap[message.header.requestId];
956 if (c == null) { 985 if (callback == null) {
957 proxyError( 986 proxyError(
958 "Message had unknown request Id: ${message.header.requestId}"); 987 "Message had unknown request Id: ${message.header.requestId}");
959 return; 988 return;
960 } 989 }
961 completerMap.remove(message.header.requestId); 990 callbackMap.remove(message.header.requestId);
962 if (c.isCompleted) { 991 callback(r.response );
963 proxyError("Response completer already completed");
964 return;
965 }
966 c.complete(r);
967 break; 992 break;
968 default: 993 default:
969 proxyError("Unexpected message type: ${message.header.type}"); 994 proxyError("Unexpected message type: ${message.header.type}");
970 close(immediate: true); 995 close(immediate: true);
971 break; 996 break;
972 } 997 }
973 } 998 }
974 999
975 @override 1000 @override
976 String toString() { 1001 String toString() {
(...skipping 24 matching lines...) Expand all
1001 return newMockedProxy; 1026 return newMockedProxy;
1002 } 1027 }
1003 1028
1004 static UrlLoaderInterceptorProxy newFromEndpoint( 1029 static UrlLoaderInterceptorProxy newFromEndpoint(
1005 core.MojoMessagePipeEndpoint endpoint) { 1030 core.MojoMessagePipeEndpoint endpoint) {
1006 assert(endpoint.setDescription("For UrlLoaderInterceptorProxy")); 1031 assert(endpoint.setDescription("For UrlLoaderInterceptorProxy"));
1007 return new UrlLoaderInterceptorProxy.fromEndpoint(endpoint); 1032 return new UrlLoaderInterceptorProxy.fromEndpoint(endpoint);
1008 } 1033 }
1009 1034
1010 1035
1011 dynamic interceptRequest(url_request_mojom.UrlRequest request,[Function respon seFactory = null]) { 1036 void interceptRequest(url_request_mojom.UrlRequest request,void callback(UrlLo aderInterceptorResponse response)) {
1012 if (impl != null) { 1037 if (impl != null) {
1013 return new Future(() => impl.interceptRequest(request,_UrlLoaderIntercepto rStubControl._urlLoaderInterceptorInterceptRequestResponseParamsFactory)); 1038 impl.interceptRequest(request,callback);
1039 return;
1014 } 1040 }
1015 var params = new _UrlLoaderInterceptorInterceptRequestParams(); 1041 var params = new _UrlLoaderInterceptorInterceptRequestParams();
1016 params.request = request; 1042 params.request = request;
1017 return ctrl.sendMessageWithRequestId( 1043 ctrl.sendMessageWithRequestId(
1018 params, 1044 params,
1019 _urlLoaderInterceptorMethodInterceptRequestName, 1045 _urlLoaderInterceptorMethodInterceptRequestName,
1020 -1, 1046 -1,
1021 bindings.MessageHeader.kMessageExpectsResponse); 1047 bindings.MessageHeader.kMessageExpectsResponse,
1048 callback);
1022 } 1049 }
1023 dynamic interceptFollowRedirect([Function responseFactory = null]) { 1050 void interceptFollowRedirect(void callback(UrlLoaderInterceptorResponse respon se)) {
1024 if (impl != null) { 1051 if (impl != null) {
1025 return new Future(() => impl.interceptFollowRedirect(_UrlLoaderInterceptor StubControl._urlLoaderInterceptorInterceptFollowRedirectResponseParamsFactory)); 1052 impl.interceptFollowRedirect(callback);
1053 return;
1026 } 1054 }
1027 var params = new _UrlLoaderInterceptorInterceptFollowRedirectParams(); 1055 var params = new _UrlLoaderInterceptorInterceptFollowRedirectParams();
1028 return ctrl.sendMessageWithRequestId( 1056 ctrl.sendMessageWithRequestId(
1029 params, 1057 params,
1030 _urlLoaderInterceptorMethodInterceptFollowRedirectName, 1058 _urlLoaderInterceptorMethodInterceptFollowRedirectName,
1031 -1, 1059 -1,
1032 bindings.MessageHeader.kMessageExpectsResponse); 1060 bindings.MessageHeader.kMessageExpectsResponse,
1061 callback);
1033 } 1062 }
1034 dynamic interceptResponse(url_response_mojom.UrlResponse response,[Function re sponseFactory = null]) { 1063 void interceptResponse(url_response_mojom.UrlResponse response,void callback(U rlLoaderInterceptorResponse response)) {
1035 if (impl != null) { 1064 if (impl != null) {
1036 return new Future(() => impl.interceptResponse(response,_UrlLoaderIntercep torStubControl._urlLoaderInterceptorInterceptResponseResponseParamsFactory)); 1065 impl.interceptResponse(response,callback);
1066 return;
1037 } 1067 }
1038 var params = new _UrlLoaderInterceptorInterceptResponseParams(); 1068 var params = new _UrlLoaderInterceptorInterceptResponseParams();
1039 params.response = response; 1069 params.response = response;
1040 return ctrl.sendMessageWithRequestId( 1070 ctrl.sendMessageWithRequestId(
1041 params, 1071 params,
1042 _urlLoaderInterceptorMethodInterceptResponseName, 1072 _urlLoaderInterceptorMethodInterceptResponseName,
1043 -1, 1073 -1,
1044 bindings.MessageHeader.kMessageExpectsResponse); 1074 bindings.MessageHeader.kMessageExpectsResponse,
1075 callback);
1045 } 1076 }
1046 } 1077 }
1047 1078
1048 class _UrlLoaderInterceptorStubControl 1079 class _UrlLoaderInterceptorStubControl
1049 extends bindings.StubMessageHandler 1080 extends bindings.StubMessageHandler
1050 implements bindings.StubControl<UrlLoaderInterceptor> { 1081 implements bindings.StubControl<UrlLoaderInterceptor> {
1051 UrlLoaderInterceptor _impl; 1082 UrlLoaderInterceptor _impl;
1052 1083
1053 _UrlLoaderInterceptorStubControl.fromEndpoint( 1084 _UrlLoaderInterceptorStubControl.fromEndpoint(
1054 core.MojoMessagePipeEndpoint endpoint, [UrlLoaderInterceptor impl]) 1085 core.MojoMessagePipeEndpoint endpoint, [UrlLoaderInterceptor impl])
1055 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1086 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1056 _impl = impl; 1087 _impl = impl;
1057 } 1088 }
1058 1089
1059 _UrlLoaderInterceptorStubControl.fromHandle( 1090 _UrlLoaderInterceptorStubControl.fromHandle(
1060 core.MojoHandle handle, [UrlLoaderInterceptor impl]) 1091 core.MojoHandle handle, [UrlLoaderInterceptor impl])
1061 : super.fromHandle(handle, autoBegin: impl != null) { 1092 : super.fromHandle(handle, autoBegin: impl != null) {
1062 _impl = impl; 1093 _impl = impl;
1063 } 1094 }
1064 1095
1065 _UrlLoaderInterceptorStubControl.unbound([this._impl]) : super.unbound(); 1096 _UrlLoaderInterceptorStubControl.unbound([this._impl]) : super.unbound();
1066 1097
1067 String get serviceName => UrlLoaderInterceptor.serviceName; 1098 String get serviceName => UrlLoaderInterceptor.serviceName;
1068 1099
1069 1100
1070 static UrlLoaderInterceptorInterceptRequestResponseParams _urlLoaderIntercepto rInterceptRequestResponseParamsFactory(UrlLoaderInterceptorResponse response) { 1101 Function _urlLoaderInterceptorInterceptRequestResponseParamsResponder(
1071 var result = new UrlLoaderInterceptorInterceptRequestResponseParams(); 1102 int requestId) {
1072 result.response = response; 1103 return (UrlLoaderInterceptorResponse response) {
1073 return result; 1104 var result = new UrlLoaderInterceptorInterceptRequestResponseParams();
1105 result.response = response;
1106 sendResponse(buildResponseWithId(
1107 result,
1108 _urlLoaderInterceptorMethodInterceptRequestName,
1109 requestId,
1110 bindings.MessageHeader.kMessageIsResponse));
1111 };
1074 } 1112 }
1075 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams _urlLoaderInt erceptorInterceptFollowRedirectResponseParamsFactory(UrlLoaderInterceptorRespons e response) { 1113 Function _urlLoaderInterceptorInterceptFollowRedirectResponseParamsResponder(
1076 var result = new UrlLoaderInterceptorInterceptFollowRedirectResponseParams() ; 1114 int requestId) {
1077 result.response = response; 1115 return (UrlLoaderInterceptorResponse response) {
1078 return result; 1116 var result = new UrlLoaderInterceptorInterceptFollowRedirectResponseParams ();
1117 result.response = response;
1118 sendResponse(buildResponseWithId(
1119 result,
1120 _urlLoaderInterceptorMethodInterceptFollowRedirectName,
1121 requestId,
1122 bindings.MessageHeader.kMessageIsResponse));
1123 };
1079 } 1124 }
1080 static UrlLoaderInterceptorInterceptResponseResponseParams _urlLoaderIntercept orInterceptResponseResponseParamsFactory(UrlLoaderInterceptorResponse response) { 1125 Function _urlLoaderInterceptorInterceptResponseResponseParamsResponder(
1081 var result = new UrlLoaderInterceptorInterceptResponseResponseParams(); 1126 int requestId) {
1082 result.response = response; 1127 return (UrlLoaderInterceptorResponse response) {
1083 return result; 1128 var result = new UrlLoaderInterceptorInterceptResponseResponseParams();
1129 result.response = response;
1130 sendResponse(buildResponseWithId(
1131 result,
1132 _urlLoaderInterceptorMethodInterceptResponseName,
1133 requestId,
1134 bindings.MessageHeader.kMessageIsResponse));
1135 };
1084 } 1136 }
1085 1137
1086 dynamic handleMessage(bindings.ServiceMessage message) { 1138 void handleMessage(bindings.ServiceMessage message) {
1087 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1139 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1088 return bindings.ControlMessageHandler.handleMessage(this, 1140 bindings.ControlMessageHandler.handleMessage(
1089 0, 1141 this, 0, message);
1090 message); 1142 return;
1091 } 1143 }
1092 if (_impl == null) { 1144 if (_impl == null) {
1093 throw new core.MojoApiError("$this has no implementation set"); 1145 throw new core.MojoApiError("$this has no implementation set");
1094 } 1146 }
1095 switch (message.header.type) { 1147 switch (message.header.type) {
1096 case _urlLoaderInterceptorMethodInterceptRequestName: 1148 case _urlLoaderInterceptorMethodInterceptRequestName:
1097 var params = _UrlLoaderInterceptorInterceptRequestParams.deserialize( 1149 var params = _UrlLoaderInterceptorInterceptRequestParams.deserialize(
1098 message.payload); 1150 message.payload);
1099 var response = _impl.interceptRequest(params.request,_urlLoaderIntercept orInterceptRequestResponseParamsFactory); 1151 _impl.interceptRequest(params.request, _urlLoaderInterceptorInterceptReq uestResponseParamsResponder(message.header.requestId));
1100 if (response is Future) {
1101 return response.then((response) {
1102 if (response != null) {
1103 return buildResponseWithId(
1104 response,
1105 _urlLoaderInterceptorMethodInterceptRequestName,
1106 message.header.requestId,
1107 bindings.MessageHeader.kMessageIsResponse);
1108 }
1109 });
1110 } else if (response != null) {
1111 return buildResponseWithId(
1112 response,
1113 _urlLoaderInterceptorMethodInterceptRequestName,
1114 message.header.requestId,
1115 bindings.MessageHeader.kMessageIsResponse);
1116 }
1117 break; 1152 break;
1118 case _urlLoaderInterceptorMethodInterceptFollowRedirectName: 1153 case _urlLoaderInterceptorMethodInterceptFollowRedirectName:
1119 var response = _impl.interceptFollowRedirect(_urlLoaderInterceptorInterc eptFollowRedirectResponseParamsFactory); 1154 _impl.interceptFollowRedirect(_urlLoaderInterceptorInterceptFollowRedire ctResponseParamsResponder(message.header.requestId));
1120 if (response is Future) {
1121 return response.then((response) {
1122 if (response != null) {
1123 return buildResponseWithId(
1124 response,
1125 _urlLoaderInterceptorMethodInterceptFollowRedirectName,
1126 message.header.requestId,
1127 bindings.MessageHeader.kMessageIsResponse);
1128 }
1129 });
1130 } else if (response != null) {
1131 return buildResponseWithId(
1132 response,
1133 _urlLoaderInterceptorMethodInterceptFollowRedirectName,
1134 message.header.requestId,
1135 bindings.MessageHeader.kMessageIsResponse);
1136 }
1137 break; 1155 break;
1138 case _urlLoaderInterceptorMethodInterceptResponseName: 1156 case _urlLoaderInterceptorMethodInterceptResponseName:
1139 var params = _UrlLoaderInterceptorInterceptResponseParams.deserialize( 1157 var params = _UrlLoaderInterceptorInterceptResponseParams.deserialize(
1140 message.payload); 1158 message.payload);
1141 var response = _impl.interceptResponse(params.response,_urlLoaderInterce ptorInterceptResponseResponseParamsFactory); 1159 _impl.interceptResponse(params.response, _urlLoaderInterceptorInterceptR esponseResponseParamsResponder(message.header.requestId));
1142 if (response is Future) {
1143 return response.then((response) {
1144 if (response != null) {
1145 return buildResponseWithId(
1146 response,
1147 _urlLoaderInterceptorMethodInterceptResponseName,
1148 message.header.requestId,
1149 bindings.MessageHeader.kMessageIsResponse);
1150 }
1151 });
1152 } else if (response != null) {
1153 return buildResponseWithId(
1154 response,
1155 _urlLoaderInterceptorMethodInterceptResponseName,
1156 message.header.requestId,
1157 bindings.MessageHeader.kMessageIsResponse);
1158 }
1159 break; 1160 break;
1160 default: 1161 default:
1161 throw new bindings.MojoCodecError("Unexpected message name"); 1162 throw new bindings.MojoCodecError("Unexpected message name");
1162 break; 1163 break;
1163 } 1164 }
1164 return null;
1165 } 1165 }
1166 1166
1167 UrlLoaderInterceptor get impl => _impl; 1167 UrlLoaderInterceptor get impl => _impl;
1168 set impl(UrlLoaderInterceptor d) { 1168 set impl(UrlLoaderInterceptor d) {
1169 if (d == null) { 1169 if (d == null) {
1170 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1170 throw new core.MojoApiError("$this: Cannot set a null implementation");
1171 } 1171 }
1172 if (isBound && (_impl == null)) { 1172 if (isBound && (_impl == null)) {
1173 beginHandlingEvents(); 1173 beginHandlingEvents();
1174 } 1174 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 core.MojoHandle handle, [UrlLoaderInterceptor impl]) 1208 core.MojoHandle handle, [UrlLoaderInterceptor impl])
1209 : super(new _UrlLoaderInterceptorStubControl.fromHandle(handle, impl)); 1209 : super(new _UrlLoaderInterceptorStubControl.fromHandle(handle, impl));
1210 1210
1211 static UrlLoaderInterceptorStub newFromEndpoint( 1211 static UrlLoaderInterceptorStub newFromEndpoint(
1212 core.MojoMessagePipeEndpoint endpoint) { 1212 core.MojoMessagePipeEndpoint endpoint) {
1213 assert(endpoint.setDescription("For UrlLoaderInterceptorStub")); 1213 assert(endpoint.setDescription("For UrlLoaderInterceptorStub"));
1214 return new UrlLoaderInterceptorStub.fromEndpoint(endpoint); 1214 return new UrlLoaderInterceptorStub.fromEndpoint(endpoint);
1215 } 1215 }
1216 1216
1217 1217
1218 dynamic interceptRequest(url_request_mojom.UrlRequest request,[Function respon seFactory = null]) { 1218 void interceptRequest(url_request_mojom.UrlRequest request,void callback(UrlLo aderInterceptorResponse response)) {
1219 return impl.interceptRequest(request,responseFactory); 1219 return impl.interceptRequest(request,callback);
1220 } 1220 }
1221 dynamic interceptFollowRedirect([Function responseFactory = null]) { 1221 void interceptFollowRedirect(void callback(UrlLoaderInterceptorResponse respon se)) {
1222 return impl.interceptFollowRedirect(responseFactory); 1222 return impl.interceptFollowRedirect(callback);
1223 } 1223 }
1224 dynamic interceptResponse(url_response_mojom.UrlResponse response,[Function re sponseFactory = null]) { 1224 void interceptResponse(url_response_mojom.UrlResponse response,void callback(U rlLoaderInterceptorResponse response)) {
1225 return impl.interceptResponse(response,responseFactory); 1225 return impl.interceptResponse(response,callback);
1226 } 1226 }
1227 } 1227 }
1228 1228
1229 1229
1230 1230
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698