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 geocoder_mojom; | 5 library geocoder_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_services/mojo/location.mojom.dart' as location_mojom; | 13 import 'package:mojo_services/mojo/location.mojom.dart' as location_mojom; |
12 | 14 |
13 | 15 |
14 | 16 |
15 class LocationType extends bindings.Struct { | 17 class LocationType extends bindings.Struct { |
16 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
17 const bindings.StructDataHeader(8, 0) | 19 const bindings.StructDataHeader(8, 0) |
18 ]; | 20 ]; |
19 static const String rooftop = "ROOFTOP"; | 21 static const String rooftop = "ROOFTOP"; |
20 static const String rangeInterpolated = "RANGE_INTERPOLATED"; | 22 static const String rangeInterpolated = "RANGE_INTERPOLATED"; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return "LocationType("")"; | 69 return "LocationType("")"; |
68 } | 70 } |
69 | 71 |
70 Map toJson() { | 72 Map toJson() { |
71 Map map = new Map(); | 73 Map map = new Map(); |
72 return map; | 74 return map; |
73 } | 75 } |
74 } | 76 } |
75 | 77 |
76 | 78 |
| 79 |
| 80 |
77 class Bounds extends bindings.Struct { | 81 class Bounds extends bindings.Struct { |
78 static const List<bindings.StructDataHeader> kVersions = const [ | 82 static const List<bindings.StructDataHeader> kVersions = const [ |
79 const bindings.StructDataHeader(24, 0) | 83 const bindings.StructDataHeader(24, 0) |
80 ]; | 84 ]; |
81 location_mojom.Location northeast = null; | 85 location_mojom.Location northeast = null; |
82 location_mojom.Location southwest = null; | 86 location_mojom.Location southwest = null; |
83 | 87 |
84 Bounds() : super(kVersions.last.size); | 88 Bounds() : super(kVersions.last.size); |
85 | 89 |
86 static Bounds deserialize(bindings.Message message) { | 90 static Bounds deserialize(bindings.Message message) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 149 |
146 Map toJson() { | 150 Map toJson() { |
147 Map map = new Map(); | 151 Map map = new Map(); |
148 map["northeast"] = northeast; | 152 map["northeast"] = northeast; |
149 map["southwest"] = southwest; | 153 map["southwest"] = southwest; |
150 return map; | 154 return map; |
151 } | 155 } |
152 } | 156 } |
153 | 157 |
154 | 158 |
| 159 |
| 160 |
155 class ComponentRestrictions extends bindings.Struct { | 161 class ComponentRestrictions extends bindings.Struct { |
156 static const List<bindings.StructDataHeader> kVersions = const [ | 162 static const List<bindings.StructDataHeader> kVersions = const [ |
157 const bindings.StructDataHeader(48, 0) | 163 const bindings.StructDataHeader(48, 0) |
158 ]; | 164 ]; |
159 String administrativeArea = null; | 165 String administrativeArea = null; |
160 String country = null; | 166 String country = null; |
161 String locality = null; | 167 String locality = null; |
162 String postalCode = null; | 168 String postalCode = null; |
163 String route = null; | 169 String route = null; |
164 | 170 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 map["administrativeArea"] = administrativeArea; | 254 map["administrativeArea"] = administrativeArea; |
249 map["country"] = country; | 255 map["country"] = country; |
250 map["locality"] = locality; | 256 map["locality"] = locality; |
251 map["postalCode"] = postalCode; | 257 map["postalCode"] = postalCode; |
252 map["route"] = route; | 258 map["route"] = route; |
253 return map; | 259 return map; |
254 } | 260 } |
255 } | 261 } |
256 | 262 |
257 | 263 |
| 264 |
| 265 |
258 class Options extends bindings.Struct { | 266 class Options extends bindings.Struct { |
259 static const List<bindings.StructDataHeader> kVersions = const [ | 267 static const List<bindings.StructDataHeader> kVersions = const [ |
260 const bindings.StructDataHeader(32, 0) | 268 const bindings.StructDataHeader(32, 0) |
261 ]; | 269 ]; |
262 ComponentRestrictions restrictions = null; | 270 ComponentRestrictions restrictions = null; |
263 location_mojom.Location location = null; | 271 location_mojom.Location location = null; |
264 String region = null; | 272 String region = null; |
265 | 273 |
266 Options() : super(kVersions.last.size); | 274 Options() : super(kVersions.last.size); |
267 | 275 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 Map toJson() { | 343 Map toJson() { |
336 Map map = new Map(); | 344 Map map = new Map(); |
337 map["restrictions"] = restrictions; | 345 map["restrictions"] = restrictions; |
338 map["location"] = location; | 346 map["location"] = location; |
339 map["region"] = region; | 347 map["region"] = region; |
340 return map; | 348 return map; |
341 } | 349 } |
342 } | 350 } |
343 | 351 |
344 | 352 |
| 353 |
| 354 |
345 class Geometry extends bindings.Struct { | 355 class Geometry extends bindings.Struct { |
346 static const List<bindings.StructDataHeader> kVersions = const [ | 356 static const List<bindings.StructDataHeader> kVersions = const [ |
347 const bindings.StructDataHeader(40, 0) | 357 const bindings.StructDataHeader(40, 0) |
348 ]; | 358 ]; |
349 location_mojom.Location location = null; | 359 location_mojom.Location location = null; |
350 LocationType locationType = null; | 360 LocationType locationType = null; |
351 Bounds viewport = null; | 361 Bounds viewport = null; |
352 Bounds bounds = null; | 362 Bounds bounds = null; |
353 | 363 |
354 Geometry() : super(kVersions.last.size); | 364 Geometry() : super(kVersions.last.size); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 Map map = new Map(); | 443 Map map = new Map(); |
434 map["location"] = location; | 444 map["location"] = location; |
435 map["locationType"] = locationType; | 445 map["locationType"] = locationType; |
436 map["viewport"] = viewport; | 446 map["viewport"] = viewport; |
437 map["bounds"] = bounds; | 447 map["bounds"] = bounds; |
438 return map; | 448 return map; |
439 } | 449 } |
440 } | 450 } |
441 | 451 |
442 | 452 |
| 453 |
| 454 |
443 class Result extends bindings.Struct { | 455 class Result extends bindings.Struct { |
444 static const List<bindings.StructDataHeader> kVersions = const [ | 456 static const List<bindings.StructDataHeader> kVersions = const [ |
445 const bindings.StructDataHeader(40, 0) | 457 const bindings.StructDataHeader(40, 0) |
446 ]; | 458 ]; |
447 bool partialMatch = false; | 459 bool partialMatch = false; |
448 Geometry geometry = null; | 460 Geometry geometry = null; |
449 String formattedAddress = null; | 461 String formattedAddress = null; |
450 List<String> types = null; | 462 List<String> types = null; |
451 | 463 |
452 Result() : super(kVersions.last.size); | 464 Result() : super(kVersions.last.size); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 Map map = new Map(); | 556 Map map = new Map(); |
545 map["partialMatch"] = partialMatch; | 557 map["partialMatch"] = partialMatch; |
546 map["geometry"] = geometry; | 558 map["geometry"] = geometry; |
547 map["formattedAddress"] = formattedAddress; | 559 map["formattedAddress"] = formattedAddress; |
548 map["types"] = types; | 560 map["types"] = types; |
549 return map; | 561 return map; |
550 } | 562 } |
551 } | 563 } |
552 | 564 |
553 | 565 |
| 566 |
| 567 |
554 class Status extends bindings.Struct { | 568 class Status extends bindings.Struct { |
555 static const List<bindings.StructDataHeader> kVersions = const [ | 569 static const List<bindings.StructDataHeader> kVersions = const [ |
556 const bindings.StructDataHeader(8, 0) | 570 const bindings.StructDataHeader(8, 0) |
557 ]; | 571 ]; |
558 static const String ok = "OK"; | 572 static const String ok = "OK"; |
559 static const String zeroResults = "ZERO_RESULTS"; | 573 static const String zeroResults = "ZERO_RESULTS"; |
560 static const String overQueryLimit = "OVER_QUERY_LIMIT"; | 574 static const String overQueryLimit = "OVER_QUERY_LIMIT"; |
561 static const String requestDenied = "REQUEST_DENIED"; | 575 static const String requestDenied = "REQUEST_DENIED"; |
562 static const String invalidRequest = "INVALID_REQUEST"; | 576 static const String invalidRequest = "INVALID_REQUEST"; |
563 | 577 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 return "Status("")"; | 621 return "Status("")"; |
608 } | 622 } |
609 | 623 |
610 Map toJson() { | 624 Map toJson() { |
611 Map map = new Map(); | 625 Map map = new Map(); |
612 return map; | 626 return map; |
613 } | 627 } |
614 } | 628 } |
615 | 629 |
616 | 630 |
| 631 |
| 632 |
617 class _GeocoderAddressToLocationParams extends bindings.Struct { | 633 class _GeocoderAddressToLocationParams extends bindings.Struct { |
618 static const List<bindings.StructDataHeader> kVersions = const [ | 634 static const List<bindings.StructDataHeader> kVersions = const [ |
619 const bindings.StructDataHeader(24, 0) | 635 const bindings.StructDataHeader(24, 0) |
620 ]; | 636 ]; |
621 String address = null; | 637 String address = null; |
622 Options options = null; | 638 Options options = null; |
623 | 639 |
624 _GeocoderAddressToLocationParams() : super(kVersions.last.size); | 640 _GeocoderAddressToLocationParams() : super(kVersions.last.size); |
625 | 641 |
626 static _GeocoderAddressToLocationParams deserialize(bindings.Message message)
{ | 642 static _GeocoderAddressToLocationParams deserialize(bindings.Message message)
{ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 700 |
685 Map toJson() { | 701 Map toJson() { |
686 Map map = new Map(); | 702 Map map = new Map(); |
687 map["address"] = address; | 703 map["address"] = address; |
688 map["options"] = options; | 704 map["options"] = options; |
689 return map; | 705 return map; |
690 } | 706 } |
691 } | 707 } |
692 | 708 |
693 | 709 |
| 710 |
| 711 |
694 class GeocoderAddressToLocationResponseParams extends bindings.Struct { | 712 class GeocoderAddressToLocationResponseParams extends bindings.Struct { |
695 static const List<bindings.StructDataHeader> kVersions = const [ | 713 static const List<bindings.StructDataHeader> kVersions = const [ |
696 const bindings.StructDataHeader(24, 0) | 714 const bindings.StructDataHeader(24, 0) |
697 ]; | 715 ]; |
698 String status = null; | 716 String status = null; |
699 List<Result> results = null; | 717 List<Result> results = null; |
700 | 718 |
701 GeocoderAddressToLocationResponseParams() : super(kVersions.last.size); | 719 GeocoderAddressToLocationResponseParams() : super(kVersions.last.size); |
702 | 720 |
703 static GeocoderAddressToLocationResponseParams deserialize(bindings.Message me
ssage) { | 721 static GeocoderAddressToLocationResponseParams deserialize(bindings.Message me
ssage) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 | 797 |
780 Map toJson() { | 798 Map toJson() { |
781 Map map = new Map(); | 799 Map map = new Map(); |
782 map["status"] = status; | 800 map["status"] = status; |
783 map["results"] = results; | 801 map["results"] = results; |
784 return map; | 802 return map; |
785 } | 803 } |
786 } | 804 } |
787 | 805 |
788 | 806 |
| 807 |
| 808 |
789 class _GeocoderLocationToAddressParams extends bindings.Struct { | 809 class _GeocoderLocationToAddressParams extends bindings.Struct { |
790 static const List<bindings.StructDataHeader> kVersions = const [ | 810 static const List<bindings.StructDataHeader> kVersions = const [ |
791 const bindings.StructDataHeader(24, 0) | 811 const bindings.StructDataHeader(24, 0) |
792 ]; | 812 ]; |
793 location_mojom.Location location = null; | 813 location_mojom.Location location = null; |
794 Options options = null; | 814 Options options = null; |
795 | 815 |
796 _GeocoderLocationToAddressParams() : super(kVersions.last.size); | 816 _GeocoderLocationToAddressParams() : super(kVersions.last.size); |
797 | 817 |
798 static _GeocoderLocationToAddressParams deserialize(bindings.Message message)
{ | 818 static _GeocoderLocationToAddressParams deserialize(bindings.Message message)
{ |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 | 877 |
858 Map toJson() { | 878 Map toJson() { |
859 Map map = new Map(); | 879 Map map = new Map(); |
860 map["location"] = location; | 880 map["location"] = location; |
861 map["options"] = options; | 881 map["options"] = options; |
862 return map; | 882 return map; |
863 } | 883 } |
864 } | 884 } |
865 | 885 |
866 | 886 |
| 887 |
| 888 |
867 class GeocoderLocationToAddressResponseParams extends bindings.Struct { | 889 class GeocoderLocationToAddressResponseParams extends bindings.Struct { |
868 static const List<bindings.StructDataHeader> kVersions = const [ | 890 static const List<bindings.StructDataHeader> kVersions = const [ |
869 const bindings.StructDataHeader(24, 0) | 891 const bindings.StructDataHeader(24, 0) |
870 ]; | 892 ]; |
871 String status = null; | 893 String status = null; |
872 List<Result> results = null; | 894 List<Result> results = null; |
873 | 895 |
874 GeocoderLocationToAddressResponseParams() : super(kVersions.last.size); | 896 GeocoderLocationToAddressResponseParams() : super(kVersions.last.size); |
875 | 897 |
876 static GeocoderLocationToAddressResponseParams deserialize(bindings.Message me
ssage) { | 898 static GeocoderLocationToAddressResponseParams deserialize(bindings.Message me
ssage) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 } | 973 } |
952 | 974 |
953 Map toJson() { | 975 Map toJson() { |
954 Map map = new Map(); | 976 Map map = new Map(); |
955 map["status"] = status; | 977 map["status"] = status; |
956 map["results"] = results; | 978 map["results"] = results; |
957 return map; | 979 return map; |
958 } | 980 } |
959 } | 981 } |
960 | 982 |
| 983 |
| 984 |
| 985 |
961 const int _Geocoder_addressToLocationName = 0; | 986 const int _Geocoder_addressToLocationName = 0; |
962 const int _Geocoder_locationToAddressName = 1; | 987 const int _Geocoder_locationToAddressName = 1; |
963 | 988 |
| 989 |
| 990 |
| 991 class _GeocoderServiceDescription implements service_describer.ServiceDescriptio
n { |
| 992 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 993 |
| 994 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 995 |
| 996 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 997 } |
| 998 |
964 abstract class Geocoder { | 999 abstract class Geocoder { |
965 static const String serviceName = null; | 1000 static const String serviceName = null; |
966 dynamic addressToLocation(String address,Options options,[Function responseFac
tory = null]); | 1001 dynamic addressToLocation(String address,Options options,[Function responseFac
tory = null]); |
967 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu
nction responseFactory = null]); | 1002 dynamic locationToAddress(location_mojom.Location location,Options options,[Fu
nction responseFactory = null]); |
968 } | 1003 } |
969 | 1004 |
970 | 1005 |
971 class _GeocoderProxyImpl extends bindings.Proxy { | 1006 class _GeocoderProxyImpl extends bindings.Proxy { |
972 _GeocoderProxyImpl.fromEndpoint( | 1007 _GeocoderProxyImpl.fromEndpoint( |
973 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 1008 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
974 | 1009 |
975 _GeocoderProxyImpl.fromHandle(core.MojoHandle handle) : | 1010 _GeocoderProxyImpl.fromHandle(core.MojoHandle handle) : |
976 super.fromHandle(handle); | 1011 super.fromHandle(handle); |
977 | 1012 |
978 _GeocoderProxyImpl.unbound() : super.unbound(); | 1013 _GeocoderProxyImpl.unbound() : super.unbound(); |
979 | 1014 |
980 static _GeocoderProxyImpl newFromEndpoint( | 1015 static _GeocoderProxyImpl newFromEndpoint( |
981 core.MojoMessagePipeEndpoint endpoint) { | 1016 core.MojoMessagePipeEndpoint endpoint) { |
982 assert(endpoint.setDescription("For _GeocoderProxyImpl")); | 1017 assert(endpoint.setDescription("For _GeocoderProxyImpl")); |
983 return new _GeocoderProxyImpl.fromEndpoint(endpoint); | 1018 return new _GeocoderProxyImpl.fromEndpoint(endpoint); |
984 } | 1019 } |
985 | 1020 |
| 1021 service_describer.ServiceDescription get serviceDescription => |
| 1022 new _GeocoderServiceDescription(); |
| 1023 |
986 void handleResponse(bindings.ServiceMessage message) { | 1024 void handleResponse(bindings.ServiceMessage message) { |
987 switch (message.header.type) { | 1025 switch (message.header.type) { |
988 case _Geocoder_addressToLocationName: | 1026 case _Geocoder_addressToLocationName: |
989 var r = GeocoderAddressToLocationResponseParams.deserialize( | 1027 var r = GeocoderAddressToLocationResponseParams.deserialize( |
990 message.payload); | 1028 message.payload); |
991 if (!message.header.hasRequestId) { | 1029 if (!message.header.hasRequestId) { |
992 proxyError("Expected a message with a valid request Id."); | 1030 proxyError("Expected a message with a valid request Id."); |
993 return; | 1031 return; |
994 } | 1032 } |
995 Completer c = completerMap[message.header.requestId]; | 1033 Completer c = completerMap[message.header.requestId]; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 assert(_impl == null); | 1259 assert(_impl == null); |
1222 _impl = d; | 1260 _impl = d; |
1223 } | 1261 } |
1224 | 1262 |
1225 String toString() { | 1263 String toString() { |
1226 var superString = super.toString(); | 1264 var superString = super.toString(); |
1227 return "GeocoderStub($superString)"; | 1265 return "GeocoderStub($superString)"; |
1228 } | 1266 } |
1229 | 1267 |
1230 int get version => 0; | 1268 int get version => 0; |
| 1269 |
| 1270 service_describer.ServiceDescription get serviceDescription => |
| 1271 new _GeocoderServiceDescription(); |
1231 } | 1272 } |
1232 | 1273 |
1233 | 1274 |
| 1275 |
OLD | NEW |