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 prediction_mojom; | 5 library prediction_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/mojom_types.mojom.dart' as mojom_types; |
| 12 import 'package:mojo/mojo/service_describer.mojom.dart' as service_describer; |
11 | 13 |
12 | 14 |
13 | 15 |
14 class PrevWordInfo extends bindings.Struct { | 16 class PrevWordInfo extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(24, 0) | 18 const bindings.StructDataHeader(24, 0) |
17 ]; | 19 ]; |
18 String word = null; | 20 String word = null; |
19 bool isBeginningOfSentence = false; | 21 bool isBeginningOfSentence = false; |
20 | 22 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 81 } |
80 | 82 |
81 Map toJson() { | 83 Map toJson() { |
82 Map map = new Map(); | 84 Map map = new Map(); |
83 map["word"] = word; | 85 map["word"] = word; |
84 map["isBeginningOfSentence"] = isBeginningOfSentence; | 86 map["isBeginningOfSentence"] = isBeginningOfSentence; |
85 return map; | 87 return map; |
86 } | 88 } |
87 } | 89 } |
88 | 90 |
| 91 mojom_types.MojomStruct _prediction_PrevWordInfo__() { |
| 92 return new mojom_types.MojomStruct() |
| 93 ..declData = (new mojom_types.DeclarationData()..shortName = 'PrevWordInfo') |
| 94 ..fields = <mojom_types.StructField>[ |
| 95 new mojom_types.StructField() |
| 96 ..declData = (new mojom_types.DeclarationData()..shortName = 'Word') |
| 97 ..type = (new mojom_types.Type() |
| 98 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 99 |
| 100 new mojom_types.StructField() |
| 101 ..declData = (new mojom_types.DeclarationData()..shortName = 'IsBeginnin
gOfSentence') |
| 102 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.BO
OL), |
| 103 ]; |
| 104 } |
| 105 |
89 | 106 |
90 class PredictionInfo extends bindings.Struct { | 107 class PredictionInfo extends bindings.Struct { |
91 static const List<bindings.StructDataHeader> kVersions = const [ | 108 static const List<bindings.StructDataHeader> kVersions = const [ |
92 const bindings.StructDataHeader(24, 0) | 109 const bindings.StructDataHeader(24, 0) |
93 ]; | 110 ]; |
94 List<PrevWordInfo> previousWords = null; | 111 List<PrevWordInfo> previousWords = null; |
95 String currentWord = null; | 112 String currentWord = null; |
96 | 113 |
97 PredictionInfo() : super(kVersions.last.size); | 114 PredictionInfo() : super(kVersions.last.size); |
98 | 115 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 189 } |
173 | 190 |
174 Map toJson() { | 191 Map toJson() { |
175 Map map = new Map(); | 192 Map map = new Map(); |
176 map["previousWords"] = previousWords; | 193 map["previousWords"] = previousWords; |
177 map["currentWord"] = currentWord; | 194 map["currentWord"] = currentWord; |
178 return map; | 195 return map; |
179 } | 196 } |
180 } | 197 } |
181 | 198 |
| 199 mojom_types.MojomStruct _prediction_PredictionInfo__() { |
| 200 return new mojom_types.MojomStruct() |
| 201 ..declData = (new mojom_types.DeclarationData()..shortName = 'PredictionInfo
') |
| 202 ..fields = <mojom_types.StructField>[ |
| 203 new mojom_types.StructField() |
| 204 ..declData = (new mojom_types.DeclarationData()..shortName = 'PreviousWo
rds') |
| 205 ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType
() |
| 206 ..elementType = (new mojom_types.Type() |
| 207 ..typeReference = (new mojom_types.TypeReference() |
| 208 |
| 209 ..identifier = '_prediction_PrevWordInfo__' |
| 210 ..typeKey = '_prediction_PrevWordInfo__' |
| 211 )))), |
| 212 |
| 213 new mojom_types.StructField() |
| 214 ..declData = (new mojom_types.DeclarationData()..shortName = 'CurrentWor
d') |
| 215 ..type = (new mojom_types.Type() |
| 216 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 217 ]; |
| 218 } |
| 219 |
182 | 220 |
183 class PredictionServiceGetPredictionListParams extends bindings.Struct { | 221 class PredictionServiceGetPredictionListParams extends bindings.Struct { |
184 static const List<bindings.StructDataHeader> kVersions = const [ | 222 static const List<bindings.StructDataHeader> kVersions = const [ |
185 const bindings.StructDataHeader(16, 0) | 223 const bindings.StructDataHeader(16, 0) |
186 ]; | 224 ]; |
187 PredictionInfo predictionInfo = null; | 225 PredictionInfo predictionInfo = null; |
188 | 226 |
189 PredictionServiceGetPredictionListParams() : super(kVersions.last.size); | 227 PredictionServiceGetPredictionListParams() : super(kVersions.last.size); |
190 | 228 |
191 static PredictionServiceGetPredictionListParams deserialize(bindings.Message m
essage) { | 229 static PredictionServiceGetPredictionListParams deserialize(bindings.Message m
essage) { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 "predictionInfo: $predictionInfo" ")"; | 278 "predictionInfo: $predictionInfo" ")"; |
241 } | 279 } |
242 | 280 |
243 Map toJson() { | 281 Map toJson() { |
244 Map map = new Map(); | 282 Map map = new Map(); |
245 map["predictionInfo"] = predictionInfo; | 283 map["predictionInfo"] = predictionInfo; |
246 return map; | 284 return map; |
247 } | 285 } |
248 } | 286 } |
249 | 287 |
| 288 mojom_types.MojomStruct _prediction_PredictionService_GetPredictionList_Params__
() { |
| 289 return new mojom_types.MojomStruct() |
| 290 ..declData = (new mojom_types.DeclarationData()..shortName = 'PredictionServ
iceGetPredictionListParams') |
| 291 ..fields = <mojom_types.StructField>[ |
| 292 new mojom_types.StructField() |
| 293 ..declData = (new mojom_types.DeclarationData()..shortName = 'Prediction
Info') |
| 294 ..type = (new mojom_types.Type() |
| 295 ..typeReference = (new mojom_types.TypeReference() |
| 296 |
| 297 ..identifier = '_prediction_PredictionInfo__' |
| 298 ..typeKey = '_prediction_PredictionInfo__' |
| 299 )), |
| 300 ]; |
| 301 } |
| 302 |
250 | 303 |
251 class PredictionServiceGetPredictionListResponseParams extends bindings.Struct { | 304 class PredictionServiceGetPredictionListResponseParams extends bindings.Struct { |
252 static const List<bindings.StructDataHeader> kVersions = const [ | 305 static const List<bindings.StructDataHeader> kVersions = const [ |
253 const bindings.StructDataHeader(16, 0) | 306 const bindings.StructDataHeader(16, 0) |
254 ]; | 307 ]; |
255 List<String> predictionList = null; | 308 List<String> predictionList = null; |
256 | 309 |
257 PredictionServiceGetPredictionListResponseParams() : super(kVersions.last.size
); | 310 PredictionServiceGetPredictionListResponseParams() : super(kVersions.last.size
); |
258 | 311 |
259 static PredictionServiceGetPredictionListResponseParams deserialize(bindings.M
essage message) { | 312 static PredictionServiceGetPredictionListResponseParams deserialize(bindings.M
essage message) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 "predictionList: $predictionList" ")"; | 378 "predictionList: $predictionList" ")"; |
326 } | 379 } |
327 | 380 |
328 Map toJson() { | 381 Map toJson() { |
329 Map map = new Map(); | 382 Map map = new Map(); |
330 map["predictionList"] = predictionList; | 383 map["predictionList"] = predictionList; |
331 return map; | 384 return map; |
332 } | 385 } |
333 } | 386 } |
334 | 387 |
| 388 mojom_types.MojomStruct _prediction_PredictionService_GetPredictionList_Response
Params__() { |
| 389 return new mojom_types.MojomStruct() |
| 390 ..declData = (new mojom_types.DeclarationData()..shortName = 'PredictionServ
iceGetPredictionListResponseParams') |
| 391 ..fields = <mojom_types.StructField>[ |
| 392 new mojom_types.StructField() |
| 393 ..declData = (new mojom_types.DeclarationData()..shortName = 'Prediction
List') |
| 394 ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType
() |
| 395 ..nullable = true |
| 396 |
| 397 ..elementType = (new mojom_types.Type() |
| 398 ..stringType = (new mojom_types.StringType()..nullable = false)))), |
| 399 ]; |
| 400 } |
| 401 |
| 402 |
335 const int kPredictionService_getPredictionList_name = 0; | 403 const int kPredictionService_getPredictionList_name = 0; |
336 | 404 |
337 const String PredictionServiceName = | 405 const String PredictionServiceName = |
338 'prediction::PredictionService'; | 406 'prediction::PredictionService'; |
339 | 407 |
| 408 mojom_types.MojomInterface _prediction_PredictionService__() { |
| 409 return new mojom_types.MojomInterface() |
| 410 ..declData = (new mojom_types.DeclarationData()..shortName = "PredictionServ
ice") |
| 411 ..interfaceName = "PredictionService" |
| 412 ..methods = <int, mojom_types.MojomMethod>{ |
| 413 kPredictionService_getPredictionList_name: new mojom_types.MojomMethod() |
| 414 ..declData = (new mojom_types.DeclarationData()..shortName = "GetPredict
ionList") |
| 415 ..ordinal = kPredictionService_getPredictionList_name |
| 416 ..responseParams = _prediction_PredictionService_GetPredictionList_Respo
nseParams__()..parameters = _prediction_PredictionService_GetPredictionList_Para
ms__(), |
| 417 }; |
| 418 } |
| 419 |
| 420 class _PredictionServiceServiceDescription extends service_describer.ServiceDesc
ription { |
| 421 // Avoid infinite loop by overriding serviceDescription field. |
| 422 final service_describer.ServiceDescription serviceDescription = null; |
| 423 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 424 return _prediction_PredictionService__(); |
| 425 } |
| 426 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 427 return getAllMojomTypeDefinitions()[typeKey]; |
| 428 } |
| 429 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 430 return getAllMojomTypeDefinitions(); |
| 431 } |
| 432 } |
| 433 |
340 abstract class PredictionService { | 434 abstract class PredictionService { |
341 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact
ory = null]); | 435 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact
ory = null]); |
342 | 436 |
343 } | 437 } |
344 | 438 |
345 | 439 |
346 class PredictionServiceProxyImpl extends bindings.Proxy { | 440 class PredictionServiceProxyImpl extends bindings.Proxy { |
347 PredictionServiceProxyImpl.fromEndpoint( | 441 PredictionServiceProxyImpl.fromEndpoint( |
348 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 442 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
349 | 443 |
350 PredictionServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 444 PredictionServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
351 super.fromHandle(handle); | 445 super.fromHandle(handle); |
352 | 446 |
353 PredictionServiceProxyImpl.unbound() : super.unbound(); | 447 PredictionServiceProxyImpl.unbound() : super.unbound(); |
354 | 448 |
355 static PredictionServiceProxyImpl newFromEndpoint( | 449 static PredictionServiceProxyImpl newFromEndpoint( |
356 core.MojoMessagePipeEndpoint endpoint) { | 450 core.MojoMessagePipeEndpoint endpoint) { |
357 assert(endpoint.setDescription("For PredictionServiceProxyImpl")); | 451 assert(endpoint.setDescription("For PredictionServiceProxyImpl")); |
358 return new PredictionServiceProxyImpl.fromEndpoint(endpoint); | 452 return new PredictionServiceProxyImpl.fromEndpoint(endpoint); |
359 } | 453 } |
360 | 454 |
361 String get name => PredictionServiceName; | 455 String get name => PredictionServiceName; |
362 | 456 |
| 457 service_describer.ServiceDescription get serviceDescription => |
| 458 new _PredictionServiceServiceDescription(); |
| 459 |
363 void handleResponse(bindings.ServiceMessage message) { | 460 void handleResponse(bindings.ServiceMessage message) { |
364 switch (message.header.type) { | 461 switch (message.header.type) { |
365 case kPredictionService_getPredictionList_name: | 462 case kPredictionService_getPredictionList_name: |
366 var r = PredictionServiceGetPredictionListResponseParams.deserialize( | 463 var r = PredictionServiceGetPredictionListResponseParams.deserialize( |
367 message.payload); | 464 message.payload); |
368 if (!message.header.hasRequestId) { | 465 if (!message.header.hasRequestId) { |
369 proxyError("Expected a message with a valid request Id."); | 466 proxyError("Expected a message with a valid request Id."); |
370 return; | 467 return; |
371 } | 468 } |
372 Completer c = completerMap[message.header.requestId]; | 469 Completer c = completerMap[message.header.requestId]; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 assert(_impl == null); | 636 assert(_impl == null); |
540 _impl = d; | 637 _impl = d; |
541 } | 638 } |
542 | 639 |
543 String toString() { | 640 String toString() { |
544 var superString = super.toString(); | 641 var superString = super.toString(); |
545 return "PredictionServiceStub($superString)"; | 642 return "PredictionServiceStub($superString)"; |
546 } | 643 } |
547 | 644 |
548 int get version => 0; | 645 int get version => 0; |
| 646 |
| 647 service_describer.ServiceDescription get serviceDescription => |
| 648 new _PredictionServiceServiceDescription(); |
549 } | 649 } |
550 | 650 |
551 | 651 |
| 652 |
| 653 |
| 654 |
| 655 |
| 656 |
| 657 |
| 658 var _MojomDesc__ = _initDescriptions(); |
| 659 |
| 660 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 661 var map = new Map<String, mojom_types.UserDefinedType>(); |
| 662 |
| 663 map["_prediction_PrevWordInfo__"] = |
| 664 new mojom_types.UserDefinedType() |
| 665 ..structType = _prediction_PrevWordInfo__(); |
| 666 |
| 667 |
| 668 |
| 669 |
| 670 |
| 671 |
| 672 |
| 673 map["_prediction_PredictionInfo__"] = |
| 674 new mojom_types.UserDefinedType() |
| 675 ..structType = _prediction_PredictionInfo__(); |
| 676 |
| 677 |
| 678 |
| 679 |
| 680 |
| 681 |
| 682 |
| 683 map["_prediction_PredictionService_GetPredictionList_Params__"] = |
| 684 new mojom_types.UserDefinedType() |
| 685 ..structType = _prediction_PredictionService_GetPredictionList_Params__(); |
| 686 |
| 687 |
| 688 |
| 689 |
| 690 |
| 691 map["_prediction_PredictionService_GetPredictionList_ResponseParams__"] = |
| 692 new mojom_types.UserDefinedType() |
| 693 ..structType = _prediction_PredictionService_GetPredictionList_ResponsePar
ams__(); |
| 694 |
| 695 |
| 696 |
| 697 |
| 698 |
| 699 map["_prediction_PredictionService__"] = |
| 700 new mojom_types.UserDefinedType() |
| 701 ..interfaceType = _prediction_PredictionService__(); |
| 702 |
| 703 return map; |
| 704 } |
| 705 |
| 706 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 707 return _MojomDesc__; |
| 708 } |
| 709 |
| 710 |
OLD | NEW |