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