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