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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 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 // 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 url_loader_interceptor_mojom; 5 library url_loader_interceptor_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/url_request.mojom.dart' as url_request_mojom; 13 import 'package:mojo/mojo/url_request.mojom.dart' as url_request_mojom;
12 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom; 14 import 'package:mojo/mojo/url_response.mojom.dart' as url_response_mojom;
13 15
14 16
15 17
16 class UrlLoaderInterceptorResponse extends bindings.Struct { 18 class UrlLoaderInterceptorResponse extends bindings.Struct {
17 static const List<bindings.StructDataHeader> kVersions = const [ 19 static const List<bindings.StructDataHeader> kVersions = const [
18 const bindings.StructDataHeader(24, 0) 20 const bindings.StructDataHeader(24, 0)
19 ]; 21 ];
20 url_request_mojom.UrlRequest request = null; 22 url_request_mojom.UrlRequest request = null;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 "response: $response" ")"; 84 "response: $response" ")";
83 } 85 }
84 86
85 Map toJson() { 87 Map toJson() {
86 throw new bindings.MojoCodecError( 88 throw new bindings.MojoCodecError(
87 'Object containing handles cannot be encoded to JSON.'); 89 'Object containing handles cannot be encoded to JSON.');
88 } 90 }
89 } 91 }
90 92
91 93
94
95
92 class _UrlLoaderInterceptorFactoryCreateParams extends bindings.Struct { 96 class _UrlLoaderInterceptorFactoryCreateParams extends bindings.Struct {
93 static const List<bindings.StructDataHeader> kVersions = const [ 97 static const List<bindings.StructDataHeader> kVersions = const [
94 const bindings.StructDataHeader(16, 0) 98 const bindings.StructDataHeader(16, 0)
95 ]; 99 ];
96 Object interceptor = null; 100 Object interceptor = null;
97 101
98 _UrlLoaderInterceptorFactoryCreateParams() : super(kVersions.last.size); 102 _UrlLoaderInterceptorFactoryCreateParams() : super(kVersions.last.size);
99 103
100 static _UrlLoaderInterceptorFactoryCreateParams deserialize(bindings.Message m essage) { 104 static _UrlLoaderInterceptorFactoryCreateParams deserialize(bindings.Message m essage) {
101 var decoder = new bindings.Decoder(message); 105 var decoder = new bindings.Decoder(message);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 "interceptor: $interceptor" ")"; 152 "interceptor: $interceptor" ")";
149 } 153 }
150 154
151 Map toJson() { 155 Map toJson() {
152 throw new bindings.MojoCodecError( 156 throw new bindings.MojoCodecError(
153 'Object containing handles cannot be encoded to JSON.'); 157 'Object containing handles cannot be encoded to JSON.');
154 } 158 }
155 } 159 }
156 160
157 161
162
163
158 class _UrlLoaderInterceptorInterceptRequestParams extends bindings.Struct { 164 class _UrlLoaderInterceptorInterceptRequestParams extends bindings.Struct {
159 static const List<bindings.StructDataHeader> kVersions = const [ 165 static const List<bindings.StructDataHeader> kVersions = const [
160 const bindings.StructDataHeader(16, 0) 166 const bindings.StructDataHeader(16, 0)
161 ]; 167 ];
162 url_request_mojom.UrlRequest request = null; 168 url_request_mojom.UrlRequest request = null;
163 169
164 _UrlLoaderInterceptorInterceptRequestParams() : super(kVersions.last.size); 170 _UrlLoaderInterceptorInterceptRequestParams() : super(kVersions.last.size);
165 171
166 static _UrlLoaderInterceptorInterceptRequestParams deserialize(bindings.Messag e message) { 172 static _UrlLoaderInterceptorInterceptRequestParams deserialize(bindings.Messag e message) {
167 var decoder = new bindings.Decoder(message); 173 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 "request: $request" ")"; 221 "request: $request" ")";
216 } 222 }
217 223
218 Map toJson() { 224 Map toJson() {
219 throw new bindings.MojoCodecError( 225 throw new bindings.MojoCodecError(
220 'Object containing handles cannot be encoded to JSON.'); 226 'Object containing handles cannot be encoded to JSON.');
221 } 227 }
222 } 228 }
223 229
224 230
231
232
225 class UrlLoaderInterceptorInterceptRequestResponseParams extends bindings.Struct { 233 class UrlLoaderInterceptorInterceptRequestResponseParams extends bindings.Struct {
226 static const List<bindings.StructDataHeader> kVersions = const [ 234 static const List<bindings.StructDataHeader> kVersions = const [
227 const bindings.StructDataHeader(16, 0) 235 const bindings.StructDataHeader(16, 0)
228 ]; 236 ];
229 UrlLoaderInterceptorResponse response = null; 237 UrlLoaderInterceptorResponse response = null;
230 238
231 UrlLoaderInterceptorInterceptRequestResponseParams() : super(kVersions.last.si ze); 239 UrlLoaderInterceptorInterceptRequestResponseParams() : super(kVersions.last.si ze);
232 240
233 static UrlLoaderInterceptorInterceptRequestResponseParams deserialize(bindings .Message message) { 241 static UrlLoaderInterceptorInterceptRequestResponseParams deserialize(bindings .Message message) {
234 var decoder = new bindings.Decoder(message); 242 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 "response: $response" ")"; 290 "response: $response" ")";
283 } 291 }
284 292
285 Map toJson() { 293 Map toJson() {
286 throw new bindings.MojoCodecError( 294 throw new bindings.MojoCodecError(
287 'Object containing handles cannot be encoded to JSON.'); 295 'Object containing handles cannot be encoded to JSON.');
288 } 296 }
289 } 297 }
290 298
291 299
300
301
292 class _UrlLoaderInterceptorInterceptFollowRedirectParams extends bindings.Struct { 302 class _UrlLoaderInterceptorInterceptFollowRedirectParams extends bindings.Struct {
293 static const List<bindings.StructDataHeader> kVersions = const [ 303 static const List<bindings.StructDataHeader> kVersions = const [
294 const bindings.StructDataHeader(8, 0) 304 const bindings.StructDataHeader(8, 0)
295 ]; 305 ];
296 306
297 _UrlLoaderInterceptorInterceptFollowRedirectParams() : super(kVersions.last.si ze); 307 _UrlLoaderInterceptorInterceptFollowRedirectParams() : super(kVersions.last.si ze);
298 308
299 static _UrlLoaderInterceptorInterceptFollowRedirectParams deserialize(bindings .Message message) { 309 static _UrlLoaderInterceptorInterceptFollowRedirectParams deserialize(bindings .Message message) {
300 var decoder = new bindings.Decoder(message); 310 var decoder = new bindings.Decoder(message);
301 var result = decode(decoder); 311 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return "_UrlLoaderInterceptorInterceptFollowRedirectParams("")"; 350 return "_UrlLoaderInterceptorInterceptFollowRedirectParams("")";
341 } 351 }
342 352
343 Map toJson() { 353 Map toJson() {
344 Map map = new Map(); 354 Map map = new Map();
345 return map; 355 return map;
346 } 356 }
347 } 357 }
348 358
349 359
360
361
350 class UrlLoaderInterceptorInterceptFollowRedirectResponseParams extends bindings .Struct { 362 class UrlLoaderInterceptorInterceptFollowRedirectResponseParams extends bindings .Struct {
351 static const List<bindings.StructDataHeader> kVersions = const [ 363 static const List<bindings.StructDataHeader> kVersions = const [
352 const bindings.StructDataHeader(16, 0) 364 const bindings.StructDataHeader(16, 0)
353 ]; 365 ];
354 UrlLoaderInterceptorResponse response = null; 366 UrlLoaderInterceptorResponse response = null;
355 367
356 UrlLoaderInterceptorInterceptFollowRedirectResponseParams() : super(kVersions. last.size); 368 UrlLoaderInterceptorInterceptFollowRedirectResponseParams() : super(kVersions. last.size);
357 369
358 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams deserialize(b indings.Message message) { 370 static UrlLoaderInterceptorInterceptFollowRedirectResponseParams deserialize(b indings.Message message) {
359 var decoder = new bindings.Decoder(message); 371 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 "response: $response" ")"; 419 "response: $response" ")";
408 } 420 }
409 421
410 Map toJson() { 422 Map toJson() {
411 throw new bindings.MojoCodecError( 423 throw new bindings.MojoCodecError(
412 'Object containing handles cannot be encoded to JSON.'); 424 'Object containing handles cannot be encoded to JSON.');
413 } 425 }
414 } 426 }
415 427
416 428
429
430
417 class _UrlLoaderInterceptorInterceptResponseParams extends bindings.Struct { 431 class _UrlLoaderInterceptorInterceptResponseParams extends bindings.Struct {
418 static const List<bindings.StructDataHeader> kVersions = const [ 432 static const List<bindings.StructDataHeader> kVersions = const [
419 const bindings.StructDataHeader(16, 0) 433 const bindings.StructDataHeader(16, 0)
420 ]; 434 ];
421 url_response_mojom.UrlResponse response = null; 435 url_response_mojom.UrlResponse response = null;
422 436
423 _UrlLoaderInterceptorInterceptResponseParams() : super(kVersions.last.size); 437 _UrlLoaderInterceptorInterceptResponseParams() : super(kVersions.last.size);
424 438
425 static _UrlLoaderInterceptorInterceptResponseParams deserialize(bindings.Messa ge message) { 439 static _UrlLoaderInterceptorInterceptResponseParams deserialize(bindings.Messa ge message) {
426 var decoder = new bindings.Decoder(message); 440 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 "response: $response" ")"; 488 "response: $response" ")";
475 } 489 }
476 490
477 Map toJson() { 491 Map toJson() {
478 throw new bindings.MojoCodecError( 492 throw new bindings.MojoCodecError(
479 'Object containing handles cannot be encoded to JSON.'); 493 'Object containing handles cannot be encoded to JSON.');
480 } 494 }
481 } 495 }
482 496
483 497
498
499
484 class UrlLoaderInterceptorInterceptResponseResponseParams extends bindings.Struc t { 500 class UrlLoaderInterceptorInterceptResponseResponseParams extends bindings.Struc t {
485 static const List<bindings.StructDataHeader> kVersions = const [ 501 static const List<bindings.StructDataHeader> kVersions = const [
486 const bindings.StructDataHeader(16, 0) 502 const bindings.StructDataHeader(16, 0)
487 ]; 503 ];
488 UrlLoaderInterceptorResponse response = null; 504 UrlLoaderInterceptorResponse response = null;
489 505
490 UrlLoaderInterceptorInterceptResponseResponseParams() : super(kVersions.last.s ize); 506 UrlLoaderInterceptorInterceptResponseResponseParams() : super(kVersions.last.s ize);
491 507
492 static UrlLoaderInterceptorInterceptResponseResponseParams deserialize(binding s.Message message) { 508 static UrlLoaderInterceptorInterceptResponseResponseParams deserialize(binding s.Message message) {
493 var decoder = new bindings.Decoder(message); 509 var decoder = new bindings.Decoder(message);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return "UrlLoaderInterceptorInterceptResponseResponseParams(" 556 return "UrlLoaderInterceptorInterceptResponseResponseParams("
541 "response: $response" ")"; 557 "response: $response" ")";
542 } 558 }
543 559
544 Map toJson() { 560 Map toJson() {
545 throw new bindings.MojoCodecError( 561 throw new bindings.MojoCodecError(
546 'Object containing handles cannot be encoded to JSON.'); 562 'Object containing handles cannot be encoded to JSON.');
547 } 563 }
548 } 564 }
549 565
566
567
568
550 const int _UrlLoaderInterceptorFactory_createName = 0; 569 const int _UrlLoaderInterceptorFactory_createName = 0;
551 570
571
572
573 class _UrlLoaderInterceptorFactoryServiceDescription implements service_describe r.ServiceDescription {
574 dynamic getTopLevelInterface([Function responseFactory]) => null;
575
576 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
577
578 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
579 }
580
552 abstract class UrlLoaderInterceptorFactory { 581 abstract class UrlLoaderInterceptorFactory {
553 static const String serviceName = null; 582 static const String serviceName = null;
554 void create(Object interceptor); 583 void create(Object interceptor);
555 } 584 }
556 585
557 586
558 class _UrlLoaderInterceptorFactoryProxyImpl extends bindings.Proxy { 587 class _UrlLoaderInterceptorFactoryProxyImpl extends bindings.Proxy {
559 _UrlLoaderInterceptorFactoryProxyImpl.fromEndpoint( 588 _UrlLoaderInterceptorFactoryProxyImpl.fromEndpoint(
560 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 589 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
561 590
562 _UrlLoaderInterceptorFactoryProxyImpl.fromHandle(core.MojoHandle handle) : 591 _UrlLoaderInterceptorFactoryProxyImpl.fromHandle(core.MojoHandle handle) :
563 super.fromHandle(handle); 592 super.fromHandle(handle);
564 593
565 _UrlLoaderInterceptorFactoryProxyImpl.unbound() : super.unbound(); 594 _UrlLoaderInterceptorFactoryProxyImpl.unbound() : super.unbound();
566 595
567 static _UrlLoaderInterceptorFactoryProxyImpl newFromEndpoint( 596 static _UrlLoaderInterceptorFactoryProxyImpl newFromEndpoint(
568 core.MojoMessagePipeEndpoint endpoint) { 597 core.MojoMessagePipeEndpoint endpoint) {
569 assert(endpoint.setDescription("For _UrlLoaderInterceptorFactoryProxyImpl")) ; 598 assert(endpoint.setDescription("For _UrlLoaderInterceptorFactoryProxyImpl")) ;
570 return new _UrlLoaderInterceptorFactoryProxyImpl.fromEndpoint(endpoint); 599 return new _UrlLoaderInterceptorFactoryProxyImpl.fromEndpoint(endpoint);
571 } 600 }
572 601
602 service_describer.ServiceDescription get serviceDescription =>
603 new _UrlLoaderInterceptorFactoryServiceDescription();
604
573 void handleResponse(bindings.ServiceMessage message) { 605 void handleResponse(bindings.ServiceMessage message) {
574 switch (message.header.type) { 606 switch (message.header.type) {
575 default: 607 default:
576 proxyError("Unexpected message type: ${message.header.type}"); 608 proxyError("Unexpected message type: ${message.header.type}");
577 close(immediate: true); 609 close(immediate: true);
578 break; 610 break;
579 } 611 }
580 } 612 }
581 613
582 String toString() { 614 String toString() {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 assert(_impl == null); 738 assert(_impl == null);
707 _impl = d; 739 _impl = d;
708 } 740 }
709 741
710 String toString() { 742 String toString() {
711 var superString = super.toString(); 743 var superString = super.toString();
712 return "UrlLoaderInterceptorFactoryStub($superString)"; 744 return "UrlLoaderInterceptorFactoryStub($superString)";
713 } 745 }
714 746
715 int get version => 0; 747 int get version => 0;
748
749 service_describer.ServiceDescription get serviceDescription =>
750 new _UrlLoaderInterceptorFactoryServiceDescription();
716 } 751 }
717 752
718 const int _UrlLoaderInterceptor_interceptRequestName = 0; 753 const int _UrlLoaderInterceptor_interceptRequestName = 0;
719 const int _UrlLoaderInterceptor_interceptFollowRedirectName = 1; 754 const int _UrlLoaderInterceptor_interceptFollowRedirectName = 1;
720 const int _UrlLoaderInterceptor_interceptResponseName = 2; 755 const int _UrlLoaderInterceptor_interceptResponseName = 2;
721 756
757
758
759 class _UrlLoaderInterceptorServiceDescription implements service_describer.Servi ceDescription {
760 dynamic getTopLevelInterface([Function responseFactory]) => null;
761
762 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
763
764 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
765 }
766
722 abstract class UrlLoaderInterceptor { 767 abstract class UrlLoaderInterceptor {
723 static const String serviceName = null; 768 static const String serviceName = null;
724 dynamic interceptRequest(url_request_mojom.UrlRequest request,[Function respon seFactory = null]); 769 dynamic interceptRequest(url_request_mojom.UrlRequest request,[Function respon seFactory = null]);
725 dynamic interceptFollowRedirect([Function responseFactory = null]); 770 dynamic interceptFollowRedirect([Function responseFactory = null]);
726 dynamic interceptResponse(url_response_mojom.UrlResponse response,[Function re sponseFactory = null]); 771 dynamic interceptResponse(url_response_mojom.UrlResponse response,[Function re sponseFactory = null]);
727 } 772 }
728 773
729 774
730 class _UrlLoaderInterceptorProxyImpl extends bindings.Proxy { 775 class _UrlLoaderInterceptorProxyImpl extends bindings.Proxy {
731 _UrlLoaderInterceptorProxyImpl.fromEndpoint( 776 _UrlLoaderInterceptorProxyImpl.fromEndpoint(
732 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 777 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
733 778
734 _UrlLoaderInterceptorProxyImpl.fromHandle(core.MojoHandle handle) : 779 _UrlLoaderInterceptorProxyImpl.fromHandle(core.MojoHandle handle) :
735 super.fromHandle(handle); 780 super.fromHandle(handle);
736 781
737 _UrlLoaderInterceptorProxyImpl.unbound() : super.unbound(); 782 _UrlLoaderInterceptorProxyImpl.unbound() : super.unbound();
738 783
739 static _UrlLoaderInterceptorProxyImpl newFromEndpoint( 784 static _UrlLoaderInterceptorProxyImpl newFromEndpoint(
740 core.MojoMessagePipeEndpoint endpoint) { 785 core.MojoMessagePipeEndpoint endpoint) {
741 assert(endpoint.setDescription("For _UrlLoaderInterceptorProxyImpl")); 786 assert(endpoint.setDescription("For _UrlLoaderInterceptorProxyImpl"));
742 return new _UrlLoaderInterceptorProxyImpl.fromEndpoint(endpoint); 787 return new _UrlLoaderInterceptorProxyImpl.fromEndpoint(endpoint);
743 } 788 }
744 789
790 service_describer.ServiceDescription get serviceDescription =>
791 new _UrlLoaderInterceptorServiceDescription();
792
745 void handleResponse(bindings.ServiceMessage message) { 793 void handleResponse(bindings.ServiceMessage message) {
746 switch (message.header.type) { 794 switch (message.header.type) {
747 case _UrlLoaderInterceptor_interceptRequestName: 795 case _UrlLoaderInterceptor_interceptRequestName:
748 var r = UrlLoaderInterceptorInterceptRequestResponseParams.deserialize( 796 var r = UrlLoaderInterceptorInterceptRequestResponseParams.deserialize(
749 message.payload); 797 message.payload);
750 if (!message.header.hasRequestId) { 798 if (!message.header.hasRequestId) {
751 proxyError("Expected a message with a valid request Id."); 799 proxyError("Expected a message with a valid request Id.");
752 return; 800 return;
753 } 801 }
754 Completer c = completerMap[message.header.requestId]; 802 Completer c = completerMap[message.header.requestId];
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 assert(_impl == null); 1079 assert(_impl == null);
1032 _impl = d; 1080 _impl = d;
1033 } 1081 }
1034 1082
1035 String toString() { 1083 String toString() {
1036 var superString = super.toString(); 1084 var superString = super.toString();
1037 return "UrlLoaderInterceptorStub($superString)"; 1085 return "UrlLoaderInterceptorStub($superString)";
1038 } 1086 }
1039 1087
1040 int get version => 0; 1088 int get version => 0;
1089
1090 service_describer.ServiceDescription get serviceDescription =>
1091 new _UrlLoaderInterceptorServiceDescription();
1041 } 1092 }
1042 1093
1043 1094
1095
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698