| 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 authentication_mojom; | 5 library authentication_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 _AuthenticationServiceSelectAccountParams extends bindings.Struct { | 17 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { |
| 15 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
| 16 const bindings.StructDataHeader(16, 0) | 19 const bindings.StructDataHeader(16, 0) |
| 17 ]; | 20 ]; |
| 18 bool returnLastSelected = false; | 21 bool returnLastSelected = false; |
| 19 | 22 |
| 20 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); | 23 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return "_AuthenticationServiceSelectAccountParams(" | 72 return "_AuthenticationServiceSelectAccountParams(" |
| 70 "returnLastSelected: $returnLastSelected" ")"; | 73 "returnLastSelected: $returnLastSelected" ")"; |
| 71 } | 74 } |
| 72 | 75 |
| 73 Map toJson() { | 76 Map toJson() { |
| 74 Map map = new Map(); | 77 Map map = new Map(); |
| 75 map["returnLastSelected"] = returnLastSelected; | 78 map["returnLastSelected"] = returnLastSelected; |
| 76 return map; | 79 return map; |
| 77 } | 80 } |
| 78 } | 81 } |
| 82 mojom_types.MojomStruct _authentication_AuthenticationService_SelectAccount_Para
ms__() { |
| 83 return new mojom_types.MojomStruct() |
| 84 ..declData = (new mojom_types.DeclarationData() |
| 85 ..shortName = '_AuthenticationServiceSelectAccountParams' |
| 86 ..fullIdentifier = 'authentication._AuthenticationServiceSelectAccountPara
ms') |
| 87 ..fields = <mojom_types.StructField>[ |
| 88 new mojom_types.StructField() |
| 89 ..declData = (new mojom_types.DeclarationData()..shortName = 'ReturnLast
Selected') |
| 90 ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.bo
ol), |
| 91 ]; |
| 92 } |
| 79 | 93 |
| 80 | 94 |
| 81 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { | 95 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { |
| 82 static const List<bindings.StructDataHeader> kVersions = const [ | 96 static const List<bindings.StructDataHeader> kVersions = const [ |
| 83 const bindings.StructDataHeader(24, 0) | 97 const bindings.StructDataHeader(24, 0) |
| 84 ]; | 98 ]; |
| 85 String username = null; | 99 String username = null; |
| 86 String error = null; | 100 String error = null; |
| 87 | 101 |
| 88 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size
); | 102 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size
); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 "error: $error" ")"; | 159 "error: $error" ")"; |
| 146 } | 160 } |
| 147 | 161 |
| 148 Map toJson() { | 162 Map toJson() { |
| 149 Map map = new Map(); | 163 Map map = new Map(); |
| 150 map["username"] = username; | 164 map["username"] = username; |
| 151 map["error"] = error; | 165 map["error"] = error; |
| 152 return map; | 166 return map; |
| 153 } | 167 } |
| 154 } | 168 } |
| 169 mojom_types.MojomStruct _authentication_AuthenticationService_SelectAccount_Resp
onseParams__() { |
| 170 return new mojom_types.MojomStruct() |
| 171 ..declData = (new mojom_types.DeclarationData() |
| 172 ..shortName = 'AuthenticationServiceSelectAccountResponseParams' |
| 173 ..fullIdentifier = 'authentication.AuthenticationServiceSelectAccountRespo
nseParams') |
| 174 ..fields = <mojom_types.StructField>[ |
| 175 new mojom_types.StructField() |
| 176 ..declData = (new mojom_types.DeclarationData()..shortName = 'Username') |
| 177 ..type = (new mojom_types.Type() |
| 178 ..stringType = (new mojom_types.StringType()..nullable = true)), |
| 179 |
| 180 new mojom_types.StructField() |
| 181 ..declData = (new mojom_types.DeclarationData()..shortName = 'Error') |
| 182 ..type = (new mojom_types.Type() |
| 183 ..stringType = (new mojom_types.StringType()..nullable = true)), |
| 184 ]; |
| 185 } |
| 155 | 186 |
| 156 | 187 |
| 157 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { | 188 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { |
| 158 static const List<bindings.StructDataHeader> kVersions = const [ | 189 static const List<bindings.StructDataHeader> kVersions = const [ |
| 159 const bindings.StructDataHeader(24, 0) | 190 const bindings.StructDataHeader(24, 0) |
| 160 ]; | 191 ]; |
| 161 String username = null; | 192 String username = null; |
| 162 List<String> scopes = null; | 193 List<String> scopes = null; |
| 163 | 194 |
| 164 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); | 195 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 "scopes: $scopes" ")"; | 268 "scopes: $scopes" ")"; |
| 238 } | 269 } |
| 239 | 270 |
| 240 Map toJson() { | 271 Map toJson() { |
| 241 Map map = new Map(); | 272 Map map = new Map(); |
| 242 map["username"] = username; | 273 map["username"] = username; |
| 243 map["scopes"] = scopes; | 274 map["scopes"] = scopes; |
| 244 return map; | 275 return map; |
| 245 } | 276 } |
| 246 } | 277 } |
| 278 mojom_types.MojomStruct _authentication_AuthenticationService_GetOAuth2Token_Par
ams__() { |
| 279 return new mojom_types.MojomStruct() |
| 280 ..declData = (new mojom_types.DeclarationData() |
| 281 ..shortName = '_AuthenticationServiceGetOAuth2TokenParams' |
| 282 ..fullIdentifier = 'authentication._AuthenticationServiceGetOAuth2TokenPar
ams') |
| 283 ..fields = <mojom_types.StructField>[ |
| 284 new mojom_types.StructField() |
| 285 ..declData = (new mojom_types.DeclarationData()..shortName = 'Username') |
| 286 ..type = (new mojom_types.Type() |
| 287 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 288 |
| 289 new mojom_types.StructField() |
| 290 ..declData = (new mojom_types.DeclarationData()..shortName = 'Scopes') |
| 291 ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType
() |
| 292 ..elementType = (new mojom_types.Type() |
| 293 ..stringType = (new mojom_types.StringType()..nullable = false)))), |
| 294 ]; |
| 295 } |
| 247 | 296 |
| 248 | 297 |
| 249 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct
{ | 298 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct
{ |
| 250 static const List<bindings.StructDataHeader> kVersions = const [ | 299 static const List<bindings.StructDataHeader> kVersions = const [ |
| 251 const bindings.StructDataHeader(24, 0) | 300 const bindings.StructDataHeader(24, 0) |
| 252 ]; | 301 ]; |
| 253 String token = null; | 302 String token = null; |
| 254 String error = null; | 303 String error = null; |
| 255 | 304 |
| 256 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz
e); | 305 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz
e); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 "error: $error" ")"; | 362 "error: $error" ")"; |
| 314 } | 363 } |
| 315 | 364 |
| 316 Map toJson() { | 365 Map toJson() { |
| 317 Map map = new Map(); | 366 Map map = new Map(); |
| 318 map["token"] = token; | 367 map["token"] = token; |
| 319 map["error"] = error; | 368 map["error"] = error; |
| 320 return map; | 369 return map; |
| 321 } | 370 } |
| 322 } | 371 } |
| 372 mojom_types.MojomStruct _authentication_AuthenticationService_GetOAuth2Token_Res
ponseParams__() { |
| 373 return new mojom_types.MojomStruct() |
| 374 ..declData = (new mojom_types.DeclarationData() |
| 375 ..shortName = 'AuthenticationServiceGetOAuth2TokenResponseParams' |
| 376 ..fullIdentifier = 'authentication.AuthenticationServiceGetOAuth2TokenResp
onseParams') |
| 377 ..fields = <mojom_types.StructField>[ |
| 378 new mojom_types.StructField() |
| 379 ..declData = (new mojom_types.DeclarationData()..shortName = 'Token') |
| 380 ..type = (new mojom_types.Type() |
| 381 ..stringType = (new mojom_types.StringType()..nullable = true)), |
| 382 |
| 383 new mojom_types.StructField() |
| 384 ..declData = (new mojom_types.DeclarationData()..shortName = 'Error') |
| 385 ..type = (new mojom_types.Type() |
| 386 ..stringType = (new mojom_types.StringType()..nullable = true)), |
| 387 ]; |
| 388 } |
| 323 | 389 |
| 324 | 390 |
| 325 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { | 391 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { |
| 326 static const List<bindings.StructDataHeader> kVersions = const [ | 392 static const List<bindings.StructDataHeader> kVersions = const [ |
| 327 const bindings.StructDataHeader(16, 0) | 393 const bindings.StructDataHeader(16, 0) |
| 328 ]; | 394 ]; |
| 329 String token = null; | 395 String token = null; |
| 330 | 396 |
| 331 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); | 397 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); |
| 332 | 398 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 return "_AuthenticationServiceClearOAuth2TokenParams(" | 446 return "_AuthenticationServiceClearOAuth2TokenParams(" |
| 381 "token: $token" ")"; | 447 "token: $token" ")"; |
| 382 } | 448 } |
| 383 | 449 |
| 384 Map toJson() { | 450 Map toJson() { |
| 385 Map map = new Map(); | 451 Map map = new Map(); |
| 386 map["token"] = token; | 452 map["token"] = token; |
| 387 return map; | 453 return map; |
| 388 } | 454 } |
| 389 } | 455 } |
| 456 mojom_types.MojomStruct _authentication_AuthenticationService_ClearOAuth2Token_P
arams__() { |
| 457 return new mojom_types.MojomStruct() |
| 458 ..declData = (new mojom_types.DeclarationData() |
| 459 ..shortName = '_AuthenticationServiceClearOAuth2TokenParams' |
| 460 ..fullIdentifier = 'authentication._AuthenticationServiceClearOAuth2TokenP
arams') |
| 461 ..fields = <mojom_types.StructField>[ |
| 462 new mojom_types.StructField() |
| 463 ..declData = (new mojom_types.DeclarationData()..shortName = 'Token') |
| 464 ..type = (new mojom_types.Type() |
| 465 ..stringType = (new mojom_types.StringType()..nullable = false)), |
| 466 ]; |
| 467 } |
| 468 |
| 390 | 469 |
| 391 const int _AuthenticationService_selectAccountName = 0; | 470 const int _AuthenticationService_selectAccountName = 0; |
| 392 const int _AuthenticationService_getOAuth2TokenName = 1; | 471 const int _AuthenticationService_getOAuth2TokenName = 1; |
| 393 const int _AuthenticationService_clearOAuth2TokenName = 2; | 472 const int _AuthenticationService_clearOAuth2TokenName = 2; |
| 394 | 473 |
| 474 mojom_types.MojomInterface _authentication_AuthenticationService__() { |
| 475 return new mojom_types.MojomInterface() |
| 476 ..declData = (new mojom_types.DeclarationData() |
| 477 ..shortName = 'AuthenticationService' |
| 478 ..fullIdentifier = 'authentication.AuthenticationService') |
| 479 ..interfaceName = 'AuthenticationService' |
| 480 ..methods = <int, mojom_types.MojomMethod>{ |
| 481 _AuthenticationService_selectAccountName: new mojom_types.MojomMethod() |
| 482 ..declData = (new mojom_types.DeclarationData()..shortName = 'SelectAcco
unt') |
| 483 ..ordinal = _AuthenticationService_selectAccountName |
| 484 ..responseParams = _authentication_AuthenticationService_SelectAccount_R
esponseParams__()..parameters = _authentication_AuthenticationService_SelectAcco
unt_Params__(),_AuthenticationService_getOAuth2TokenName: new mojom_types.MojomM
ethod() |
| 485 ..declData = (new mojom_types.DeclarationData()..shortName = 'GetOAuth2T
oken') |
| 486 ..ordinal = _AuthenticationService_getOAuth2TokenName |
| 487 ..responseParams = _authentication_AuthenticationService_GetOAuth2Token_
ResponseParams__()..parameters = _authentication_AuthenticationService_GetOAuth2
Token_Params__(),_AuthenticationService_clearOAuth2TokenName: new mojom_types.Mo
jomMethod() |
| 488 ..declData = (new mojom_types.DeclarationData()..shortName = 'ClearOAuth
2Token') |
| 489 ..ordinal = _AuthenticationService_clearOAuth2TokenName..parameters = _a
uthentication_AuthenticationService_ClearOAuth2Token_Params__(), |
| 490 }; |
| 491 } |
| 492 |
| 493 class _AuthenticationServiceServiceDescription implements service_describer.Serv
iceDescription { |
| 494 dynamic getTopLevelInterface([Function responseFactory = null]) { |
| 495 return _authentication_AuthenticationService__(); |
| 496 } |
| 497 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) { |
| 498 return getAllMojomTypeDefinitions()[typeKey]; |
| 499 } |
| 500 dynamic getAllTypeDefinitions([Function responseFactory = null]) { |
| 501 return getAllMojomTypeDefinitions(); |
| 502 } |
| 503 } |
| 504 |
| 395 abstract class AuthenticationService { | 505 abstract class AuthenticationService { |
| 396 static const String serviceName = "authentication::AuthenticationService"; | 506 static const String serviceName = "authentication::AuthenticationService"; |
| 397 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 507 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); |
| 398 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 508 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); |
| 399 void clearOAuth2Token(String token); | 509 void clearOAuth2Token(String token); |
| 400 } | 510 } |
| 401 | 511 |
| 402 | 512 |
| 403 class _AuthenticationServiceProxyImpl extends bindings.Proxy { | 513 class _AuthenticationServiceProxyImpl extends bindings.Proxy { |
| 404 _AuthenticationServiceProxyImpl.fromEndpoint( | 514 _AuthenticationServiceProxyImpl.fromEndpoint( |
| 405 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 515 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 406 | 516 |
| 407 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : | 517 _AuthenticationServiceProxyImpl.fromHandle(core.MojoHandle handle) : |
| 408 super.fromHandle(handle); | 518 super.fromHandle(handle); |
| 409 | 519 |
| 410 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); | 520 _AuthenticationServiceProxyImpl.unbound() : super.unbound(); |
| 411 | 521 |
| 412 static _AuthenticationServiceProxyImpl newFromEndpoint( | 522 static _AuthenticationServiceProxyImpl newFromEndpoint( |
| 413 core.MojoMessagePipeEndpoint endpoint) { | 523 core.MojoMessagePipeEndpoint endpoint) { |
| 414 assert(endpoint.setDescription("For _AuthenticationServiceProxyImpl")); | 524 assert(endpoint.setDescription("For _AuthenticationServiceProxyImpl")); |
| 415 return new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint); | 525 return new _AuthenticationServiceProxyImpl.fromEndpoint(endpoint); |
| 416 } | 526 } |
| 417 | 527 |
| 528 service_describer.ServiceDescription get serviceDescription => |
| 529 new _AuthenticationServiceServiceDescription(); |
| 530 |
| 418 void handleResponse(bindings.ServiceMessage message) { | 531 void handleResponse(bindings.ServiceMessage message) { |
| 419 switch (message.header.type) { | 532 switch (message.header.type) { |
| 420 case _AuthenticationService_selectAccountName: | 533 case _AuthenticationService_selectAccountName: |
| 421 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( | 534 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( |
| 422 message.payload); | 535 message.payload); |
| 423 if (!message.header.hasRequestId) { | 536 if (!message.header.hasRequestId) { |
| 424 proxyError("Expected a message with a valid request Id."); | 537 proxyError("Expected a message with a valid request Id."); |
| 425 return; | 538 return; |
| 426 } | 539 } |
| 427 Completer c = completerMap[message.header.requestId]; | 540 Completer c = completerMap[message.header.requestId]; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 assert(_impl == null); | 779 assert(_impl == null); |
| 667 _impl = d; | 780 _impl = d; |
| 668 } | 781 } |
| 669 | 782 |
| 670 String toString() { | 783 String toString() { |
| 671 var superString = super.toString(); | 784 var superString = super.toString(); |
| 672 return "AuthenticationServiceStub($superString)"; | 785 return "AuthenticationServiceStub($superString)"; |
| 673 } | 786 } |
| 674 | 787 |
| 675 int get version => 0; | 788 int get version => 0; |
| 789 |
| 790 |
| 791 service_describer.ServiceDescription get serviceDescription => |
| 792 new _AuthenticationServiceServiceDescription(); |
| 676 } | 793 } |
| 677 | 794 |
| 678 | 795 |
| 796 |
| 797 |
| 798 |
| 799 |
| 800 |
| 801 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 802 var map = new HashMap<String, mojom_types.UserDefinedType>(); |
| 803 map["_authentication_AuthenticationService_SelectAccount_Params__"] = |
| 804 new mojom_types.UserDefinedType() |
| 805 ..structType = _authentication_AuthenticationService_SelectAccount_Params_
_(); |
| 806 map["_authentication_AuthenticationService_SelectAccount_ResponseParams__"] = |
| 807 new mojom_types.UserDefinedType() |
| 808 ..structType = _authentication_AuthenticationService_SelectAccount_Respons
eParams__(); |
| 809 map["_authentication_AuthenticationService_GetOAuth2Token_Params__"] = |
| 810 new mojom_types.UserDefinedType() |
| 811 ..structType = _authentication_AuthenticationService_GetOAuth2Token_Params
__(); |
| 812 map["_authentication_AuthenticationService_GetOAuth2Token_ResponseParams__"] = |
| 813 new mojom_types.UserDefinedType() |
| 814 ..structType = _authentication_AuthenticationService_GetOAuth2Token_Respon
seParams__(); |
| 815 map["_authentication_AuthenticationService_ClearOAuth2Token_Params__"] = |
| 816 new mojom_types.UserDefinedType() |
| 817 ..structType = _authentication_AuthenticationService_ClearOAuth2Token_Para
ms__(); |
| 818 map["_authentication_AuthenticationService__"] = |
| 819 new mojom_types.UserDefinedType() |
| 820 ..interfaceType = _authentication_AuthenticationService__(); |
| 821 |
| 822 return map; |
| 823 } |
| 824 |
| 825 var _MojomDesc; |
| 826 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 827 if (_MojomDesc == null) { |
| 828 _MojomDesc = _initDescriptions(); |
| 829 } |
| 830 return _MojomDesc; |
| 831 } |
| 832 |
| OLD | NEW |