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

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

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Move and Standardize Mojom Type Functions Created 4 years, 11 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 nfc_mojom; 5 library nfc_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 13
12 14
13 15
14 class NfcData extends bindings.Struct { 16 class NfcData extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 17 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(16, 0) 18 const bindings.StructDataHeader(16, 0)
17 ]; 19 ];
18 List<int> data = null; 20 List<int> data = null;
19 21
20 NfcData() : super(kVersions.last.size); 22 NfcData() : super(kVersions.last.size);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 73 }
72 74
73 Map toJson() { 75 Map toJson() {
74 Map map = new Map(); 76 Map map = new Map();
75 map["data"] = data; 77 map["data"] = data;
76 return map; 78 return map;
77 } 79 }
78 } 80 }
79 81
80 82
83
84
81 class _NfcTransmissionCancelParams extends bindings.Struct { 85 class _NfcTransmissionCancelParams extends bindings.Struct {
82 static const List<bindings.StructDataHeader> kVersions = const [ 86 static const List<bindings.StructDataHeader> kVersions = const [
83 const bindings.StructDataHeader(8, 0) 87 const bindings.StructDataHeader(8, 0)
84 ]; 88 ];
85 89
86 _NfcTransmissionCancelParams() : super(kVersions.last.size); 90 _NfcTransmissionCancelParams() : super(kVersions.last.size);
87 91
88 static _NfcTransmissionCancelParams deserialize(bindings.Message message) { 92 static _NfcTransmissionCancelParams deserialize(bindings.Message message) {
89 var decoder = new bindings.Decoder(message); 93 var decoder = new bindings.Decoder(message);
90 var result = decode(decoder); 94 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return "_NfcTransmissionCancelParams("")"; 133 return "_NfcTransmissionCancelParams("")";
130 } 134 }
131 135
132 Map toJson() { 136 Map toJson() {
133 Map map = new Map(); 137 Map map = new Map();
134 return map; 138 return map;
135 } 139 }
136 } 140 }
137 141
138 142
143
144
139 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct { 145 class _NfcReceiverOnReceivedNfcDataParams extends bindings.Struct {
140 static const List<bindings.StructDataHeader> kVersions = const [ 146 static const List<bindings.StructDataHeader> kVersions = const [
141 const bindings.StructDataHeader(16, 0) 147 const bindings.StructDataHeader(16, 0)
142 ]; 148 ];
143 NfcData nfcData = null; 149 NfcData nfcData = null;
144 150
145 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size); 151 _NfcReceiverOnReceivedNfcDataParams() : super(kVersions.last.size);
146 152
147 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) { 153 static _NfcReceiverOnReceivedNfcDataParams deserialize(bindings.Message messag e) {
148 var decoder = new bindings.Decoder(message); 154 var decoder = new bindings.Decoder(message);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 203 }
198 204
199 Map toJson() { 205 Map toJson() {
200 Map map = new Map(); 206 Map map = new Map();
201 map["nfcData"] = nfcData; 207 map["nfcData"] = nfcData;
202 return map; 208 return map;
203 } 209 }
204 } 210 }
205 211
206 212
213
214
207 class _NfcTransmitOnNextConnectionParams extends bindings.Struct { 215 class _NfcTransmitOnNextConnectionParams extends bindings.Struct {
208 static const List<bindings.StructDataHeader> kVersions = const [ 216 static const List<bindings.StructDataHeader> kVersions = const [
209 const bindings.StructDataHeader(24, 0) 217 const bindings.StructDataHeader(24, 0)
210 ]; 218 ];
211 NfcData nfcData = null; 219 NfcData nfcData = null;
212 Object transmission = null; 220 Object transmission = null;
213 221
214 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size); 222 _NfcTransmitOnNextConnectionParams() : super(kVersions.last.size);
215 223
216 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) { 224 static _NfcTransmitOnNextConnectionParams deserialize(bindings.Message message ) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 "transmission: $transmission" ")"; 280 "transmission: $transmission" ")";
273 } 281 }
274 282
275 Map toJson() { 283 Map toJson() {
276 throw new bindings.MojoCodecError( 284 throw new bindings.MojoCodecError(
277 'Object containing handles cannot be encoded to JSON.'); 285 'Object containing handles cannot be encoded to JSON.');
278 } 286 }
279 } 287 }
280 288
281 289
290
291
282 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct { 292 class NfcTransmitOnNextConnectionResponseParams extends bindings.Struct {
283 static const List<bindings.StructDataHeader> kVersions = const [ 293 static const List<bindings.StructDataHeader> kVersions = const [
284 const bindings.StructDataHeader(16, 0) 294 const bindings.StructDataHeader(16, 0)
285 ]; 295 ];
286 bool success = false; 296 bool success = false;
287 297
288 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size); 298 NfcTransmitOnNextConnectionResponseParams() : super(kVersions.last.size);
289 299
290 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) { 300 static NfcTransmitOnNextConnectionResponseParams deserialize(bindings.Message message) {
291 var decoder = new bindings.Decoder(message); 301 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 349 }
340 350
341 Map toJson() { 351 Map toJson() {
342 Map map = new Map(); 352 Map map = new Map();
343 map["success"] = success; 353 map["success"] = success;
344 return map; 354 return map;
345 } 355 }
346 } 356 }
347 357
348 358
359
360
349 class _NfcRegisterParams extends bindings.Struct { 361 class _NfcRegisterParams extends bindings.Struct {
350 static const List<bindings.StructDataHeader> kVersions = const [ 362 static const List<bindings.StructDataHeader> kVersions = const [
351 const bindings.StructDataHeader(8, 0) 363 const bindings.StructDataHeader(8, 0)
352 ]; 364 ];
353 365
354 _NfcRegisterParams() : super(kVersions.last.size); 366 _NfcRegisterParams() : super(kVersions.last.size);
355 367
356 static _NfcRegisterParams deserialize(bindings.Message message) { 368 static _NfcRegisterParams deserialize(bindings.Message message) {
357 var decoder = new bindings.Decoder(message); 369 var decoder = new bindings.Decoder(message);
358 var result = decode(decoder); 370 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 return "_NfcRegisterParams("")"; 409 return "_NfcRegisterParams("")";
398 } 410 }
399 411
400 Map toJson() { 412 Map toJson() {
401 Map map = new Map(); 413 Map map = new Map();
402 return map; 414 return map;
403 } 415 }
404 } 416 }
405 417
406 418
419
420
407 class _NfcUnregisterParams extends bindings.Struct { 421 class _NfcUnregisterParams extends bindings.Struct {
408 static const List<bindings.StructDataHeader> kVersions = const [ 422 static const List<bindings.StructDataHeader> kVersions = const [
409 const bindings.StructDataHeader(8, 0) 423 const bindings.StructDataHeader(8, 0)
410 ]; 424 ];
411 425
412 _NfcUnregisterParams() : super(kVersions.last.size); 426 _NfcUnregisterParams() : super(kVersions.last.size);
413 427
414 static _NfcUnregisterParams deserialize(bindings.Message message) { 428 static _NfcUnregisterParams deserialize(bindings.Message message) {
415 var decoder = new bindings.Decoder(message); 429 var decoder = new bindings.Decoder(message);
416 var result = decode(decoder); 430 var result = decode(decoder);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 String toString() { 468 String toString() {
455 return "_NfcUnregisterParams("")"; 469 return "_NfcUnregisterParams("")";
456 } 470 }
457 471
458 Map toJson() { 472 Map toJson() {
459 Map map = new Map(); 473 Map map = new Map();
460 return map; 474 return map;
461 } 475 }
462 } 476 }
463 477
478
479
480
464 const int _NfcTransmission_cancelName = 0; 481 const int _NfcTransmission_cancelName = 0;
465 482
483
484
485 class _NfcTransmissionServiceDescription implements service_describer.ServiceDes cription {
486 dynamic getTopLevelInterface([Function responseFactory = null]) => null;
487
488 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = >
489 null;
490
491 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null;
492 }
493
466 abstract class NfcTransmission { 494 abstract class NfcTransmission {
467 static const String serviceName = null; 495 static const String serviceName = null;
468 void cancel(); 496 void cancel();
469 } 497 }
470 498
471 499
472 class _NfcTransmissionProxyImpl extends bindings.Proxy { 500 class _NfcTransmissionProxyImpl extends bindings.Proxy {
473 _NfcTransmissionProxyImpl.fromEndpoint( 501 _NfcTransmissionProxyImpl.fromEndpoint(
474 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 502 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
475 503
476 _NfcTransmissionProxyImpl.fromHandle(core.MojoHandle handle) : 504 _NfcTransmissionProxyImpl.fromHandle(core.MojoHandle handle) :
477 super.fromHandle(handle); 505 super.fromHandle(handle);
478 506
479 _NfcTransmissionProxyImpl.unbound() : super.unbound(); 507 _NfcTransmissionProxyImpl.unbound() : super.unbound();
480 508
481 static _NfcTransmissionProxyImpl newFromEndpoint( 509 static _NfcTransmissionProxyImpl newFromEndpoint(
482 core.MojoMessagePipeEndpoint endpoint) { 510 core.MojoMessagePipeEndpoint endpoint) {
483 assert(endpoint.setDescription("For _NfcTransmissionProxyImpl")); 511 assert(endpoint.setDescription("For _NfcTransmissionProxyImpl"));
484 return new _NfcTransmissionProxyImpl.fromEndpoint(endpoint); 512 return new _NfcTransmissionProxyImpl.fromEndpoint(endpoint);
485 } 513 }
486 514
515 service_describer.ServiceDescription get serviceDescription =>
516 new _NfcTransmissionServiceDescription();
517
487 void handleResponse(bindings.ServiceMessage message) { 518 void handleResponse(bindings.ServiceMessage message) {
488 switch (message.header.type) { 519 switch (message.header.type) {
489 default: 520 default:
490 proxyError("Unexpected message type: ${message.header.type}"); 521 proxyError("Unexpected message type: ${message.header.type}");
491 close(immediate: true); 522 close(immediate: true);
492 break; 523 break;
493 } 524 }
494 } 525 }
495 526
496 String toString() { 527 String toString() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 assert(_impl == null); 650 assert(_impl == null);
620 _impl = d; 651 _impl = d;
621 } 652 }
622 653
623 String toString() { 654 String toString() {
624 var superString = super.toString(); 655 var superString = super.toString();
625 return "NfcTransmissionStub($superString)"; 656 return "NfcTransmissionStub($superString)";
626 } 657 }
627 658
628 int get version => 0; 659 int get version => 0;
660
661 service_describer.ServiceDescription get serviceDescription =>
662 new _NfcTransmissionServiceDescription();
629 } 663 }
630 664
631 const int _NfcReceiver_onReceivedNfcDataName = 0; 665 const int _NfcReceiver_onReceivedNfcDataName = 0;
632 666
667
668
669 class _NfcReceiverServiceDescription implements service_describer.ServiceDescrip tion {
670 dynamic getTopLevelInterface([Function responseFactory = null]) => null;
671
672 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = >
673 null;
674
675 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null;
676 }
677
633 abstract class NfcReceiver { 678 abstract class NfcReceiver {
634 static const String serviceName = "nfc::NfcReceiver"; 679 static const String serviceName = "nfc::NfcReceiver";
635 void onReceivedNfcData(NfcData nfcData); 680 void onReceivedNfcData(NfcData nfcData);
636 } 681 }
637 682
638 683
639 class _NfcReceiverProxyImpl extends bindings.Proxy { 684 class _NfcReceiverProxyImpl extends bindings.Proxy {
640 _NfcReceiverProxyImpl.fromEndpoint( 685 _NfcReceiverProxyImpl.fromEndpoint(
641 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 686 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
642 687
643 _NfcReceiverProxyImpl.fromHandle(core.MojoHandle handle) : 688 _NfcReceiverProxyImpl.fromHandle(core.MojoHandle handle) :
644 super.fromHandle(handle); 689 super.fromHandle(handle);
645 690
646 _NfcReceiverProxyImpl.unbound() : super.unbound(); 691 _NfcReceiverProxyImpl.unbound() : super.unbound();
647 692
648 static _NfcReceiverProxyImpl newFromEndpoint( 693 static _NfcReceiverProxyImpl newFromEndpoint(
649 core.MojoMessagePipeEndpoint endpoint) { 694 core.MojoMessagePipeEndpoint endpoint) {
650 assert(endpoint.setDescription("For _NfcReceiverProxyImpl")); 695 assert(endpoint.setDescription("For _NfcReceiverProxyImpl"));
651 return new _NfcReceiverProxyImpl.fromEndpoint(endpoint); 696 return new _NfcReceiverProxyImpl.fromEndpoint(endpoint);
652 } 697 }
653 698
699 service_describer.ServiceDescription get serviceDescription =>
700 new _NfcReceiverServiceDescription();
701
654 void handleResponse(bindings.ServiceMessage message) { 702 void handleResponse(bindings.ServiceMessage message) {
655 switch (message.header.type) { 703 switch (message.header.type) {
656 default: 704 default:
657 proxyError("Unexpected message type: ${message.header.type}"); 705 proxyError("Unexpected message type: ${message.header.type}");
658 close(immediate: true); 706 close(immediate: true);
659 break; 707 break;
660 } 708 }
661 } 709 }
662 710
663 String toString() { 711 String toString() {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 assert(_impl == null); 835 assert(_impl == null);
788 _impl = d; 836 _impl = d;
789 } 837 }
790 838
791 String toString() { 839 String toString() {
792 var superString = super.toString(); 840 var superString = super.toString();
793 return "NfcReceiverStub($superString)"; 841 return "NfcReceiverStub($superString)";
794 } 842 }
795 843
796 int get version => 0; 844 int get version => 0;
845
846 service_describer.ServiceDescription get serviceDescription =>
847 new _NfcReceiverServiceDescription();
797 } 848 }
798 849
799 const int _Nfc_transmitOnNextConnectionName = 0; 850 const int _Nfc_transmitOnNextConnectionName = 0;
800 const int _Nfc_registerName = 1; 851 const int _Nfc_registerName = 1;
801 const int _Nfc_unregisterName = 2; 852 const int _Nfc_unregisterName = 2;
802 853
854
855
856 class _NfcServiceDescription implements service_describer.ServiceDescription {
857 dynamic getTopLevelInterface([Function responseFactory = null]) => null;
858
859 dynamic getTypeDefinition(String typeKey, [Function responseFactory = null]) = >
860 null;
861
862 dynamic getAllTypeDefinitions([Function responseFactory = null]) => null;
863 }
864
803 abstract class Nfc { 865 abstract class Nfc {
804 static const String serviceName = "nfc::Nfc"; 866 static const String serviceName = "nfc::Nfc";
805 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]); 867 dynamic transmitOnNextConnection(NfcData nfcData,Object transmission,[Function responseFactory = null]);
806 void register(); 868 void register();
807 void unregister(); 869 void unregister();
808 } 870 }
809 871
810 872
811 class _NfcProxyImpl extends bindings.Proxy { 873 class _NfcProxyImpl extends bindings.Proxy {
812 _NfcProxyImpl.fromEndpoint( 874 _NfcProxyImpl.fromEndpoint(
813 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 875 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
814 876
815 _NfcProxyImpl.fromHandle(core.MojoHandle handle) : 877 _NfcProxyImpl.fromHandle(core.MojoHandle handle) :
816 super.fromHandle(handle); 878 super.fromHandle(handle);
817 879
818 _NfcProxyImpl.unbound() : super.unbound(); 880 _NfcProxyImpl.unbound() : super.unbound();
819 881
820 static _NfcProxyImpl newFromEndpoint( 882 static _NfcProxyImpl newFromEndpoint(
821 core.MojoMessagePipeEndpoint endpoint) { 883 core.MojoMessagePipeEndpoint endpoint) {
822 assert(endpoint.setDescription("For _NfcProxyImpl")); 884 assert(endpoint.setDescription("For _NfcProxyImpl"));
823 return new _NfcProxyImpl.fromEndpoint(endpoint); 885 return new _NfcProxyImpl.fromEndpoint(endpoint);
824 } 886 }
825 887
888 service_describer.ServiceDescription get serviceDescription =>
889 new _NfcServiceDescription();
890
826 void handleResponse(bindings.ServiceMessage message) { 891 void handleResponse(bindings.ServiceMessage message) {
827 switch (message.header.type) { 892 switch (message.header.type) {
828 case _Nfc_transmitOnNextConnectionName: 893 case _Nfc_transmitOnNextConnectionName:
829 var r = NfcTransmitOnNextConnectionResponseParams.deserialize( 894 var r = NfcTransmitOnNextConnectionResponseParams.deserialize(
830 message.payload); 895 message.payload);
831 if (!message.header.hasRequestId) { 896 if (!message.header.hasRequestId) {
832 proxyError("Expected a message with a valid request Id."); 897 proxyError("Expected a message with a valid request Id.");
833 return; 898 return;
834 } 899 }
835 Completer c = completerMap[message.header.requestId]; 900 Completer c = completerMap[message.header.requestId];
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 assert(_impl == null); 1093 assert(_impl == null);
1029 _impl = d; 1094 _impl = d;
1030 } 1095 }
1031 1096
1032 String toString() { 1097 String toString() {
1033 var superString = super.toString(); 1098 var superString = super.toString();
1034 return "NfcStub($superString)"; 1099 return "NfcStub($superString)";
1035 } 1100 }
1036 1101
1037 int get version => 0; 1102 int get version => 0;
1103
1104 service_describer.ServiceDescription get serviceDescription =>
1105 new _NfcServiceDescription();
1038 } 1106 }
1039 1107
1040 1108
1109
1110
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698