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 location_service_mojom; | 5 library location_service_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 _LocationServiceGetNextLocationParams extends bindings.Struct { | 17 class _LocationServiceGetNextLocationParams extends bindings.Struct { |
16 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
17 const bindings.StructDataHeader(16, 0) | 19 const bindings.StructDataHeader(16, 0) |
18 ]; | 20 ]; |
19 LocationServiceUpdatePriority priority = null; | 21 LocationServiceUpdatePriority priority = null; |
20 | 22 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 78 } |
77 | 79 |
78 Map toJson() { | 80 Map toJson() { |
79 Map map = new Map(); | 81 Map map = new Map(); |
80 map["priority"] = priority; | 82 map["priority"] = priority; |
81 return map; | 83 return map; |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 | 87 |
| 88 |
| 89 |
86 class LocationServiceGetNextLocationResponseParams extends bindings.Struct { | 90 class LocationServiceGetNextLocationResponseParams extends bindings.Struct { |
87 static const List<bindings.StructDataHeader> kVersions = const [ | 91 static const List<bindings.StructDataHeader> kVersions = const [ |
88 const bindings.StructDataHeader(16, 0) | 92 const bindings.StructDataHeader(16, 0) |
89 ]; | 93 ]; |
90 location_mojom.Location location = null; | 94 location_mojom.Location location = null; |
91 | 95 |
92 LocationServiceGetNextLocationResponseParams() : super(kVersions.last.size); | 96 LocationServiceGetNextLocationResponseParams() : super(kVersions.last.size); |
93 | 97 |
94 static LocationServiceGetNextLocationResponseParams deserialize(bindings.Messa
ge message) { | 98 static LocationServiceGetNextLocationResponseParams deserialize(bindings.Messa
ge message) { |
95 var decoder = new bindings.Decoder(message); | 99 var decoder = new bindings.Decoder(message); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 "location: $location" ")"; | 147 "location: $location" ")"; |
144 } | 148 } |
145 | 149 |
146 Map toJson() { | 150 Map toJson() { |
147 Map map = new Map(); | 151 Map map = new Map(); |
148 map["location"] = location; | 152 map["location"] = location; |
149 return map; | 153 return map; |
150 } | 154 } |
151 } | 155 } |
152 | 156 |
| 157 |
| 158 |
| 159 |
153 const int _LocationService_getNextLocationName = 0; | 160 const int _LocationService_getNextLocationName = 0; |
154 | 161 |
155 class LocationServiceUpdatePriority extends bindings.MojoEnum { | 162 class LocationServiceUpdatePriority extends bindings.MojoEnum { |
156 static const LocationServiceUpdatePriority priorityBalancedPowerAccuracy = con
st LocationServiceUpdatePriority._(0); | 163 static const LocationServiceUpdatePriority priorityBalancedPowerAccuracy = con
st LocationServiceUpdatePriority._(0); |
157 static const LocationServiceUpdatePriority priorityHighAccuracy = const Locati
onServiceUpdatePriority._(1); | 164 static const LocationServiceUpdatePriority priorityHighAccuracy = const Locati
onServiceUpdatePriority._(1); |
158 static const LocationServiceUpdatePriority priorityLowPower = const LocationSe
rviceUpdatePriority._(2); | 165 static const LocationServiceUpdatePriority priorityLowPower = const LocationSe
rviceUpdatePriority._(2); |
159 static const LocationServiceUpdatePriority priorityNoPower = const LocationSer
viceUpdatePriority._(3); | 166 static const LocationServiceUpdatePriority priorityNoPower = const LocationSer
viceUpdatePriority._(3); |
160 | 167 |
161 const LocationServiceUpdatePriority._(int v) : super(v); | 168 const LocationServiceUpdatePriority._(int v) : super(v); |
162 | 169 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 String toString() { | 210 String toString() { |
204 switch(this) { | 211 switch(this) { |
205 case priorityBalancedPowerAccuracy: | 212 case priorityBalancedPowerAccuracy: |
206 return 'LocationServiceUpdatePriority.priorityBalancedPowerAccuracy'; | 213 return 'LocationServiceUpdatePriority.priorityBalancedPowerAccuracy'; |
207 case priorityHighAccuracy: | 214 case priorityHighAccuracy: |
208 return 'LocationServiceUpdatePriority.priorityHighAccuracy'; | 215 return 'LocationServiceUpdatePriority.priorityHighAccuracy'; |
209 case priorityLowPower: | 216 case priorityLowPower: |
210 return 'LocationServiceUpdatePriority.priorityLowPower'; | 217 return 'LocationServiceUpdatePriority.priorityLowPower'; |
211 case priorityNoPower: | 218 case priorityNoPower: |
212 return 'LocationServiceUpdatePriority.priorityNoPower'; | 219 return 'LocationServiceUpdatePriority.priorityNoPower'; |
| 220 default: |
| 221 return null; |
213 } | 222 } |
214 } | 223 } |
215 | 224 |
216 int toJson() => mojoEnumValue; | 225 int toJson() => mojoEnumValue; |
217 } | 226 } |
218 | 227 |
| 228 |
| 229 |
| 230 |
| 231 |
| 232 class _LocationServiceServiceDescription implements service_describer.ServiceDes
cription { |
| 233 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 234 |
| 235 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 236 |
| 237 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 238 } |
| 239 |
219 abstract class LocationService { | 240 abstract class LocationService { |
220 static const String serviceName = "mojo::LocationService"; | 241 static const String serviceName = "mojo::LocationService"; |
221 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo
nseFactory = null]); | 242 dynamic getNextLocation(LocationServiceUpdatePriority priority,[Function respo
nseFactory = null]); |
222 } | 243 } |
223 | 244 |
224 | 245 |
225 class _LocationServiceProxyImpl extends bindings.Proxy { | 246 class _LocationServiceProxyImpl extends bindings.Proxy { |
226 _LocationServiceProxyImpl.fromEndpoint( | 247 _LocationServiceProxyImpl.fromEndpoint( |
227 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 248 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
228 | 249 |
229 _LocationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 250 _LocationServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
230 super.fromHandle(handle); | 251 super.fromHandle(handle); |
231 | 252 |
232 _LocationServiceProxyImpl.unbound() : super.unbound(); | 253 _LocationServiceProxyImpl.unbound() : super.unbound(); |
233 | 254 |
234 static _LocationServiceProxyImpl newFromEndpoint( | 255 static _LocationServiceProxyImpl newFromEndpoint( |
235 core.MojoMessagePipeEndpoint endpoint) { | 256 core.MojoMessagePipeEndpoint endpoint) { |
236 assert(endpoint.setDescription("For _LocationServiceProxyImpl")); | 257 assert(endpoint.setDescription("For _LocationServiceProxyImpl")); |
237 return new _LocationServiceProxyImpl.fromEndpoint(endpoint); | 258 return new _LocationServiceProxyImpl.fromEndpoint(endpoint); |
238 } | 259 } |
239 | 260 |
| 261 service_describer.ServiceDescription get serviceDescription => |
| 262 new _LocationServiceServiceDescription(); |
| 263 |
240 void handleResponse(bindings.ServiceMessage message) { | 264 void handleResponse(bindings.ServiceMessage message) { |
241 switch (message.header.type) { | 265 switch (message.header.type) { |
242 case _LocationService_getNextLocationName: | 266 case _LocationService_getNextLocationName: |
243 var r = LocationServiceGetNextLocationResponseParams.deserialize( | 267 var r = LocationServiceGetNextLocationResponseParams.deserialize( |
244 message.payload); | 268 message.payload); |
245 if (!message.header.hasRequestId) { | 269 if (!message.header.hasRequestId) { |
246 proxyError("Expected a message with a valid request Id."); | 270 proxyError("Expected a message with a valid request Id."); |
247 return; | 271 return; |
248 } | 272 } |
249 Completer c = completerMap[message.header.requestId]; | 273 Completer c = completerMap[message.header.requestId]; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 assert(_impl == null); | 439 assert(_impl == null); |
416 _impl = d; | 440 _impl = d; |
417 } | 441 } |
418 | 442 |
419 String toString() { | 443 String toString() { |
420 var superString = super.toString(); | 444 var superString = super.toString(); |
421 return "LocationServiceStub($superString)"; | 445 return "LocationServiceStub($superString)"; |
422 } | 446 } |
423 | 447 |
424 int get version => 0; | 448 int get version => 0; |
| 449 |
| 450 service_describer.ServiceDescription get serviceDescription => |
| 451 new _LocationServiceServiceDescription(); |
425 } | 452 } |
426 | 453 |
427 | 454 |
| 455 |
OLD | NEW |