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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/geocoder.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 geocoder_mojom; 4 library geocoder_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_services/mojo/location.mojom.dart' as location_mojom; 9 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom;
10 10
11 11
12 12
13 class LocationType extends bindings.Struct { 13 class LocationType extends bindings.Struct {
14 static const List<bindings.StructDataHeader> kVersions = const [ 14 static const List<bindings.StructDataHeader> kVersions = const [
15 const bindings.StructDataHeader(8, 0) 15 const bindings.StructDataHeader(8, 0)
16 ]; 16 ];
17 static const String rooftop = "ROOFTOP"; 17 static const String rooftop = "ROOFTOP";
18 static const String rangeInterpolated = "RANGE_INTERPOLATED"; 18 static const String rangeInterpolated = "RANGE_INTERPOLATED";
19 static const String geometricCenter = "GEOMETRIC_CENTER"; 19 static const String geometricCenter = "GEOMETRIC_CENTER";
20 static const String approximate = "APPROXIMATE"; 20 static const String approximate = "APPROXIMATE";
21 21
22 LocationType() : super(kVersions.last.size); 22 LocationType() : super(kVersions.last.size);
23 23
24 LocationType.init(
25 ) : super(kVersions.last.size);
26
24 static LocationType deserialize(bindings.Message message) { 27 static LocationType deserialize(bindings.Message message) {
25 var decoder = new bindings.Decoder(message); 28 var decoder = new bindings.Decoder(message);
26 var result = decode(decoder); 29 var result = decode(decoder);
27 if (decoder.excessHandles != null) { 30 if (decoder.excessHandles != null) {
28 decoder.excessHandles.forEach((h) => h.close()); 31 decoder.excessHandles.forEach((h) => h.close());
29 } 32 }
30 return result; 33 return result;
31 } 34 }
32 35
33 static LocationType decode(bindings.Decoder decoder0) { 36 static LocationType decode(bindings.Decoder decoder0) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 77
75 class Bounds extends bindings.Struct { 78 class Bounds extends bindings.Struct {
76 static const List<bindings.StructDataHeader> kVersions = const [ 79 static const List<bindings.StructDataHeader> kVersions = const [
77 const bindings.StructDataHeader(24, 0) 80 const bindings.StructDataHeader(24, 0)
78 ]; 81 ];
79 location_mojom.Location northeast = null; 82 location_mojom.Location northeast = null;
80 location_mojom.Location southwest = null; 83 location_mojom.Location southwest = null;
81 84
82 Bounds() : super(kVersions.last.size); 85 Bounds() : super(kVersions.last.size);
83 86
87 Bounds.init(
88 location_mojom.Location this.northeast,
89 location_mojom.Location this.southwest
90 ) : super(kVersions.last.size);
91
84 static Bounds deserialize(bindings.Message message) { 92 static Bounds deserialize(bindings.Message message) {
85 var decoder = new bindings.Decoder(message); 93 var decoder = new bindings.Decoder(message);
86 var result = decode(decoder); 94 var result = decode(decoder);
87 if (decoder.excessHandles != null) { 95 if (decoder.excessHandles != null) {
88 decoder.excessHandles.forEach((h) => h.close()); 96 decoder.excessHandles.forEach((h) => h.close());
89 } 97 }
90 return result; 98 return result;
91 } 99 }
92 100
93 static Bounds decode(bindings.Decoder decoder0) { 101 static Bounds decode(bindings.Decoder decoder0) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 const bindings.StructDataHeader(48, 0) 173 const bindings.StructDataHeader(48, 0)
166 ]; 174 ];
167 String administrativeArea = null; 175 String administrativeArea = null;
168 String country = null; 176 String country = null;
169 String locality = null; 177 String locality = null;
170 String postalCode = null; 178 String postalCode = null;
171 String route = null; 179 String route = null;
172 180
173 ComponentRestrictions() : super(kVersions.last.size); 181 ComponentRestrictions() : super(kVersions.last.size);
174 182
183 ComponentRestrictions.init(
184 String this.administrativeArea,
185 String this.country,
186 String this.locality,
187 String this.postalCode,
188 String this.route
189 ) : super(kVersions.last.size);
190
175 static ComponentRestrictions deserialize(bindings.Message message) { 191 static ComponentRestrictions deserialize(bindings.Message message) {
176 var decoder = new bindings.Decoder(message); 192 var decoder = new bindings.Decoder(message);
177 var result = decode(decoder); 193 var result = decode(decoder);
178 if (decoder.excessHandles != null) { 194 if (decoder.excessHandles != null) {
179 decoder.excessHandles.forEach((h) => h.close()); 195 decoder.excessHandles.forEach((h) => h.close());
180 } 196 }
181 return result; 197 return result;
182 } 198 }
183 199
184 static ComponentRestrictions decode(bindings.Decoder decoder0) { 200 static ComponentRestrictions decode(bindings.Decoder decoder0) {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 class Options extends bindings.Struct { 307 class Options extends bindings.Struct {
292 static const List<bindings.StructDataHeader> kVersions = const [ 308 static const List<bindings.StructDataHeader> kVersions = const [
293 const bindings.StructDataHeader(32, 0) 309 const bindings.StructDataHeader(32, 0)
294 ]; 310 ];
295 ComponentRestrictions restrictions = null; 311 ComponentRestrictions restrictions = null;
296 location_mojom.Location location = null; 312 location_mojom.Location location = null;
297 String region = null; 313 String region = null;
298 314
299 Options() : super(kVersions.last.size); 315 Options() : super(kVersions.last.size);
300 316
317 Options.init(
318 ComponentRestrictions this.restrictions,
319 location_mojom.Location this.location,
320 String this.region
321 ) : super(kVersions.last.size);
322
301 static Options deserialize(bindings.Message message) { 323 static Options deserialize(bindings.Message message) {
302 var decoder = new bindings.Decoder(message); 324 var decoder = new bindings.Decoder(message);
303 var result = decode(decoder); 325 var result = decode(decoder);
304 if (decoder.excessHandles != null) { 326 if (decoder.excessHandles != null) {
305 decoder.excessHandles.forEach((h) => h.close()); 327 decoder.excessHandles.forEach((h) => h.close());
306 } 328 }
307 return result; 329 return result;
308 } 330 }
309 331
310 static Options decode(bindings.Decoder decoder0) { 332 static Options decode(bindings.Decoder decoder0) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 static const List<bindings.StructDataHeader> kVersions = const [ 416 static const List<bindings.StructDataHeader> kVersions = const [
395 const bindings.StructDataHeader(40, 0) 417 const bindings.StructDataHeader(40, 0)
396 ]; 418 ];
397 location_mojom.Location location = null; 419 location_mojom.Location location = null;
398 LocationType locationType = null; 420 LocationType locationType = null;
399 Bounds viewport = null; 421 Bounds viewport = null;
400 Bounds bounds = null; 422 Bounds bounds = null;
401 423
402 Geometry() : super(kVersions.last.size); 424 Geometry() : super(kVersions.last.size);
403 425
426 Geometry.init(
427 location_mojom.Location this.location,
428 LocationType this.locationType,
429 Bounds this.viewport,
430 Bounds this.bounds
431 ) : super(kVersions.last.size);
432
404 static Geometry deserialize(bindings.Message message) { 433 static Geometry deserialize(bindings.Message message) {
405 var decoder = new bindings.Decoder(message); 434 var decoder = new bindings.Decoder(message);
406 var result = decode(decoder); 435 var result = decode(decoder);
407 if (decoder.excessHandles != null) { 436 if (decoder.excessHandles != null) {
408 decoder.excessHandles.forEach((h) => h.close()); 437 decoder.excessHandles.forEach((h) => h.close());
409 } 438 }
410 return result; 439 return result;
411 } 440 }
412 441
413 static Geometry decode(bindings.Decoder decoder0) { 442 static Geometry decode(bindings.Decoder decoder0) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 static const List<bindings.StructDataHeader> kVersions = const [ 541 static const List<bindings.StructDataHeader> kVersions = const [
513 const bindings.StructDataHeader(40, 0) 542 const bindings.StructDataHeader(40, 0)
514 ]; 543 ];
515 bool partialMatch = false; 544 bool partialMatch = false;
516 Geometry geometry = null; 545 Geometry geometry = null;
517 String formattedAddress = null; 546 String formattedAddress = null;
518 List<String> types = null; 547 List<String> types = null;
519 548
520 Result() : super(kVersions.last.size); 549 Result() : super(kVersions.last.size);
521 550
551 Result.init(
552 bool this.partialMatch,
553 Geometry this.geometry,
554 String this.formattedAddress,
555 List<String> this.types
556 ) : super(kVersions.last.size);
557
522 static Result deserialize(bindings.Message message) { 558 static Result deserialize(bindings.Message message) {
523 var decoder = new bindings.Decoder(message); 559 var decoder = new bindings.Decoder(message);
524 var result = decode(decoder); 560 var result = decode(decoder);
525 if (decoder.excessHandles != null) { 561 if (decoder.excessHandles != null) {
526 decoder.excessHandles.forEach((h) => h.close()); 562 decoder.excessHandles.forEach((h) => h.close());
527 } 563 }
528 return result; 564 return result;
529 } 565 }
530 566
531 static Result decode(bindings.Decoder decoder0) { 567 static Result decode(bindings.Decoder decoder0) {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 const bindings.StructDataHeader(8, 0) 679 const bindings.StructDataHeader(8, 0)
644 ]; 680 ];
645 static const String ok = "OK"; 681 static const String ok = "OK";
646 static const String zeroResults = "ZERO_RESULTS"; 682 static const String zeroResults = "ZERO_RESULTS";
647 static const String overQueryLimit = "OVER_QUERY_LIMIT"; 683 static const String overQueryLimit = "OVER_QUERY_LIMIT";
648 static const String requestDenied = "REQUEST_DENIED"; 684 static const String requestDenied = "REQUEST_DENIED";
649 static const String invalidRequest = "INVALID_REQUEST"; 685 static const String invalidRequest = "INVALID_REQUEST";
650 686
651 Status() : super(kVersions.last.size); 687 Status() : super(kVersions.last.size);
652 688
689 Status.init(
690 ) : super(kVersions.last.size);
691
653 static Status deserialize(bindings.Message message) { 692 static Status deserialize(bindings.Message message) {
654 var decoder = new bindings.Decoder(message); 693 var decoder = new bindings.Decoder(message);
655 var result = decode(decoder); 694 var result = decode(decoder);
656 if (decoder.excessHandles != null) { 695 if (decoder.excessHandles != null) {
657 decoder.excessHandles.forEach((h) => h.close()); 696 decoder.excessHandles.forEach((h) => h.close());
658 } 697 }
659 return result; 698 return result;
660 } 699 }
661 700
662 static Status decode(bindings.Decoder decoder0) { 701 static Status decode(bindings.Decoder decoder0) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 742
704 class _GeocoderAddressToLocationParams extends bindings.Struct { 743 class _GeocoderAddressToLocationParams extends bindings.Struct {
705 static const List<bindings.StructDataHeader> kVersions = const [ 744 static const List<bindings.StructDataHeader> kVersions = const [
706 const bindings.StructDataHeader(24, 0) 745 const bindings.StructDataHeader(24, 0)
707 ]; 746 ];
708 String address = null; 747 String address = null;
709 Options options = null; 748 Options options = null;
710 749
711 _GeocoderAddressToLocationParams() : super(kVersions.last.size); 750 _GeocoderAddressToLocationParams() : super(kVersions.last.size);
712 751
752 _GeocoderAddressToLocationParams.init(
753 String this.address,
754 Options this.options
755 ) : super(kVersions.last.size);
756
713 static _GeocoderAddressToLocationParams deserialize(bindings.Message message) { 757 static _GeocoderAddressToLocationParams deserialize(bindings.Message message) {
714 var decoder = new bindings.Decoder(message); 758 var decoder = new bindings.Decoder(message);
715 var result = decode(decoder); 759 var result = decode(decoder);
716 if (decoder.excessHandles != null) { 760 if (decoder.excessHandles != null) {
717 decoder.excessHandles.forEach((h) => h.close()); 761 decoder.excessHandles.forEach((h) => h.close());
718 } 762 }
719 return result; 763 return result;
720 } 764 }
721 765
722 static _GeocoderAddressToLocationParams decode(bindings.Decoder decoder0) { 766 static _GeocoderAddressToLocationParams decode(bindings.Decoder decoder0) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 834
791 class GeocoderAddressToLocationResponseParams extends bindings.Struct { 835 class GeocoderAddressToLocationResponseParams extends bindings.Struct {
792 static const List<bindings.StructDataHeader> kVersions = const [ 836 static const List<bindings.StructDataHeader> kVersions = const [
793 const bindings.StructDataHeader(24, 0) 837 const bindings.StructDataHeader(24, 0)
794 ]; 838 ];
795 String status = null; 839 String status = null;
796 List<Result> results = null; 840 List<Result> results = null;
797 841
798 GeocoderAddressToLocationResponseParams() : super(kVersions.last.size); 842 GeocoderAddressToLocationResponseParams() : super(kVersions.last.size);
799 843
844 GeocoderAddressToLocationResponseParams.init(
845 String this.status,
846 List<Result> this.results
847 ) : super(kVersions.last.size);
848
800 static GeocoderAddressToLocationResponseParams deserialize(bindings.Message me ssage) { 849 static GeocoderAddressToLocationResponseParams deserialize(bindings.Message me ssage) {
801 var decoder = new bindings.Decoder(message); 850 var decoder = new bindings.Decoder(message);
802 var result = decode(decoder); 851 var result = decode(decoder);
803 if (decoder.excessHandles != null) { 852 if (decoder.excessHandles != null) {
804 decoder.excessHandles.forEach((h) => h.close()); 853 decoder.excessHandles.forEach((h) => h.close());
805 } 854 }
806 return result; 855 return result;
807 } 856 }
808 857
809 static GeocoderAddressToLocationResponseParams decode(bindings.Decoder decoder 0) { 858 static GeocoderAddressToLocationResponseParams decode(bindings.Decoder decoder 0) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
894 943
895 class _GeocoderLocationToAddressParams extends bindings.Struct { 944 class _GeocoderLocationToAddressParams extends bindings.Struct {
896 static const List<bindings.StructDataHeader> kVersions = const [ 945 static const List<bindings.StructDataHeader> kVersions = const [
897 const bindings.StructDataHeader(24, 0) 946 const bindings.StructDataHeader(24, 0)
898 ]; 947 ];
899 location_mojom.Location location = null; 948 location_mojom.Location location = null;
900 Options options = null; 949 Options options = null;
901 950
902 _GeocoderLocationToAddressParams() : super(kVersions.last.size); 951 _GeocoderLocationToAddressParams() : super(kVersions.last.size);
903 952
953 _GeocoderLocationToAddressParams.init(
954 location_mojom.Location this.location,
955 Options this.options
956 ) : super(kVersions.last.size);
957
904 static _GeocoderLocationToAddressParams deserialize(bindings.Message message) { 958 static _GeocoderLocationToAddressParams deserialize(bindings.Message message) {
905 var decoder = new bindings.Decoder(message); 959 var decoder = new bindings.Decoder(message);
906 var result = decode(decoder); 960 var result = decode(decoder);
907 if (decoder.excessHandles != null) { 961 if (decoder.excessHandles != null) {
908 decoder.excessHandles.forEach((h) => h.close()); 962 decoder.excessHandles.forEach((h) => h.close());
909 } 963 }
910 return result; 964 return result;
911 } 965 }
912 966
913 static _GeocoderLocationToAddressParams decode(bindings.Decoder decoder0) { 967 static _GeocoderLocationToAddressParams decode(bindings.Decoder decoder0) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 1036
983 class GeocoderLocationToAddressResponseParams extends bindings.Struct { 1037 class GeocoderLocationToAddressResponseParams extends bindings.Struct {
984 static const List<bindings.StructDataHeader> kVersions = const [ 1038 static const List<bindings.StructDataHeader> kVersions = const [
985 const bindings.StructDataHeader(24, 0) 1039 const bindings.StructDataHeader(24, 0)
986 ]; 1040 ];
987 String status = null; 1041 String status = null;
988 List<Result> results = null; 1042 List<Result> results = null;
989 1043
990 GeocoderLocationToAddressResponseParams() : super(kVersions.last.size); 1044 GeocoderLocationToAddressResponseParams() : super(kVersions.last.size);
991 1045
1046 GeocoderLocationToAddressResponseParams.init(
1047 String this.status,
1048 List<Result> this.results
1049 ) : super(kVersions.last.size);
1050
992 static GeocoderLocationToAddressResponseParams deserialize(bindings.Message me ssage) { 1051 static GeocoderLocationToAddressResponseParams deserialize(bindings.Message me ssage) {
993 var decoder = new bindings.Decoder(message); 1052 var decoder = new bindings.Decoder(message);
994 var result = decode(decoder); 1053 var result = decode(decoder);
995 if (decoder.excessHandles != null) { 1054 if (decoder.excessHandles != null) {
996 decoder.excessHandles.forEach((h) => h.close()); 1055 decoder.excessHandles.forEach((h) => h.close());
997 } 1056 }
998 return result; 1057 return result;
999 } 1058 }
1000 1059
1001 static GeocoderLocationToAddressResponseParams decode(bindings.Decoder decoder 0) { 1060 static GeocoderLocationToAddressResponseParams decode(bindings.Decoder decoder 0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 map["status"] = status; 1139 map["status"] = status;
1081 map["results"] = results; 1140 map["results"] = results;
1082 return map; 1141 return map;
1083 } 1142 }
1084 } 1143 }
1085 1144
1086 const int _geocoderMethodAddressToLocationName = 0; 1145 const int _geocoderMethodAddressToLocationName = 0;
1087 const int _geocoderMethodLocationToAddressName = 1; 1146 const int _geocoderMethodLocationToAddressName = 1;
1088 1147
1089 class _GeocoderServiceDescription implements service_describer.ServiceDescriptio n { 1148 class _GeocoderServiceDescription implements service_describer.ServiceDescriptio n {
1090 dynamic getTopLevelInterface([Function responseFactory]) => 1149 void getTopLevelInterface(Function responder) {
1091 responseFactory(null); 1150 responder(null);
1151 }
1092 1152
1093 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 1153 void getTypeDefinition(String typeKey, Function responder) {
1094 responseFactory(null); 1154 responder(null);
1155 }
1095 1156
1096 dynamic getAllTypeDefinitions([Function responseFactory]) => 1157 void getAllTypeDefinitions(Function responder) {
1097 responseFactory(null); 1158 responder(null);
1159 }
1098 } 1160 }
1099 1161
1100 abstract class Geocoder { 1162 abstract class Geocoder {
1101 static const String serviceName = null; 1163 static const String serviceName = null;
1102 1164
1103 static service_describer.ServiceDescription _cachedServiceDescription; 1165 static service_describer.ServiceDescription _cachedServiceDescription;
1104 static service_describer.ServiceDescription get serviceDescription { 1166 static service_describer.ServiceDescription get serviceDescription {
1105 if (_cachedServiceDescription == null) { 1167 if (_cachedServiceDescription == null) {
1106 _cachedServiceDescription = new _GeocoderServiceDescription(); 1168 _cachedServiceDescription = new _GeocoderServiceDescription();
1107 } 1169 }
1108 return _cachedServiceDescription; 1170 return _cachedServiceDescription;
1109 } 1171 }
1110 1172
1111 static GeocoderProxy connectToService( 1173 static GeocoderProxy connectToService(
1112 bindings.ServiceConnector s, String url, [String serviceName]) { 1174 bindings.ServiceConnector s, String url, [String serviceName]) {
1113 GeocoderProxy p = new GeocoderProxy.unbound(); 1175 GeocoderProxy p = new GeocoderProxy.unbound();
1114 String name = serviceName ?? Geocoder.serviceName; 1176 String name = serviceName ?? Geocoder.serviceName;
1115 if ((name == null) || name.isEmpty) { 1177 if ((name == null) || name.isEmpty) {
1116 throw new core.MojoApiError( 1178 throw new core.MojoApiError(
1117 "If an interface has no ServiceName, then one must be provided."); 1179 "If an interface has no ServiceName, then one must be provided.");
1118 } 1180 }
1119 s.connectToService(url, p, name); 1181 s.connectToService(url, p, name);
1120 return p; 1182 return p;
1121 } 1183 }
1122 dynamic addressToLocation(String address,Options options,[Function responseFac tory = null]); 1184 void addressToLocation(String address,Options options,void callback(String sta tus, List<Result> results));
1123 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu nction responseFactory = null]); 1185 void locationToAddress(location_mojom.Location location,Options options,void c allback(String status, List<Result> results));
1124 } 1186 }
1125 1187
1126 abstract class GeocoderInterface 1188 abstract class GeocoderInterface
1127 implements bindings.MojoInterface<Geocoder>, 1189 implements bindings.MojoInterface<Geocoder>,
1128 Geocoder { 1190 Geocoder {
1129 factory GeocoderInterface([Geocoder impl]) => 1191 factory GeocoderInterface([Geocoder impl]) =>
1130 new GeocoderStub.unbound(impl); 1192 new GeocoderStub.unbound(impl);
1131 1193
1132 factory GeocoderInterface.fromEndpoint( 1194 factory GeocoderInterface.fromEndpoint(
1133 core.MojoMessagePipeEndpoint endpoint, 1195 core.MojoMessagePipeEndpoint endpoint,
(...skipping 29 matching lines...) Expand all
1163 1225
1164 void handleResponse(bindings.ServiceMessage message) { 1226 void handleResponse(bindings.ServiceMessage message) {
1165 switch (message.header.type) { 1227 switch (message.header.type) {
1166 case _geocoderMethodAddressToLocationName: 1228 case _geocoderMethodAddressToLocationName:
1167 var r = GeocoderAddressToLocationResponseParams.deserialize( 1229 var r = GeocoderAddressToLocationResponseParams.deserialize(
1168 message.payload); 1230 message.payload);
1169 if (!message.header.hasRequestId) { 1231 if (!message.header.hasRequestId) {
1170 proxyError("Expected a message with a valid request Id."); 1232 proxyError("Expected a message with a valid request Id.");
1171 return; 1233 return;
1172 } 1234 }
1173 Completer c = completerMap[message.header.requestId]; 1235 Function callback = callbackMap[message.header.requestId];
1174 if (c == null) { 1236 if (callback == null) {
1175 proxyError( 1237 proxyError(
1176 "Message had unknown request Id: ${message.header.requestId}"); 1238 "Message had unknown request Id: ${message.header.requestId}");
1177 return; 1239 return;
1178 } 1240 }
1179 completerMap.remove(message.header.requestId); 1241 callbackMap.remove(message.header.requestId);
1180 if (c.isCompleted) { 1242 callback(r.status , r.results );
1181 proxyError("Response completer already completed");
1182 return;
1183 }
1184 c.complete(r);
1185 break; 1243 break;
1186 case _geocoderMethodLocationToAddressName: 1244 case _geocoderMethodLocationToAddressName:
1187 var r = GeocoderLocationToAddressResponseParams.deserialize( 1245 var r = GeocoderLocationToAddressResponseParams.deserialize(
1188 message.payload); 1246 message.payload);
1189 if (!message.header.hasRequestId) { 1247 if (!message.header.hasRequestId) {
1190 proxyError("Expected a message with a valid request Id."); 1248 proxyError("Expected a message with a valid request Id.");
1191 return; 1249 return;
1192 } 1250 }
1193 Completer c = completerMap[message.header.requestId]; 1251 Function callback = callbackMap[message.header.requestId];
1194 if (c == null) { 1252 if (callback == null) {
1195 proxyError( 1253 proxyError(
1196 "Message had unknown request Id: ${message.header.requestId}"); 1254 "Message had unknown request Id: ${message.header.requestId}");
1197 return; 1255 return;
1198 } 1256 }
1199 completerMap.remove(message.header.requestId); 1257 callbackMap.remove(message.header.requestId);
1200 if (c.isCompleted) { 1258 callback(r.status , r.results );
1201 proxyError("Response completer already completed");
1202 return;
1203 }
1204 c.complete(r);
1205 break; 1259 break;
1206 default: 1260 default:
1207 proxyError("Unexpected message type: ${message.header.type}"); 1261 proxyError("Unexpected message type: ${message.header.type}");
1208 close(immediate: true); 1262 close(immediate: true);
1209 break; 1263 break;
1210 } 1264 }
1211 } 1265 }
1212 1266
1213 @override 1267 @override
1214 String toString() { 1268 String toString() {
(...skipping 24 matching lines...) Expand all
1239 return newMockedProxy; 1293 return newMockedProxy;
1240 } 1294 }
1241 1295
1242 static GeocoderProxy newFromEndpoint( 1296 static GeocoderProxy newFromEndpoint(
1243 core.MojoMessagePipeEndpoint endpoint) { 1297 core.MojoMessagePipeEndpoint endpoint) {
1244 assert(endpoint.setDescription("For GeocoderProxy")); 1298 assert(endpoint.setDescription("For GeocoderProxy"));
1245 return new GeocoderProxy.fromEndpoint(endpoint); 1299 return new GeocoderProxy.fromEndpoint(endpoint);
1246 } 1300 }
1247 1301
1248 1302
1249 dynamic addressToLocation(String address,Options options,[Function responseFac tory = null]) { 1303 void addressToLocation(String address,Options options,void callback(String sta tus, List<Result> results)) {
1250 if (impl != null) { 1304 if (impl != null) {
1251 return new Future(() => impl.addressToLocation(address,options,_GeocoderSt ubControl._geocoderAddressToLocationResponseParamsFactory)); 1305 impl.addressToLocation(address,options,callback);
1306 return;
1252 } 1307 }
1253 var params = new _GeocoderAddressToLocationParams(); 1308 var params = new _GeocoderAddressToLocationParams();
1254 params.address = address; 1309 params.address = address;
1255 params.options = options; 1310 params.options = options;
1256 return ctrl.sendMessageWithRequestId( 1311 ctrl.sendMessageWithRequestId(
1257 params, 1312 params,
1258 _geocoderMethodAddressToLocationName, 1313 _geocoderMethodAddressToLocationName,
1259 -1, 1314 -1,
1260 bindings.MessageHeader.kMessageExpectsResponse); 1315 bindings.MessageHeader.kMessageExpectsResponse,
1316 callback);
1261 } 1317 }
1262 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu nction responseFactory = null]) { 1318 void locationToAddress(location_mojom.Location location,Options options,void c allback(String status, List<Result> results)) {
1263 if (impl != null) { 1319 if (impl != null) {
1264 return new Future(() => impl.locationToAddress(location,options,_GeocoderS tubControl._geocoderLocationToAddressResponseParamsFactory)); 1320 impl.locationToAddress(location,options,callback);
1321 return;
1265 } 1322 }
1266 var params = new _GeocoderLocationToAddressParams(); 1323 var params = new _GeocoderLocationToAddressParams();
1267 params.location = location; 1324 params.location = location;
1268 params.options = options; 1325 params.options = options;
1269 return ctrl.sendMessageWithRequestId( 1326 ctrl.sendMessageWithRequestId(
1270 params, 1327 params,
1271 _geocoderMethodLocationToAddressName, 1328 _geocoderMethodLocationToAddressName,
1272 -1, 1329 -1,
1273 bindings.MessageHeader.kMessageExpectsResponse); 1330 bindings.MessageHeader.kMessageExpectsResponse,
1331 callback);
1274 } 1332 }
1275 } 1333 }
1276 1334
1277 class _GeocoderStubControl 1335 class _GeocoderStubControl
1278 extends bindings.StubMessageHandler 1336 extends bindings.StubMessageHandler
1279 implements bindings.StubControl<Geocoder> { 1337 implements bindings.StubControl<Geocoder> {
1280 Geocoder _impl; 1338 Geocoder _impl;
1281 1339
1282 _GeocoderStubControl.fromEndpoint( 1340 _GeocoderStubControl.fromEndpoint(
1283 core.MojoMessagePipeEndpoint endpoint, [Geocoder impl]) 1341 core.MojoMessagePipeEndpoint endpoint, [Geocoder impl])
1284 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1342 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1285 _impl = impl; 1343 _impl = impl;
1286 } 1344 }
1287 1345
1288 _GeocoderStubControl.fromHandle( 1346 _GeocoderStubControl.fromHandle(
1289 core.MojoHandle handle, [Geocoder impl]) 1347 core.MojoHandle handle, [Geocoder impl])
1290 : super.fromHandle(handle, autoBegin: impl != null) { 1348 : super.fromHandle(handle, autoBegin: impl != null) {
1291 _impl = impl; 1349 _impl = impl;
1292 } 1350 }
1293 1351
1294 _GeocoderStubControl.unbound([this._impl]) : super.unbound(); 1352 _GeocoderStubControl.unbound([this._impl]) : super.unbound();
1295 1353
1296 String get serviceName => Geocoder.serviceName; 1354 String get serviceName => Geocoder.serviceName;
1297 1355
1298 1356
1299 static GeocoderAddressToLocationResponseParams _geocoderAddressToLocationRespo nseParamsFactory(String status, List<Result> results) { 1357 Function _geocoderAddressToLocationResponseParamsResponder(
1300 var result = new GeocoderAddressToLocationResponseParams(); 1358 int requestId) {
1301 result.status = status; 1359 return (String status, List<Result> results) {
1302 result.results = results; 1360 var result = new GeocoderAddressToLocationResponseParams();
1303 return result; 1361 result.status = status;
1362 result.results = results;
1363 sendResponse(buildResponseWithId(
1364 result,
1365 _geocoderMethodAddressToLocationName,
1366 requestId,
1367 bindings.MessageHeader.kMessageIsResponse));
1368 };
1304 } 1369 }
1305 static GeocoderLocationToAddressResponseParams _geocoderLocationToAddressRespo nseParamsFactory(String status, List<Result> results) { 1370 Function _geocoderLocationToAddressResponseParamsResponder(
1306 var result = new GeocoderLocationToAddressResponseParams(); 1371 int requestId) {
1307 result.status = status; 1372 return (String status, List<Result> results) {
1308 result.results = results; 1373 var result = new GeocoderLocationToAddressResponseParams();
1309 return result; 1374 result.status = status;
1375 result.results = results;
1376 sendResponse(buildResponseWithId(
1377 result,
1378 _geocoderMethodLocationToAddressName,
1379 requestId,
1380 bindings.MessageHeader.kMessageIsResponse));
1381 };
1310 } 1382 }
1311 1383
1312 dynamic handleMessage(bindings.ServiceMessage message) { 1384 void handleMessage(bindings.ServiceMessage message) {
1313 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1385 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1314 return bindings.ControlMessageHandler.handleMessage(this, 1386 bindings.ControlMessageHandler.handleMessage(
1315 0, 1387 this, 0, message);
1316 message); 1388 return;
1317 } 1389 }
1318 if (_impl == null) { 1390 if (_impl == null) {
1319 throw new core.MojoApiError("$this has no implementation set"); 1391 throw new core.MojoApiError("$this has no implementation set");
1320 } 1392 }
1321 switch (message.header.type) { 1393 switch (message.header.type) {
1322 case _geocoderMethodAddressToLocationName: 1394 case _geocoderMethodAddressToLocationName:
1323 var params = _GeocoderAddressToLocationParams.deserialize( 1395 var params = _GeocoderAddressToLocationParams.deserialize(
1324 message.payload); 1396 message.payload);
1325 var response = _impl.addressToLocation(params.address,params.options,_ge ocoderAddressToLocationResponseParamsFactory); 1397 _impl.addressToLocation(params.address, params.options, _geocoderAddress ToLocationResponseParamsResponder(message.header.requestId));
1326 if (response is Future) {
1327 return response.then((response) {
1328 if (response != null) {
1329 return buildResponseWithId(
1330 response,
1331 _geocoderMethodAddressToLocationName,
1332 message.header.requestId,
1333 bindings.MessageHeader.kMessageIsResponse);
1334 }
1335 });
1336 } else if (response != null) {
1337 return buildResponseWithId(
1338 response,
1339 _geocoderMethodAddressToLocationName,
1340 message.header.requestId,
1341 bindings.MessageHeader.kMessageIsResponse);
1342 }
1343 break; 1398 break;
1344 case _geocoderMethodLocationToAddressName: 1399 case _geocoderMethodLocationToAddressName:
1345 var params = _GeocoderLocationToAddressParams.deserialize( 1400 var params = _GeocoderLocationToAddressParams.deserialize(
1346 message.payload); 1401 message.payload);
1347 var response = _impl.locationToAddress(params.location,params.options,_g eocoderLocationToAddressResponseParamsFactory); 1402 _impl.locationToAddress(params.location, params.options, _geocoderLocati onToAddressResponseParamsResponder(message.header.requestId));
1348 if (response is Future) {
1349 return response.then((response) {
1350 if (response != null) {
1351 return buildResponseWithId(
1352 response,
1353 _geocoderMethodLocationToAddressName,
1354 message.header.requestId,
1355 bindings.MessageHeader.kMessageIsResponse);
1356 }
1357 });
1358 } else if (response != null) {
1359 return buildResponseWithId(
1360 response,
1361 _geocoderMethodLocationToAddressName,
1362 message.header.requestId,
1363 bindings.MessageHeader.kMessageIsResponse);
1364 }
1365 break; 1403 break;
1366 default: 1404 default:
1367 throw new bindings.MojoCodecError("Unexpected message name"); 1405 throw new bindings.MojoCodecError("Unexpected message name");
1368 break; 1406 break;
1369 } 1407 }
1370 return null;
1371 } 1408 }
1372 1409
1373 Geocoder get impl => _impl; 1410 Geocoder get impl => _impl;
1374 set impl(Geocoder d) { 1411 set impl(Geocoder d) {
1375 if (d == null) { 1412 if (d == null) {
1376 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1413 throw new core.MojoApiError("$this: Cannot set a null implementation");
1377 } 1414 }
1378 if (isBound && (_impl == null)) { 1415 if (isBound && (_impl == null)) {
1379 beginHandlingEvents(); 1416 beginHandlingEvents();
1380 } 1417 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 core.MojoHandle handle, [Geocoder impl]) 1451 core.MojoHandle handle, [Geocoder impl])
1415 : super(new _GeocoderStubControl.fromHandle(handle, impl)); 1452 : super(new _GeocoderStubControl.fromHandle(handle, impl));
1416 1453
1417 static GeocoderStub newFromEndpoint( 1454 static GeocoderStub newFromEndpoint(
1418 core.MojoMessagePipeEndpoint endpoint) { 1455 core.MojoMessagePipeEndpoint endpoint) {
1419 assert(endpoint.setDescription("For GeocoderStub")); 1456 assert(endpoint.setDescription("For GeocoderStub"));
1420 return new GeocoderStub.fromEndpoint(endpoint); 1457 return new GeocoderStub.fromEndpoint(endpoint);
1421 } 1458 }
1422 1459
1423 1460
1424 dynamic addressToLocation(String address,Options options,[Function responseFac tory = null]) { 1461 void addressToLocation(String address,Options options,void callback(String sta tus, List<Result> results)) {
1425 return impl.addressToLocation(address,options,responseFactory); 1462 return impl.addressToLocation(address,options,callback);
1426 } 1463 }
1427 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu nction responseFactory = null]) { 1464 void locationToAddress(location_mojom.Location location,Options options,void c allback(String status, List<Result> results)) {
1428 return impl.locationToAddress(location,options,responseFactory); 1465 return impl.locationToAddress(location,options,callback);
1429 } 1466 }
1430 } 1467 }
1431 1468
1432 1469
1433 1470
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698