| OLD | NEW |
| 1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
| 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
| 3 | 3 |
| 4 library authentication_mojom; | 4 library authentication_mojom; |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
| 7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
| 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 9 | 9 |
| 10 | 10 |
| 11 | 11 |
| 12 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { | 12 class _AuthenticationServiceSelectAccountParams extends bindings.Struct { |
| 13 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
| 14 const bindings.StructDataHeader(16, 0) | 14 const bindings.StructDataHeader(16, 0) |
| 15 ]; | 15 ]; |
| 16 bool returnLastSelected = false; | 16 bool returnLastSelected = false; |
| 17 | 17 |
| 18 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); | 18 _AuthenticationServiceSelectAccountParams() : super(kVersions.last.size); |
| 19 | 19 |
| 20 _AuthenticationServiceSelectAccountParams.init( |
| 21 bool this.returnLastSelected |
| 22 ) : super(kVersions.last.size); |
| 23 |
| 20 static _AuthenticationServiceSelectAccountParams deserialize(bindings.Message
message) { | 24 static _AuthenticationServiceSelectAccountParams deserialize(bindings.Message
message) { |
| 21 var decoder = new bindings.Decoder(message); | 25 var decoder = new bindings.Decoder(message); |
| 22 var result = decode(decoder); | 26 var result = decode(decoder); |
| 23 if (decoder.excessHandles != null) { | 27 if (decoder.excessHandles != null) { |
| 24 decoder.excessHandles.forEach((h) => h.close()); | 28 decoder.excessHandles.forEach((h) => h.close()); |
| 25 } | 29 } |
| 26 return result; | 30 return result; |
| 27 } | 31 } |
| 28 | 32 |
| 29 static _AuthenticationServiceSelectAccountParams decode(bindings.Decoder decod
er0) { | 33 static _AuthenticationServiceSelectAccountParams decode(bindings.Decoder decod
er0) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 87 |
| 84 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { | 88 class AuthenticationServiceSelectAccountResponseParams extends bindings.Struct { |
| 85 static const List<bindings.StructDataHeader> kVersions = const [ | 89 static const List<bindings.StructDataHeader> kVersions = const [ |
| 86 const bindings.StructDataHeader(24, 0) | 90 const bindings.StructDataHeader(24, 0) |
| 87 ]; | 91 ]; |
| 88 String username = null; | 92 String username = null; |
| 89 String error = null; | 93 String error = null; |
| 90 | 94 |
| 91 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size
); | 95 AuthenticationServiceSelectAccountResponseParams() : super(kVersions.last.size
); |
| 92 | 96 |
| 97 AuthenticationServiceSelectAccountResponseParams.init( |
| 98 String this.username, |
| 99 String this.error |
| 100 ) : super(kVersions.last.size); |
| 101 |
| 93 static AuthenticationServiceSelectAccountResponseParams deserialize(bindings.M
essage message) { | 102 static AuthenticationServiceSelectAccountResponseParams deserialize(bindings.M
essage message) { |
| 94 var decoder = new bindings.Decoder(message); | 103 var decoder = new bindings.Decoder(message); |
| 95 var result = decode(decoder); | 104 var result = decode(decoder); |
| 96 if (decoder.excessHandles != null) { | 105 if (decoder.excessHandles != null) { |
| 97 decoder.excessHandles.forEach((h) => h.close()); | 106 decoder.excessHandles.forEach((h) => h.close()); |
| 98 } | 107 } |
| 99 return result; | 108 return result; |
| 100 } | 109 } |
| 101 | 110 |
| 102 static AuthenticationServiceSelectAccountResponseParams decode(bindings.Decode
r decoder0) { | 111 static AuthenticationServiceSelectAccountResponseParams decode(bindings.Decode
r decoder0) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 178 |
| 170 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { | 179 class _AuthenticationServiceGetOAuth2TokenParams extends bindings.Struct { |
| 171 static const List<bindings.StructDataHeader> kVersions = const [ | 180 static const List<bindings.StructDataHeader> kVersions = const [ |
| 172 const bindings.StructDataHeader(24, 0) | 181 const bindings.StructDataHeader(24, 0) |
| 173 ]; | 182 ]; |
| 174 String username = null; | 183 String username = null; |
| 175 List<String> scopes = null; | 184 List<String> scopes = null; |
| 176 | 185 |
| 177 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); | 186 _AuthenticationServiceGetOAuth2TokenParams() : super(kVersions.last.size); |
| 178 | 187 |
| 188 _AuthenticationServiceGetOAuth2TokenParams.init( |
| 189 String this.username, |
| 190 List<String> this.scopes |
| 191 ) : super(kVersions.last.size); |
| 192 |
| 179 static _AuthenticationServiceGetOAuth2TokenParams deserialize(bindings.Message
message) { | 193 static _AuthenticationServiceGetOAuth2TokenParams deserialize(bindings.Message
message) { |
| 180 var decoder = new bindings.Decoder(message); | 194 var decoder = new bindings.Decoder(message); |
| 181 var result = decode(decoder); | 195 var result = decode(decoder); |
| 182 if (decoder.excessHandles != null) { | 196 if (decoder.excessHandles != null) { |
| 183 decoder.excessHandles.forEach((h) => h.close()); | 197 decoder.excessHandles.forEach((h) => h.close()); |
| 184 } | 198 } |
| 185 return result; | 199 return result; |
| 186 } | 200 } |
| 187 | 201 |
| 188 static _AuthenticationServiceGetOAuth2TokenParams decode(bindings.Decoder deco
der0) { | 202 static _AuthenticationServiceGetOAuth2TokenParams decode(bindings.Decoder deco
der0) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 284 |
| 271 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct
{ | 285 class AuthenticationServiceGetOAuth2TokenResponseParams extends bindings.Struct
{ |
| 272 static const List<bindings.StructDataHeader> kVersions = const [ | 286 static const List<bindings.StructDataHeader> kVersions = const [ |
| 273 const bindings.StructDataHeader(24, 0) | 287 const bindings.StructDataHeader(24, 0) |
| 274 ]; | 288 ]; |
| 275 String token = null; | 289 String token = null; |
| 276 String error = null; | 290 String error = null; |
| 277 | 291 |
| 278 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz
e); | 292 AuthenticationServiceGetOAuth2TokenResponseParams() : super(kVersions.last.siz
e); |
| 279 | 293 |
| 294 AuthenticationServiceGetOAuth2TokenResponseParams.init( |
| 295 String this.token, |
| 296 String this.error |
| 297 ) : super(kVersions.last.size); |
| 298 |
| 280 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize(bindings.
Message message) { | 299 static AuthenticationServiceGetOAuth2TokenResponseParams deserialize(bindings.
Message message) { |
| 281 var decoder = new bindings.Decoder(message); | 300 var decoder = new bindings.Decoder(message); |
| 282 var result = decode(decoder); | 301 var result = decode(decoder); |
| 283 if (decoder.excessHandles != null) { | 302 if (decoder.excessHandles != null) { |
| 284 decoder.excessHandles.forEach((h) => h.close()); | 303 decoder.excessHandles.forEach((h) => h.close()); |
| 285 } | 304 } |
| 286 return result; | 305 return result; |
| 287 } | 306 } |
| 288 | 307 |
| 289 static AuthenticationServiceGetOAuth2TokenResponseParams decode(bindings.Decod
er decoder0) { | 308 static AuthenticationServiceGetOAuth2TokenResponseParams decode(bindings.Decod
er decoder0) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 374 |
| 356 | 375 |
| 357 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { | 376 class _AuthenticationServiceClearOAuth2TokenParams extends bindings.Struct { |
| 358 static const List<bindings.StructDataHeader> kVersions = const [ | 377 static const List<bindings.StructDataHeader> kVersions = const [ |
| 359 const bindings.StructDataHeader(16, 0) | 378 const bindings.StructDataHeader(16, 0) |
| 360 ]; | 379 ]; |
| 361 String token = null; | 380 String token = null; |
| 362 | 381 |
| 363 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); | 382 _AuthenticationServiceClearOAuth2TokenParams() : super(kVersions.last.size); |
| 364 | 383 |
| 384 _AuthenticationServiceClearOAuth2TokenParams.init( |
| 385 String this.token |
| 386 ) : super(kVersions.last.size); |
| 387 |
| 365 static _AuthenticationServiceClearOAuth2TokenParams deserialize(bindings.Messa
ge message) { | 388 static _AuthenticationServiceClearOAuth2TokenParams deserialize(bindings.Messa
ge message) { |
| 366 var decoder = new bindings.Decoder(message); | 389 var decoder = new bindings.Decoder(message); |
| 367 var result = decode(decoder); | 390 var result = decode(decoder); |
| 368 if (decoder.excessHandles != null) { | 391 if (decoder.excessHandles != null) { |
| 369 decoder.excessHandles.forEach((h) => h.close()); | 392 decoder.excessHandles.forEach((h) => h.close()); |
| 370 } | 393 } |
| 371 return result; | 394 return result; |
| 372 } | 395 } |
| 373 | 396 |
| 374 static _AuthenticationServiceClearOAuth2TokenParams decode(bindings.Decoder de
coder0) { | 397 static _AuthenticationServiceClearOAuth2TokenParams decode(bindings.Decoder de
coder0) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 map["token"] = token; | 446 map["token"] = token; |
| 424 return map; | 447 return map; |
| 425 } | 448 } |
| 426 } | 449 } |
| 427 | 450 |
| 428 const int _authenticationServiceMethodSelectAccountName = 0; | 451 const int _authenticationServiceMethodSelectAccountName = 0; |
| 429 const int _authenticationServiceMethodGetOAuth2TokenName = 1; | 452 const int _authenticationServiceMethodGetOAuth2TokenName = 1; |
| 430 const int _authenticationServiceMethodClearOAuth2TokenName = 2; | 453 const int _authenticationServiceMethodClearOAuth2TokenName = 2; |
| 431 | 454 |
| 432 class _AuthenticationServiceServiceDescription implements service_describer.Serv
iceDescription { | 455 class _AuthenticationServiceServiceDescription implements service_describer.Serv
iceDescription { |
| 433 dynamic getTopLevelInterface([Function responseFactory]) => | 456 void getTopLevelInterface(Function responder) { |
| 434 responseFactory(null); | 457 responder(null); |
| 458 } |
| 435 | 459 |
| 436 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 460 void getTypeDefinition(String typeKey, Function responder) { |
| 437 responseFactory(null); | 461 responder(null); |
| 462 } |
| 438 | 463 |
| 439 dynamic getAllTypeDefinitions([Function responseFactory]) => | 464 void getAllTypeDefinitions(Function responder) { |
| 440 responseFactory(null); | 465 responder(null); |
| 466 } |
| 441 } | 467 } |
| 442 | 468 |
| 443 abstract class AuthenticationService { | 469 abstract class AuthenticationService { |
| 444 static const String serviceName = "authentication::AuthenticationService"; | 470 static const String serviceName = "authentication::AuthenticationService"; |
| 445 | 471 |
| 446 static service_describer.ServiceDescription _cachedServiceDescription; | 472 static service_describer.ServiceDescription _cachedServiceDescription; |
| 447 static service_describer.ServiceDescription get serviceDescription { | 473 static service_describer.ServiceDescription get serviceDescription { |
| 448 if (_cachedServiceDescription == null) { | 474 if (_cachedServiceDescription == null) { |
| 449 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; | 475 _cachedServiceDescription = new _AuthenticationServiceServiceDescription()
; |
| 450 } | 476 } |
| 451 return _cachedServiceDescription; | 477 return _cachedServiceDescription; |
| 452 } | 478 } |
| 453 | 479 |
| 454 static AuthenticationServiceProxy connectToService( | 480 static AuthenticationServiceProxy connectToService( |
| 455 bindings.ServiceConnector s, String url, [String serviceName]) { | 481 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 456 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); | 482 AuthenticationServiceProxy p = new AuthenticationServiceProxy.unbound(); |
| 457 String name = serviceName ?? AuthenticationService.serviceName; | 483 String name = serviceName ?? AuthenticationService.serviceName; |
| 458 if ((name == null) || name.isEmpty) { | 484 if ((name == null) || name.isEmpty) { |
| 459 throw new core.MojoApiError( | 485 throw new core.MojoApiError( |
| 460 "If an interface has no ServiceName, then one must be provided."); | 486 "If an interface has no ServiceName, then one must be provided."); |
| 461 } | 487 } |
| 462 s.connectToService(url, p, name); | 488 s.connectToService(url, p, name); |
| 463 return p; | 489 return p; |
| 464 } | 490 } |
| 465 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]); | 491 void selectAccount(bool returnLastSelected,void callback(String username, Stri
ng error)); |
| 466 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]); | 492 void getOAuth2Token(String username,List<String> scopes,void callback(String t
oken, String error)); |
| 467 void clearOAuth2Token(String token); | 493 void clearOAuth2Token(String token); |
| 468 } | 494 } |
| 469 | 495 |
| 470 abstract class AuthenticationServiceInterface | 496 abstract class AuthenticationServiceInterface |
| 471 implements bindings.MojoInterface<AuthenticationService>, | 497 implements bindings.MojoInterface<AuthenticationService>, |
| 472 AuthenticationService { | 498 AuthenticationService { |
| 473 factory AuthenticationServiceInterface([AuthenticationService impl]) => | 499 factory AuthenticationServiceInterface([AuthenticationService impl]) => |
| 474 new AuthenticationServiceStub.unbound(impl); | 500 new AuthenticationServiceStub.unbound(impl); |
| 475 | 501 |
| 476 factory AuthenticationServiceInterface.fromEndpoint( | 502 factory AuthenticationServiceInterface.fromEndpoint( |
| (...skipping 30 matching lines...) Expand all Loading... |
| 507 | 533 |
| 508 void handleResponse(bindings.ServiceMessage message) { | 534 void handleResponse(bindings.ServiceMessage message) { |
| 509 switch (message.header.type) { | 535 switch (message.header.type) { |
| 510 case _authenticationServiceMethodSelectAccountName: | 536 case _authenticationServiceMethodSelectAccountName: |
| 511 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( | 537 var r = AuthenticationServiceSelectAccountResponseParams.deserialize( |
| 512 message.payload); | 538 message.payload); |
| 513 if (!message.header.hasRequestId) { | 539 if (!message.header.hasRequestId) { |
| 514 proxyError("Expected a message with a valid request Id."); | 540 proxyError("Expected a message with a valid request Id."); |
| 515 return; | 541 return; |
| 516 } | 542 } |
| 517 Completer c = completerMap[message.header.requestId]; | 543 Function callback = callbackMap[message.header.requestId]; |
| 518 if (c == null) { | 544 if (callback == null) { |
| 519 proxyError( | 545 proxyError( |
| 520 "Message had unknown request Id: ${message.header.requestId}"); | 546 "Message had unknown request Id: ${message.header.requestId}"); |
| 521 return; | 547 return; |
| 522 } | 548 } |
| 523 completerMap.remove(message.header.requestId); | 549 callbackMap.remove(message.header.requestId); |
| 524 if (c.isCompleted) { | 550 callback(r.username , r.error ); |
| 525 proxyError("Response completer already completed"); | |
| 526 return; | |
| 527 } | |
| 528 c.complete(r); | |
| 529 break; | 551 break; |
| 530 case _authenticationServiceMethodGetOAuth2TokenName: | 552 case _authenticationServiceMethodGetOAuth2TokenName: |
| 531 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( | 553 var r = AuthenticationServiceGetOAuth2TokenResponseParams.deserialize( |
| 532 message.payload); | 554 message.payload); |
| 533 if (!message.header.hasRequestId) { | 555 if (!message.header.hasRequestId) { |
| 534 proxyError("Expected a message with a valid request Id."); | 556 proxyError("Expected a message with a valid request Id."); |
| 535 return; | 557 return; |
| 536 } | 558 } |
| 537 Completer c = completerMap[message.header.requestId]; | 559 Function callback = callbackMap[message.header.requestId]; |
| 538 if (c == null) { | 560 if (callback == null) { |
| 539 proxyError( | 561 proxyError( |
| 540 "Message had unknown request Id: ${message.header.requestId}"); | 562 "Message had unknown request Id: ${message.header.requestId}"); |
| 541 return; | 563 return; |
| 542 } | 564 } |
| 543 completerMap.remove(message.header.requestId); | 565 callbackMap.remove(message.header.requestId); |
| 544 if (c.isCompleted) { | 566 callback(r.token , r.error ); |
| 545 proxyError("Response completer already completed"); | |
| 546 return; | |
| 547 } | |
| 548 c.complete(r); | |
| 549 break; | 567 break; |
| 550 default: | 568 default: |
| 551 proxyError("Unexpected message type: ${message.header.type}"); | 569 proxyError("Unexpected message type: ${message.header.type}"); |
| 552 close(immediate: true); | 570 close(immediate: true); |
| 553 break; | 571 break; |
| 554 } | 572 } |
| 555 } | 573 } |
| 556 | 574 |
| 557 @override | 575 @override |
| 558 String toString() { | 576 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 583 return newMockedProxy; | 601 return newMockedProxy; |
| 584 } | 602 } |
| 585 | 603 |
| 586 static AuthenticationServiceProxy newFromEndpoint( | 604 static AuthenticationServiceProxy newFromEndpoint( |
| 587 core.MojoMessagePipeEndpoint endpoint) { | 605 core.MojoMessagePipeEndpoint endpoint) { |
| 588 assert(endpoint.setDescription("For AuthenticationServiceProxy")); | 606 assert(endpoint.setDescription("For AuthenticationServiceProxy")); |
| 589 return new AuthenticationServiceProxy.fromEndpoint(endpoint); | 607 return new AuthenticationServiceProxy.fromEndpoint(endpoint); |
| 590 } | 608 } |
| 591 | 609 |
| 592 | 610 |
| 593 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]) { | 611 void selectAccount(bool returnLastSelected,void callback(String username, Stri
ng error)) { |
| 594 if (impl != null) { | 612 if (impl != null) { |
| 595 return new Future(() => impl.selectAccount(returnLastSelected,_Authenticat
ionServiceStubControl._authenticationServiceSelectAccountResponseParamsFactory))
; | 613 impl.selectAccount(returnLastSelected,callback); |
| 614 return; |
| 596 } | 615 } |
| 597 var params = new _AuthenticationServiceSelectAccountParams(); | 616 var params = new _AuthenticationServiceSelectAccountParams(); |
| 598 params.returnLastSelected = returnLastSelected; | 617 params.returnLastSelected = returnLastSelected; |
| 599 return ctrl.sendMessageWithRequestId( | 618 ctrl.sendMessageWithRequestId( |
| 600 params, | 619 params, |
| 601 _authenticationServiceMethodSelectAccountName, | 620 _authenticationServiceMethodSelectAccountName, |
| 602 -1, | 621 -1, |
| 603 bindings.MessageHeader.kMessageExpectsResponse); | 622 bindings.MessageHeader.kMessageExpectsResponse, |
| 623 callback); |
| 604 } | 624 } |
| 605 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]) { | 625 void getOAuth2Token(String username,List<String> scopes,void callback(String t
oken, String error)) { |
| 606 if (impl != null) { | 626 if (impl != null) { |
| 607 return new Future(() => impl.getOAuth2Token(username,scopes,_Authenticatio
nServiceStubControl._authenticationServiceGetOAuth2TokenResponseParamsFactory)); | 627 impl.getOAuth2Token(username,scopes,callback); |
| 628 return; |
| 608 } | 629 } |
| 609 var params = new _AuthenticationServiceGetOAuth2TokenParams(); | 630 var params = new _AuthenticationServiceGetOAuth2TokenParams(); |
| 610 params.username = username; | 631 params.username = username; |
| 611 params.scopes = scopes; | 632 params.scopes = scopes; |
| 612 return ctrl.sendMessageWithRequestId( | 633 ctrl.sendMessageWithRequestId( |
| 613 params, | 634 params, |
| 614 _authenticationServiceMethodGetOAuth2TokenName, | 635 _authenticationServiceMethodGetOAuth2TokenName, |
| 615 -1, | 636 -1, |
| 616 bindings.MessageHeader.kMessageExpectsResponse); | 637 bindings.MessageHeader.kMessageExpectsResponse, |
| 638 callback); |
| 617 } | 639 } |
| 618 void clearOAuth2Token(String token) { | 640 void clearOAuth2Token(String token) { |
| 619 if (impl != null) { | 641 if (impl != null) { |
| 620 impl.clearOAuth2Token(token); | 642 impl.clearOAuth2Token(token); |
| 621 return; | 643 return; |
| 622 } | 644 } |
| 623 if (!ctrl.isBound) { | 645 if (!ctrl.isBound) { |
| 624 ctrl.proxyError("The Proxy is closed."); | 646 ctrl.proxyError("The Proxy is closed."); |
| 625 return; | 647 return; |
| 626 } | 648 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 646 core.MojoHandle handle, [AuthenticationService impl]) | 668 core.MojoHandle handle, [AuthenticationService impl]) |
| 647 : super.fromHandle(handle, autoBegin: impl != null) { | 669 : super.fromHandle(handle, autoBegin: impl != null) { |
| 648 _impl = impl; | 670 _impl = impl; |
| 649 } | 671 } |
| 650 | 672 |
| 651 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound(); | 673 _AuthenticationServiceStubControl.unbound([this._impl]) : super.unbound(); |
| 652 | 674 |
| 653 String get serviceName => AuthenticationService.serviceName; | 675 String get serviceName => AuthenticationService.serviceName; |
| 654 | 676 |
| 655 | 677 |
| 656 static AuthenticationServiceSelectAccountResponseParams _authenticationService
SelectAccountResponseParamsFactory(String username, String error) { | 678 Function _authenticationServiceSelectAccountResponseParamsResponder( |
| 657 var result = new AuthenticationServiceSelectAccountResponseParams(); | 679 int requestId) { |
| 658 result.username = username; | 680 return (String username, String error) { |
| 659 result.error = error; | 681 var result = new AuthenticationServiceSelectAccountResponseParams(); |
| 660 return result; | 682 result.username = username; |
| 683 result.error = error; |
| 684 sendResponse(buildResponseWithId( |
| 685 result, |
| 686 _authenticationServiceMethodSelectAccountName, |
| 687 requestId, |
| 688 bindings.MessageHeader.kMessageIsResponse)); |
| 689 }; |
| 661 } | 690 } |
| 662 static AuthenticationServiceGetOAuth2TokenResponseParams _authenticationServic
eGetOAuth2TokenResponseParamsFactory(String token, String error) { | 691 Function _authenticationServiceGetOAuth2TokenResponseParamsResponder( |
| 663 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); | 692 int requestId) { |
| 664 result.token = token; | 693 return (String token, String error) { |
| 665 result.error = error; | 694 var result = new AuthenticationServiceGetOAuth2TokenResponseParams(); |
| 666 return result; | 695 result.token = token; |
| 696 result.error = error; |
| 697 sendResponse(buildResponseWithId( |
| 698 result, |
| 699 _authenticationServiceMethodGetOAuth2TokenName, |
| 700 requestId, |
| 701 bindings.MessageHeader.kMessageIsResponse)); |
| 702 }; |
| 667 } | 703 } |
| 668 | 704 |
| 669 dynamic handleMessage(bindings.ServiceMessage message) { | 705 void handleMessage(bindings.ServiceMessage message) { |
| 670 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 706 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 671 return bindings.ControlMessageHandler.handleMessage(this, | 707 bindings.ControlMessageHandler.handleMessage( |
| 672 0, | 708 this, 0, message); |
| 673 message); | 709 return; |
| 674 } | 710 } |
| 675 if (_impl == null) { | 711 if (_impl == null) { |
| 676 throw new core.MojoApiError("$this has no implementation set"); | 712 throw new core.MojoApiError("$this has no implementation set"); |
| 677 } | 713 } |
| 678 switch (message.header.type) { | 714 switch (message.header.type) { |
| 679 case _authenticationServiceMethodSelectAccountName: | 715 case _authenticationServiceMethodSelectAccountName: |
| 680 var params = _AuthenticationServiceSelectAccountParams.deserialize( | 716 var params = _AuthenticationServiceSelectAccountParams.deserialize( |
| 681 message.payload); | 717 message.payload); |
| 682 var response = _impl.selectAccount(params.returnLastSelected,_authentica
tionServiceSelectAccountResponseParamsFactory); | 718 _impl.selectAccount(params.returnLastSelected, _authenticationServiceSel
ectAccountResponseParamsResponder(message.header.requestId)); |
| 683 if (response is Future) { | |
| 684 return response.then((response) { | |
| 685 if (response != null) { | |
| 686 return buildResponseWithId( | |
| 687 response, | |
| 688 _authenticationServiceMethodSelectAccountName, | |
| 689 message.header.requestId, | |
| 690 bindings.MessageHeader.kMessageIsResponse); | |
| 691 } | |
| 692 }); | |
| 693 } else if (response != null) { | |
| 694 return buildResponseWithId( | |
| 695 response, | |
| 696 _authenticationServiceMethodSelectAccountName, | |
| 697 message.header.requestId, | |
| 698 bindings.MessageHeader.kMessageIsResponse); | |
| 699 } | |
| 700 break; | 719 break; |
| 701 case _authenticationServiceMethodGetOAuth2TokenName: | 720 case _authenticationServiceMethodGetOAuth2TokenName: |
| 702 var params = _AuthenticationServiceGetOAuth2TokenParams.deserialize( | 721 var params = _AuthenticationServiceGetOAuth2TokenParams.deserialize( |
| 703 message.payload); | 722 message.payload); |
| 704 var response = _impl.getOAuth2Token(params.username,params.scopes,_authe
nticationServiceGetOAuth2TokenResponseParamsFactory); | 723 _impl.getOAuth2Token(params.username, params.scopes, _authenticationServ
iceGetOAuth2TokenResponseParamsResponder(message.header.requestId)); |
| 705 if (response is Future) { | |
| 706 return response.then((response) { | |
| 707 if (response != null) { | |
| 708 return buildResponseWithId( | |
| 709 response, | |
| 710 _authenticationServiceMethodGetOAuth2TokenName, | |
| 711 message.header.requestId, | |
| 712 bindings.MessageHeader.kMessageIsResponse); | |
| 713 } | |
| 714 }); | |
| 715 } else if (response != null) { | |
| 716 return buildResponseWithId( | |
| 717 response, | |
| 718 _authenticationServiceMethodGetOAuth2TokenName, | |
| 719 message.header.requestId, | |
| 720 bindings.MessageHeader.kMessageIsResponse); | |
| 721 } | |
| 722 break; | 724 break; |
| 723 case _authenticationServiceMethodClearOAuth2TokenName: | 725 case _authenticationServiceMethodClearOAuth2TokenName: |
| 724 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( | 726 var params = _AuthenticationServiceClearOAuth2TokenParams.deserialize( |
| 725 message.payload); | 727 message.payload); |
| 726 _impl.clearOAuth2Token(params.token); | 728 _impl.clearOAuth2Token(params.token); |
| 727 break; | 729 break; |
| 728 default: | 730 default: |
| 729 throw new bindings.MojoCodecError("Unexpected message name"); | 731 throw new bindings.MojoCodecError("Unexpected message name"); |
| 730 break; | 732 break; |
| 731 } | 733 } |
| 732 return null; | |
| 733 } | 734 } |
| 734 | 735 |
| 735 AuthenticationService get impl => _impl; | 736 AuthenticationService get impl => _impl; |
| 736 set impl(AuthenticationService d) { | 737 set impl(AuthenticationService d) { |
| 737 if (d == null) { | 738 if (d == null) { |
| 738 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 739 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 739 } | 740 } |
| 740 if (isBound && (_impl == null)) { | 741 if (isBound && (_impl == null)) { |
| 741 beginHandlingEvents(); | 742 beginHandlingEvents(); |
| 742 } | 743 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 core.MojoHandle handle, [AuthenticationService impl]) | 777 core.MojoHandle handle, [AuthenticationService impl]) |
| 777 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl)); | 778 : super(new _AuthenticationServiceStubControl.fromHandle(handle, impl)); |
| 778 | 779 |
| 779 static AuthenticationServiceStub newFromEndpoint( | 780 static AuthenticationServiceStub newFromEndpoint( |
| 780 core.MojoMessagePipeEndpoint endpoint) { | 781 core.MojoMessagePipeEndpoint endpoint) { |
| 781 assert(endpoint.setDescription("For AuthenticationServiceStub")); | 782 assert(endpoint.setDescription("For AuthenticationServiceStub")); |
| 782 return new AuthenticationServiceStub.fromEndpoint(endpoint); | 783 return new AuthenticationServiceStub.fromEndpoint(endpoint); |
| 783 } | 784 } |
| 784 | 785 |
| 785 | 786 |
| 786 dynamic selectAccount(bool returnLastSelected,[Function responseFactory = null
]) { | 787 void selectAccount(bool returnLastSelected,void callback(String username, Stri
ng error)) { |
| 787 return impl.selectAccount(returnLastSelected,responseFactory); | 788 return impl.selectAccount(returnLastSelected,callback); |
| 788 } | 789 } |
| 789 dynamic getOAuth2Token(String username,List<String> scopes,[Function responseF
actory = null]) { | 790 void getOAuth2Token(String username,List<String> scopes,void callback(String t
oken, String error)) { |
| 790 return impl.getOAuth2Token(username,scopes,responseFactory); | 791 return impl.getOAuth2Token(username,scopes,callback); |
| 791 } | 792 } |
| 792 void clearOAuth2Token(String token) { | 793 void clearOAuth2Token(String token) { |
| 793 return impl.clearOAuth2Token(token); | 794 return impl.clearOAuth2Token(token); |
| 794 } | 795 } |
| 795 } | 796 } |
| 796 | 797 |
| 797 | 798 |
| 798 | 799 |
| OLD | NEW |