| 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 nfc_mojom; | 5 library nfc_mojom; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
| 8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
| 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 10 | 10 |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 impl.requireVersion(requiredVersion); | 606 impl.requireVersion(requiredVersion); |
| 607 } | 607 } |
| 608 | 608 |
| 609 String toString() { | 609 String toString() { |
| 610 return "NfcTransmissionProxy($impl)"; | 610 return "NfcTransmissionProxy($impl)"; |
| 611 } | 611 } |
| 612 } | 612 } |
| 613 | 613 |
| 614 | 614 |
| 615 class NfcTransmissionStub extends bindings.Stub { | 615 class NfcTransmissionStub extends bindings.Stub { |
| 616 NfcTransmission _impl = null; | 616 NfcTransmission _impl; |
| 617 | 617 |
| 618 NfcTransmissionStub.fromEndpoint( | 618 NfcTransmissionStub.fromEndpoint( |
| 619 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 619 core.MojoMessagePipeEndpoint endpoint, [NfcTransmission impl]) |
| 620 : super.fromEndpoint(endpoint); | 620 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 621 _impl = impl; |
| 622 } |
| 621 | 623 |
| 622 NfcTransmissionStub.fromHandle(core.MojoHandle handle, [this._impl]) | 624 NfcTransmissionStub.fromHandle( |
| 623 : super.fromHandle(handle); | 625 core.MojoHandle handle, [NfcTransmission impl]) |
| 626 : super.fromHandle(handle, autoBegin: impl != null) { |
| 627 _impl = impl; |
| 628 } |
| 624 | 629 |
| 625 NfcTransmissionStub.unbound() : super.unbound(); | 630 NfcTransmissionStub.unbound() : super.unbound(); |
| 626 | 631 |
| 627 static NfcTransmissionStub newFromEndpoint( | 632 static NfcTransmissionStub newFromEndpoint( |
| 628 core.MojoMessagePipeEndpoint endpoint) { | 633 core.MojoMessagePipeEndpoint endpoint) { |
| 629 assert(endpoint.setDescription("For NfcTransmissionStub")); | 634 assert(endpoint.setDescription("For NfcTransmissionStub")); |
| 630 return new NfcTransmissionStub.fromEndpoint(endpoint); | 635 return new NfcTransmissionStub.fromEndpoint(endpoint); |
| 631 } | 636 } |
| 632 | 637 |
| 633 | 638 |
| 634 | 639 |
| 635 dynamic handleMessage(bindings.ServiceMessage message) { | 640 dynamic handleMessage(bindings.ServiceMessage message) { |
| 636 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 641 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 637 return bindings.ControlMessageHandler.handleMessage(this, | 642 return bindings.ControlMessageHandler.handleMessage(this, |
| 638 0, | 643 0, |
| 639 message); | 644 message); |
| 640 } | 645 } |
| 641 assert(_impl != null); | 646 if (_impl == null) { |
| 647 throw new core.MojoApiError("$this has no implementation set"); |
| 648 } |
| 642 switch (message.header.type) { | 649 switch (message.header.type) { |
| 643 case _nfcTransmissionMethodCancelName: | 650 case _nfcTransmissionMethodCancelName: |
| 644 _impl.cancel(); | 651 _impl.cancel(); |
| 645 break; | 652 break; |
| 646 default: | 653 default: |
| 647 throw new bindings.MojoCodecError("Unexpected message name"); | 654 throw new bindings.MojoCodecError("Unexpected message name"); |
| 648 break; | 655 break; |
| 649 } | 656 } |
| 650 return null; | 657 return null; |
| 651 } | 658 } |
| 652 | 659 |
| 653 NfcTransmission get impl => _impl; | 660 NfcTransmission get impl => _impl; |
| 654 set impl(NfcTransmission d) { | 661 set impl(NfcTransmission d) { |
| 655 assert(_impl == null); | 662 if (d == null) { |
| 663 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 664 } |
| 665 if (isBound && (_impl == null)) { |
| 666 beginHandlingEvents(); |
| 667 } |
| 656 _impl = d; | 668 _impl = d; |
| 657 } | 669 } |
| 658 | 670 |
| 671 @override |
| 672 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 673 super.bind(endpoint); |
| 674 if (!isOpen && (_impl != null)) { |
| 675 beginHandlingEvents(); |
| 676 } |
| 677 } |
| 678 |
| 659 String toString() { | 679 String toString() { |
| 660 var superString = super.toString(); | 680 var superString = super.toString(); |
| 661 return "NfcTransmissionStub($superString)"; | 681 return "NfcTransmissionStub($superString)"; |
| 662 } | 682 } |
| 663 | 683 |
| 664 int get version => 0; | 684 int get version => 0; |
| 665 | 685 |
| 666 static service_describer.ServiceDescription _cachedServiceDescription; | 686 static service_describer.ServiceDescription _cachedServiceDescription; |
| 667 static service_describer.ServiceDescription get serviceDescription { | 687 static service_describer.ServiceDescription get serviceDescription { |
| 668 if (_cachedServiceDescription == null) { | 688 if (_cachedServiceDescription == null) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 impl.requireVersion(requiredVersion); | 814 impl.requireVersion(requiredVersion); |
| 795 } | 815 } |
| 796 | 816 |
| 797 String toString() { | 817 String toString() { |
| 798 return "NfcReceiverProxy($impl)"; | 818 return "NfcReceiverProxy($impl)"; |
| 799 } | 819 } |
| 800 } | 820 } |
| 801 | 821 |
| 802 | 822 |
| 803 class NfcReceiverStub extends bindings.Stub { | 823 class NfcReceiverStub extends bindings.Stub { |
| 804 NfcReceiver _impl = null; | 824 NfcReceiver _impl; |
| 805 | 825 |
| 806 NfcReceiverStub.fromEndpoint( | 826 NfcReceiverStub.fromEndpoint( |
| 807 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 827 core.MojoMessagePipeEndpoint endpoint, [NfcReceiver impl]) |
| 808 : super.fromEndpoint(endpoint); | 828 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 829 _impl = impl; |
| 830 } |
| 809 | 831 |
| 810 NfcReceiverStub.fromHandle(core.MojoHandle handle, [this._impl]) | 832 NfcReceiverStub.fromHandle( |
| 811 : super.fromHandle(handle); | 833 core.MojoHandle handle, [NfcReceiver impl]) |
| 834 : super.fromHandle(handle, autoBegin: impl != null) { |
| 835 _impl = impl; |
| 836 } |
| 812 | 837 |
| 813 NfcReceiverStub.unbound() : super.unbound(); | 838 NfcReceiverStub.unbound() : super.unbound(); |
| 814 | 839 |
| 815 static NfcReceiverStub newFromEndpoint( | 840 static NfcReceiverStub newFromEndpoint( |
| 816 core.MojoMessagePipeEndpoint endpoint) { | 841 core.MojoMessagePipeEndpoint endpoint) { |
| 817 assert(endpoint.setDescription("For NfcReceiverStub")); | 842 assert(endpoint.setDescription("For NfcReceiverStub")); |
| 818 return new NfcReceiverStub.fromEndpoint(endpoint); | 843 return new NfcReceiverStub.fromEndpoint(endpoint); |
| 819 } | 844 } |
| 820 | 845 |
| 821 | 846 |
| 822 | 847 |
| 823 dynamic handleMessage(bindings.ServiceMessage message) { | 848 dynamic handleMessage(bindings.ServiceMessage message) { |
| 824 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 849 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 825 return bindings.ControlMessageHandler.handleMessage(this, | 850 return bindings.ControlMessageHandler.handleMessage(this, |
| 826 0, | 851 0, |
| 827 message); | 852 message); |
| 828 } | 853 } |
| 829 assert(_impl != null); | 854 if (_impl == null) { |
| 855 throw new core.MojoApiError("$this has no implementation set"); |
| 856 } |
| 830 switch (message.header.type) { | 857 switch (message.header.type) { |
| 831 case _nfcReceiverMethodOnReceivedNfcDataName: | 858 case _nfcReceiverMethodOnReceivedNfcDataName: |
| 832 var params = _NfcReceiverOnReceivedNfcDataParams.deserialize( | 859 var params = _NfcReceiverOnReceivedNfcDataParams.deserialize( |
| 833 message.payload); | 860 message.payload); |
| 834 _impl.onReceivedNfcData(params.nfcData); | 861 _impl.onReceivedNfcData(params.nfcData); |
| 835 break; | 862 break; |
| 836 default: | 863 default: |
| 837 throw new bindings.MojoCodecError("Unexpected message name"); | 864 throw new bindings.MojoCodecError("Unexpected message name"); |
| 838 break; | 865 break; |
| 839 } | 866 } |
| 840 return null; | 867 return null; |
| 841 } | 868 } |
| 842 | 869 |
| 843 NfcReceiver get impl => _impl; | 870 NfcReceiver get impl => _impl; |
| 844 set impl(NfcReceiver d) { | 871 set impl(NfcReceiver d) { |
| 845 assert(_impl == null); | 872 if (d == null) { |
| 873 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 874 } |
| 875 if (isBound && (_impl == null)) { |
| 876 beginHandlingEvents(); |
| 877 } |
| 846 _impl = d; | 878 _impl = d; |
| 847 } | 879 } |
| 848 | 880 |
| 881 @override |
| 882 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 883 super.bind(endpoint); |
| 884 if (!isOpen && (_impl != null)) { |
| 885 beginHandlingEvents(); |
| 886 } |
| 887 } |
| 888 |
| 849 String toString() { | 889 String toString() { |
| 850 var superString = super.toString(); | 890 var superString = super.toString(); |
| 851 return "NfcReceiverStub($superString)"; | 891 return "NfcReceiverStub($superString)"; |
| 852 } | 892 } |
| 853 | 893 |
| 854 int get version => 0; | 894 int get version => 0; |
| 855 | 895 |
| 856 static service_describer.ServiceDescription _cachedServiceDescription; | 896 static service_describer.ServiceDescription _cachedServiceDescription; |
| 857 static service_describer.ServiceDescription get serviceDescription { | 897 static service_describer.ServiceDescription get serviceDescription { |
| 858 if (_cachedServiceDescription == null) { | 898 if (_cachedServiceDescription == null) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 impl.requireVersion(requiredVersion); | 1065 impl.requireVersion(requiredVersion); |
| 1026 } | 1066 } |
| 1027 | 1067 |
| 1028 String toString() { | 1068 String toString() { |
| 1029 return "NfcProxy($impl)"; | 1069 return "NfcProxy($impl)"; |
| 1030 } | 1070 } |
| 1031 } | 1071 } |
| 1032 | 1072 |
| 1033 | 1073 |
| 1034 class NfcStub extends bindings.Stub { | 1074 class NfcStub extends bindings.Stub { |
| 1035 Nfc _impl = null; | 1075 Nfc _impl; |
| 1036 | 1076 |
| 1037 NfcStub.fromEndpoint( | 1077 NfcStub.fromEndpoint( |
| 1038 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 1078 core.MojoMessagePipeEndpoint endpoint, [Nfc impl]) |
| 1039 : super.fromEndpoint(endpoint); | 1079 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 1080 _impl = impl; |
| 1081 } |
| 1040 | 1082 |
| 1041 NfcStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1083 NfcStub.fromHandle( |
| 1042 : super.fromHandle(handle); | 1084 core.MojoHandle handle, [Nfc impl]) |
| 1085 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1086 _impl = impl; |
| 1087 } |
| 1043 | 1088 |
| 1044 NfcStub.unbound() : super.unbound(); | 1089 NfcStub.unbound() : super.unbound(); |
| 1045 | 1090 |
| 1046 static NfcStub newFromEndpoint( | 1091 static NfcStub newFromEndpoint( |
| 1047 core.MojoMessagePipeEndpoint endpoint) { | 1092 core.MojoMessagePipeEndpoint endpoint) { |
| 1048 assert(endpoint.setDescription("For NfcStub")); | 1093 assert(endpoint.setDescription("For NfcStub")); |
| 1049 return new NfcStub.fromEndpoint(endpoint); | 1094 return new NfcStub.fromEndpoint(endpoint); |
| 1050 } | 1095 } |
| 1051 | 1096 |
| 1052 | 1097 |
| 1053 NfcTransmitOnNextConnectionResponseParams _nfcTransmitOnNextConnectionResponse
ParamsFactory(bool success) { | 1098 NfcTransmitOnNextConnectionResponseParams _nfcTransmitOnNextConnectionResponse
ParamsFactory(bool success) { |
| 1054 var result = new NfcTransmitOnNextConnectionResponseParams(); | 1099 var result = new NfcTransmitOnNextConnectionResponseParams(); |
| 1055 result.success = success; | 1100 result.success = success; |
| 1056 return result; | 1101 return result; |
| 1057 } | 1102 } |
| 1058 | 1103 |
| 1059 dynamic handleMessage(bindings.ServiceMessage message) { | 1104 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1060 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1105 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1061 return bindings.ControlMessageHandler.handleMessage(this, | 1106 return bindings.ControlMessageHandler.handleMessage(this, |
| 1062 0, | 1107 0, |
| 1063 message); | 1108 message); |
| 1064 } | 1109 } |
| 1065 assert(_impl != null); | 1110 if (_impl == null) { |
| 1111 throw new core.MojoApiError("$this has no implementation set"); |
| 1112 } |
| 1066 switch (message.header.type) { | 1113 switch (message.header.type) { |
| 1067 case _nfcMethodTransmitOnNextConnectionName: | 1114 case _nfcMethodTransmitOnNextConnectionName: |
| 1068 var params = _NfcTransmitOnNextConnectionParams.deserialize( | 1115 var params = _NfcTransmitOnNextConnectionParams.deserialize( |
| 1069 message.payload); | 1116 message.payload); |
| 1070 var response = _impl.transmitOnNextConnection(params.nfcData,params.tran
smission,_nfcTransmitOnNextConnectionResponseParamsFactory); | 1117 var response = _impl.transmitOnNextConnection(params.nfcData,params.tran
smission,_nfcTransmitOnNextConnectionResponseParamsFactory); |
| 1071 if (response is Future) { | 1118 if (response is Future) { |
| 1072 return response.then((response) { | 1119 return response.then((response) { |
| 1073 if (response != null) { | 1120 if (response != null) { |
| 1074 return buildResponseWithId( | 1121 return buildResponseWithId( |
| 1075 response, | 1122 response, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1094 break; | 1141 break; |
| 1095 default: | 1142 default: |
| 1096 throw new bindings.MojoCodecError("Unexpected message name"); | 1143 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1097 break; | 1144 break; |
| 1098 } | 1145 } |
| 1099 return null; | 1146 return null; |
| 1100 } | 1147 } |
| 1101 | 1148 |
| 1102 Nfc get impl => _impl; | 1149 Nfc get impl => _impl; |
| 1103 set impl(Nfc d) { | 1150 set impl(Nfc d) { |
| 1104 assert(_impl == null); | 1151 if (d == null) { |
| 1152 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1153 } |
| 1154 if (isBound && (_impl == null)) { |
| 1155 beginHandlingEvents(); |
| 1156 } |
| 1105 _impl = d; | 1157 _impl = d; |
| 1106 } | 1158 } |
| 1107 | 1159 |
| 1160 @override |
| 1161 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1162 super.bind(endpoint); |
| 1163 if (!isOpen && (_impl != null)) { |
| 1164 beginHandlingEvents(); |
| 1165 } |
| 1166 } |
| 1167 |
| 1108 String toString() { | 1168 String toString() { |
| 1109 var superString = super.toString(); | 1169 var superString = super.toString(); |
| 1110 return "NfcStub($superString)"; | 1170 return "NfcStub($superString)"; |
| 1111 } | 1171 } |
| 1112 | 1172 |
| 1113 int get version => 0; | 1173 int get version => 0; |
| 1114 | 1174 |
| 1115 static service_describer.ServiceDescription _cachedServiceDescription; | 1175 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1116 static service_describer.ServiceDescription get serviceDescription { | 1176 static service_describer.ServiceDescription get serviceDescription { |
| 1117 if (_cachedServiceDescription == null) { | 1177 if (_cachedServiceDescription == null) { |
| 1118 _cachedServiceDescription = new _NfcServiceDescription(); | 1178 _cachedServiceDescription = new _NfcServiceDescription(); |
| 1119 } | 1179 } |
| 1120 return _cachedServiceDescription; | 1180 return _cachedServiceDescription; |
| 1121 } | 1181 } |
| 1122 } | 1182 } |
| 1123 | 1183 |
| 1124 | 1184 |
| 1125 | 1185 |
| OLD | NEW |